MCPcopy Create free account
hub / github.com/apache/fory / run_test_simple_named_struct

Function run_test_simple_named_struct

cpp/fory/serialization/xlang_test_main.cc:1572–1588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1570}
1571
1572void run_test_simple_named_struct(const std::string &data_file) {
1573 auto bytes = read_file(data_file);
1574 auto fory = build_fory(true, true);
1575 ensure_ok(fory.register_enum<Color>("demo", "color"), "register color");
1576 ensure_ok(fory.register_struct<Item>("demo", "item"), "register item");
1577 ensure_ok(fory.register_struct<SimpleStruct>("demo", "simple_struct"),
1578 "register simple_struct");
1579 auto expected = build_simple_struct();
1580 Buffer buffer = make_buffer(bytes);
1581 auto value = read_next<SimpleStruct>(fory, buffer);
1582 if (!(value == expected)) {
1583 fail("Named SimpleStruct mismatch");
1584 }
1585 std::vector<uint8_t> out;
1586 append_serialized(fory, value, out);
1587 write_file(data_file, out);
1588}
1589
1590void run_test_struct_evolving_override(const std::string &data_file) {
1591 auto bytes = read_file(data_file);

Callers 1

mainFunction · 0.85

Calls 8

read_fileFunction · 0.85
ensure_okFunction · 0.85
build_simple_structFunction · 0.85
make_bufferFunction · 0.85
failFunction · 0.85
append_serializedFunction · 0.85
write_fileFunction · 0.85
build_foryFunction · 0.70

Tested by

no test coverage detected