[ox] Change macro names to comply with broader conventions
This commit is contained in:
52
deps/ox/src/ox/claw/test/tests.cpp
vendored
52
deps/ox/src/ox/claw/test/tests.cpp
vendored
@ -62,44 +62,44 @@ struct TestStruct {
|
||||
|
||||
template<typename T>
|
||||
constexpr ox::Error model(T *io, ox::CommonPtrWith<TestUnion> auto *obj) {
|
||||
oxReturnError(io->template setTypeInfo<TestUnion>());
|
||||
oxReturnError(io->field("Bool", &obj->Bool));
|
||||
oxReturnError(io->field("Int", &obj->Int));
|
||||
oxReturnError(io->fieldCString("String", &obj->String));
|
||||
OX_RETURN_ERROR(io->template setTypeInfo<TestUnion>());
|
||||
OX_RETURN_ERROR(io->field("Bool", &obj->Bool));
|
||||
OX_RETURN_ERROR(io->field("Int", &obj->Int));
|
||||
OX_RETURN_ERROR(io->fieldCString("String", &obj->String));
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr ox::Error model(T *io, ox::CommonPtrWith<TestStructNest> auto *obj) {
|
||||
oxReturnError(io->template setTypeInfo<TestStructNest>());
|
||||
oxReturnError(io->field("Bool", &obj->Bool));
|
||||
oxReturnError(io->field("Int", &obj->Int));
|
||||
oxReturnError(io->field("String", &obj->String));
|
||||
OX_RETURN_ERROR(io->template setTypeInfo<TestStructNest>());
|
||||
OX_RETURN_ERROR(io->field("Bool", &obj->Bool));
|
||||
OX_RETURN_ERROR(io->field("Int", &obj->Int));
|
||||
OX_RETURN_ERROR(io->field("String", &obj->String));
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr ox::Error model(T *io, ox::CommonPtrWith<TestStruct> auto *obj) {
|
||||
oxReturnError(io->template setTypeInfo<TestStruct>());
|
||||
oxReturnError(io->field("Bool", &obj->Bool));
|
||||
oxReturnError(io->field("Int", &obj->Int));
|
||||
oxReturnError(io->field("Int1", &obj->Int1));
|
||||
oxReturnError(io->field("Int2", &obj->Int2));
|
||||
oxReturnError(io->field("Int3", &obj->Int3));
|
||||
oxReturnError(io->field("Int4", &obj->Int4));
|
||||
oxReturnError(io->field("Int5", &obj->Int5));
|
||||
oxReturnError(io->field("Int6", &obj->Int6));
|
||||
oxReturnError(io->field("Int7", &obj->Int7));
|
||||
oxReturnError(io->field("Int8", &obj->Int8));
|
||||
OX_RETURN_ERROR(io->template setTypeInfo<TestStruct>());
|
||||
OX_RETURN_ERROR(io->field("Bool", &obj->Bool));
|
||||
OX_RETURN_ERROR(io->field("Int", &obj->Int));
|
||||
OX_RETURN_ERROR(io->field("Int1", &obj->Int1));
|
||||
OX_RETURN_ERROR(io->field("Int2", &obj->Int2));
|
||||
OX_RETURN_ERROR(io->field("Int3", &obj->Int3));
|
||||
OX_RETURN_ERROR(io->field("Int4", &obj->Int4));
|
||||
OX_RETURN_ERROR(io->field("Int5", &obj->Int5));
|
||||
OX_RETURN_ERROR(io->field("Int6", &obj->Int6));
|
||||
OX_RETURN_ERROR(io->field("Int7", &obj->Int7));
|
||||
OX_RETURN_ERROR(io->field("Int8", &obj->Int8));
|
||||
int unionIdx = 0;
|
||||
if constexpr(T::opType() != ox::OpType::Reflect) {
|
||||
unionIdx = obj->unionIdx;
|
||||
}
|
||||
oxReturnError(io->field("Union", ox::UnionView{&obj->Union, unionIdx}));
|
||||
oxReturnError(io->field("String", &obj->String));
|
||||
oxReturnError(io->field("List", obj->List, 4));
|
||||
oxReturnError(io->field("EmptyStruct", &obj->EmptyStruct));
|
||||
oxReturnError(io->field("Struct", &obj->Struct));
|
||||
OX_RETURN_ERROR(io->field("Union", ox::UnionView{&obj->Union, unionIdx}));
|
||||
OX_RETURN_ERROR(io->field("String", &obj->String));
|
||||
OX_RETURN_ERROR(io->field("List", obj->List, 4));
|
||||
OX_RETURN_ERROR(io->field("EmptyStruct", &obj->EmptyStruct));
|
||||
OX_RETURN_ERROR(io->field("Struct", &obj->Struct));
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ static std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
[] {
|
||||
constexpr auto hdr = ox::StringLiteral("M2;com.drinkingtea.ox.claw.test.Header2;3;awefawf");
|
||||
constexpr auto expected = ox::StringLiteral("com.drinkingtea.ox.claw.test.Header2;3");
|
||||
oxRequire(actual, ox::readClawTypeId({hdr.data(), hdr.len() + 1}));
|
||||
OX_REQUIRE(actual, ox::readClawTypeId({hdr.data(), hdr.len() + 1}));
|
||||
oxExpect(actual, expected);
|
||||
return ox::Error{};
|
||||
}
|
||||
@ -145,7 +145,7 @@ static std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
// This test doesn't confirm much, but it does show that the writer
|
||||
// doesn't segfault
|
||||
TestStruct ts;
|
||||
oxReturnError(ox::writeClaw(ts, ox::ClawFormat::Metal));
|
||||
OX_RETURN_ERROR(ox::writeClaw(ts, ox::ClawFormat::Metal));
|
||||
return ox::Error(0);
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user