[ox/std] Add MallocaPtr
This commit is contained in:
9
deps/ox/src/ox/fs/test/tests.cpp
vendored
9
deps/ox/src/ox/fs/test/tests.cpp
vendored
@@ -337,8 +337,7 @@ map<string, int(*)(string)> tests = {
|
||||
"Ptr::subPtr",
|
||||
[](string) {
|
||||
constexpr auto buffLen = 5000;
|
||||
uint8_t buff[buffLen];
|
||||
ox::ptrarith::Ptr<uint8_t, uint32_t> p(buff, buffLen, 500, 500);
|
||||
ox::ptrarith::Ptr<uint8_t, uint32_t> p(ox_alloca(buffLen), buffLen, 500, 500);
|
||||
oxAssert(p.valid(), "Ptr::subPtr: Ptr p is invalid.");
|
||||
|
||||
auto subPtr = p.subPtr<uint64_t>(50);
|
||||
@@ -351,8 +350,7 @@ map<string, int(*)(string)> tests = {
|
||||
[](string) {
|
||||
int err = 0;
|
||||
constexpr auto buffLen = 5000;
|
||||
uint8_t buff[buffLen];
|
||||
auto list = new (buff) ox::ptrarith::NodeBuffer<uint32_t, ox::fs::FileStoreItem<uint32_t>>(buffLen);
|
||||
auto list = new (ox_alloca(buffLen)) ox::ptrarith::NodeBuffer<uint32_t, ox::fs::FileStoreItem<uint32_t>>(buffLen);
|
||||
oxAssert(list->malloc(50).valid(), "NodeBuffer::insert: malloc 1 failed");
|
||||
oxAssert(list->malloc(50).valid(), "NodeBuffer::insert: malloc 2 failed");
|
||||
auto first = list->firstItem();
|
||||
@@ -369,8 +367,7 @@ map<string, int(*)(string)> tests = {
|
||||
constexpr auto str1Len = ox_strlen(str1) + 1;
|
||||
constexpr auto str2 = "Hello, Moon!";
|
||||
constexpr auto str2Len = ox_strlen(str2) + 1;
|
||||
uint8_t buff[buffLen];
|
||||
auto list = new (buff) ox::ptrarith::NodeBuffer<uint32_t, ox::fs::FileStoreItem<uint32_t>>(buffLen);
|
||||
auto list = new (ox_alloca(buffLen)) ox::ptrarith::NodeBuffer<uint32_t, ox::fs::FileStoreItem<uint32_t>>(buffLen);
|
||||
ox::fs::FileStore32 fileStore(list, buffLen);
|
||||
oxAssert(fileStore.format() == 0, "FileStore::format failed.");
|
||||
oxAssert(fileStore.write(4, const_cast<char*>(str1), str1Len, 1) == 0, "FileStore::write 1 failed.");
|
||||
|
Reference in New Issue
Block a user