MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/lite/schema/flatbuffer_compatibility_test.cc:60–86  ·  view source on GitHub ↗

Checks to make sure current schema in current code does not cause an incompatibility.

Source from the content-addressed store, hash-verified

58// Checks to make sure current schema in current code does not cause an
59// incompatibility.
60TEST(SchemaTest, TestCompatibility) {
61 // Read file contents of schemas into strings
62 // TODO(aselle): Need a reliable way to load files.
63 std::string base_contents, current_contents;
64 const char *base_filename =
65 TFLITE_TF_PREFIX "lite/schema/schema_v3.fbs";
66 const char *current_filename =
67 TFLITE_TF_PREFIX "lite/schema/schema.fbs";
68
69 ASSERT_TRUE(LoadFileRaw(base_filename, &base_contents));
70 ASSERT_TRUE(LoadFileRaw(current_filename, &current_contents));
71 // Parse the schemas
72 flatbuffers::Parser base_parser, current_parser;
73 std::vector<const char *> include_directories;
74 ASSERT_TRUE(ParseFile(&base_parser, base_filename, base_contents));
75 ASSERT_TRUE(ParseFile(&current_parser, current_filename, current_contents));
76 // Check that the schemas conform and fail if they don't
77 auto err = current_parser.ConformTo(base_parser);
78 if (!err.empty()) {
79 fprintf(stderr,
80 "Schemas don't conform:\n%s\n"
81 "In other words some change you made means that new parsers can't"
82 "parse old files.\n",
83 err.c_str());
84 FAIL();
85 }
86}
87
88int main(int argc, char **argv) {
89 ::testing::InitGoogleTest(&argc, argv);

Callers

nothing calls this directly

Calls 4

LoadFileRawFunction · 0.85
ParseFileFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected