| 1692 | } |
| 1693 | |
| 1694 | void run_test_integer(const std::string &data_file) { |
| 1695 | auto bytes = read_file(data_file); |
| 1696 | auto fory = build_fory(true, true); |
| 1697 | ensure_ok(fory.register_struct<Item1>(101), "register Item1"); |
| 1698 | Buffer buffer = make_buffer(bytes); |
| 1699 | |
| 1700 | Item1 expected; |
| 1701 | expected.f1 = 1; |
| 1702 | expected.f2 = 2; |
| 1703 | expected.f3 = 3; |
| 1704 | expected.f4 = 4; |
| 1705 | expected.f5 = 0; |
| 1706 | expected.f6 = 0; |
| 1707 | |
| 1708 | auto item_value = read_next<Item1>(fory, buffer); |
| 1709 | if (!(item_value == expected)) { |
| 1710 | fail("Item1 mismatch"); |
| 1711 | } |
| 1712 | // Note: we do not consume the trailing primitive integers from the |
| 1713 | // Java-produced payload here. They are validated on the Java and Rust |
| 1714 | // sides and re-written by the C++ side below for the C++ -> Java |
| 1715 | // round-trip. |
| 1716 | |
| 1717 | std::vector<uint8_t> out; |
| 1718 | append_serialized(fory, item_value, out); |
| 1719 | append_serialized(fory, 1, out); |
| 1720 | append_serialized(fory, 2, out); |
| 1721 | append_serialized(fory, std::optional<int32_t>(3), out); |
| 1722 | append_serialized(fory, std::optional<int32_t>(4), out); |
| 1723 | // xlang mode uses nullable=false by default, so write 0 not null |
| 1724 | append_serialized(fory, 0, out); |
| 1725 | append_serialized(fory, 0, out); |
| 1726 | write_file(data_file, out); |
| 1727 | } |
| 1728 | |
| 1729 | void run_test_decimal(const std::string &data_file) { |
| 1730 | auto bytes = read_file(data_file); |
no test coverage detected