MCPcopy Create free account
hub / github.com/apache/tvm-ffi / TEST

Function TEST

tests/cpp/extra/test_serialization.cc:39–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37using namespace tvm::ffi::testing;
38
39TEST(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
56TEST(Serialization, IntegerTypes) {
57 // Test positive integer

Callers

nothing calls this directly

Calls 15

StringifyFunction · 0.85
ParseFunction · 0.85
StructuralEqualFunction · 0.50
ToJSONGraphFunction · 0.50
FromJSONGraphFunction · 0.50
StringClass · 0.50
BytesClass · 0.50
AnyClass · 0.50
TVarClass · 0.50
TIntClass · 0.50
TFuncClass · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected