Renamed project Ox and restructured it to allow it to become a baremetal

unikernel/stdlib.
This commit is contained in:
2016-06-24 18:27:46 -05:00
parent f9f19819ef
commit 7a81449148
18 changed files with 80 additions and 69 deletions
+17
View File
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 2.8)
add_executable(
Format
format.cpp
)
add_executable(
FileStoreIO
filestoreio.cpp
)
target_link_libraries(Format OxFS OxStd)
target_link_libraries(FileStoreIO OxFS OxStd)
add_test("Format" Format)
add_test("FileStoreIO" FileStoreIO)
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright 2015 - 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <ox/std/_strops.hpp>
#include <ox/fs/filestore.hpp>
using namespace ox::fs;
template<typename FileStore>
int test() {
const auto size = 65535;
uint8_t volume[size];
char out[6];
uint32_t err;
typename FileStore::FsSize_t outSize;
FileStore::format(volume, size);
FileStore fs(volume, volume + size, &err);
if (fs.write(1, (void*) "Hello", 6) ||
fs.read(1, (char*) out, &outSize) ||
strcmp("Hello", out)) {
return 1;
}
if (fs.write(2, (void*) "World", 6) ||
fs.read(2, (char*) out, &outSize) ||
strcmp("World", out)) {
return 1;
}
// make sure first value was not overwritten
if (fs.read(1, (char*) out, &outSize) ||
strcmp("Hello", out)) {
return 1;
}
return 0;
}
int main() {
return test<FileStore16>() | test<FileStore32>() | test<FileStore64>();
}
+19
View File
@@ -0,0 +1,19 @@
/*
* Copyright 2015 - 2016 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <ox/fs/filestore.hpp>
using namespace ox::fs;
int main() {
const auto size = 65535;
uint8_t volume[size];
uint32_t err;
FileStore32::format(volume, size);
FileStore32(volume, volume + size, &err);
return err;
}