[ox/mc] Make MC Write use Writer_c

This commit is contained in:
2023-06-08 00:56:02 -05:00
parent ae3f0bb5db
commit ce4dcdcd18
6 changed files with 150 additions and 137 deletions

View File

@ -122,8 +122,6 @@ std::map<ox::String, ox::Error(*)()> tests = {
"MetalClawReader",
[] {
// setup for tests
static constexpr size_t buffLen = 1024;
char buff[buffLen];
TestStruct testIn, testOut;
testIn.Bool = true;
testIn.Int = 42;
@ -140,8 +138,9 @@ std::map<ox::String, ox::Error(*)()> tests = {
testIn.Struct.Int = 300;
testIn.Struct.BString = "Test String 2";
// run tests
oxAssert(ox::writeMC(buff, buffLen, &testIn), "writeMC failed");
oxAssert(ox::readMC(buff, buffLen, &testOut), "readMC failed");
const auto [buff, err] = ox::writeMC(&testIn);
oxAssert(err, "writeMC failed");
oxAssert(ox::readMC(buff.data(), buff.size(), &testOut), "readMC failed");
//std::cout << testIn.Union.Int << "|" << testOut.Union.Int << "|\n";
oxAssert(testIn.Bool == testOut.Bool, "Bool value mismatch");
oxAssert(testIn.Int == testOut.Int, "Int value mismatch");