Merge commit 'f92c8ab577b28e108464f9b04eaa529fe0add452'
This commit is contained in:
1
deps/ox/src/ox/fs/test/CMakeLists.txt
vendored
1
deps/ox/src/ox/fs/test/CMakeLists.txt
vendored
@@ -43,3 +43,4 @@ add_test("Test\\ FileSystem32::rmDirectoryEntry\\(string\\)" FSTests "FileSystem
|
||||
add_test("Test\\ FileSystem32::remove\\(string,\\ true\\)" FSTests "FileSystem32::remove(string, true)")
|
||||
add_test("Test\\ FileSystem32::move" FSTests "FileSystem32::move")
|
||||
add_test("Test\\ FileSystem32::stripDirectories" FSTests "FileSystem32::stripDirectories")
|
||||
add_test("Test\\ FileSystem32::ls" FSTests "FileSystem32::ls")
|
||||
|
2
deps/ox/src/ox/fs/test/filestore_format.cpp
vendored
2
deps/ox/src/ox/fs/test/filestore_format.cpp
vendored
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
#include <ox/fs/filestore.hpp>
|
||||
|
||||
using namespace ox::fs;
|
||||
using namespace ox;
|
||||
|
||||
int main() {
|
||||
const auto size = 65535;
|
||||
|
3
deps/ox/src/ox/fs/test/filestoreio.cpp
vendored
3
deps/ox/src/ox/fs/test/filestoreio.cpp
vendored
@@ -9,8 +9,7 @@
|
||||
#include <ox/std/std.hpp>
|
||||
#include <ox/fs/filestore.hpp>
|
||||
|
||||
using namespace ox::fs;
|
||||
using namespace ox::std;
|
||||
using namespace ox;
|
||||
|
||||
template<typename FileStore>
|
||||
int test() {
|
||||
|
3
deps/ox/src/ox/fs/test/filesystem_format.cpp
vendored
3
deps/ox/src/ox/fs/test/filesystem_format.cpp
vendored
@@ -8,8 +8,7 @@
|
||||
|
||||
#include <ox/fs/filesystem.hpp>
|
||||
|
||||
using namespace ox::fs;
|
||||
using namespace ox::std;
|
||||
using namespace ox;
|
||||
|
||||
template<typename FileSystem>
|
||||
int test() {
|
||||
|
36
deps/ox/src/ox/fs/test/tests.cpp
vendored
36
deps/ox/src/ox/fs/test/tests.cpp
vendored
@@ -16,7 +16,7 @@
|
||||
#include <ox/std/std.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace ox::fs;
|
||||
using namespace ox;
|
||||
|
||||
map<string, int(*)(string)> tests = {
|
||||
{
|
||||
@@ -288,6 +288,40 @@ map<string, int(*)(string)> tests = {
|
||||
delete []buff;
|
||||
delete []dataOut;
|
||||
|
||||
return retval;
|
||||
}
|
||||
},
|
||||
{
|
||||
"FileSystem32::ls",
|
||||
[](string) {
|
||||
int retval = 0;
|
||||
auto dataIn = "test string";
|
||||
auto dataOutLen = ox_strlen(dataIn) + 1;
|
||||
auto dataOut = new char[dataOutLen];
|
||||
vector<uint64_t> inodes;
|
||||
vector<DirectoryListing<string>> files;
|
||||
|
||||
const auto size = 1024 * 1024;
|
||||
auto buff = new uint8_t[size];
|
||||
FileSystem32::format(buff, (FileStore32::FsSize_t) size, true);
|
||||
auto fs = (FileSystem32*) createFileSystem(buff, size);
|
||||
|
||||
retval |= fs->mkdir("/usr");
|
||||
retval |= fs->mkdir("/usr/share");
|
||||
retval |= fs->write("/usr/share/a.txt", (void*) dataIn, ox_strlen(dataIn) + 1);
|
||||
retval |= fs->write("/usr/share/b.txt", (void*) dataIn, ox_strlen(dataIn) + 1);
|
||||
retval |= fs->write("/usr/share/c.txt", (void*) dataIn, ox_strlen(dataIn) + 1);
|
||||
|
||||
fs->ls("/usr/share/", &files);
|
||||
|
||||
retval |= !(files[0].name == "a.txt");
|
||||
retval |= !(files[1].name == "b.txt");
|
||||
retval |= !(files[2].name == "c.txt");
|
||||
|
||||
delete fs;
|
||||
delete []buff;
|
||||
delete []dataOut;
|
||||
|
||||
return retval;
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user