| 37 | using namespace tvm::ffi::testing; |
| 38 | |
| 39 | TEST(Serialization, BoolNull) { |
| 40 | json::Object expected_null = |
| 41 | json::Object{{"root_index", 0}, {"nodes", json::Array{json::Object{{"type", "None"}}}}}; |
| 42 | EXPECT_TRUE(StructuralEqual()(ToJSONGraph(nullptr), expected_null)); |
| 43 | EXPECT_TRUE(StructuralEqual()(FromJSONGraph(expected_null), nullptr)); |
| 44 | |
| 45 | json::Object expected_true = json::Object{ |
| 46 | {"root_index", 0}, {"nodes", json::Array{json::Object{{"type", "bool"}, {"data", true}}}}}; |
| 47 | EXPECT_TRUE(StructuralEqual()(ToJSONGraph(true), expected_true)); |
| 48 | EXPECT_TRUE(StructuralEqual()(FromJSONGraph(expected_true), true)); |
| 49 | |
| 50 | json::Object expected_false = json::Object{ |
| 51 | {"root_index", 0}, {"nodes", json::Array{json::Object{{"type", "bool"}, {"data", false}}}}}; |
| 52 | EXPECT_TRUE(StructuralEqual()(ToJSONGraph(false), expected_false)); |
| 53 | EXPECT_TRUE(StructuralEqual()(FromJSONGraph(expected_false), false)); |
| 54 | } |
| 55 | |
| 56 | TEST(Serialization, IntegerTypes) { |
| 57 | // Test positive integer |
nothing calls this directly
no test coverage detected