Merge commit 'f92c8ab577b28e108464f9b04eaa529fe0add452'

This commit is contained in:
2017-05-12 00:26:58 -05:00
17 changed files with 321 additions and 187 deletions

View File

@@ -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")

View File

@@ -7,7 +7,7 @@
*/
#include <ox/fs/filestore.hpp>
using namespace ox::fs;
using namespace ox;
int main() {
const auto size = 65535;

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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;
}
},