Lines Matching +full:json +full:- +full:schema
26 T read = table->GetField(voffset, static_cast<T>(0)); in CompareTableFieldValue()
38 const int8_t char_val = -127; // 0x81 in FuzzTest1()
40 const int16_t short_val = -32222; // 0x8222; in FuzzTest1()
92 auto table = reinterpret_cast<flatbuffers::Table *>(eob - objects[i]); in FuzzTest1()
113 // High level stress/fuzz test: generate a big schema and
114 // matching json data in random combinations, then parse both,
115 // generate json back from the binary, and compare with the original.
126 std::string schema = "namespace test;\n\n"; in FuzzTest2() local
131 // Since we're generating schema and corresponding data in tandem, in FuzzTest2()
143 // clang-format off in FuzzTest2()
145 RndDef::Add(definitions, schema, instances_per_definition, \ in FuzzTest2()
149 RndDef::Add(definitions, schema, instances_per_definition, \ in FuzzTest2()
151 // clang-format on in FuzzTest2()
159 // Simultanenously, we generate instances_per_definition JSON data in FuzzTest2()
160 // definitions, which will have identical structure to the schema in FuzzTest2()
173 const bool is_last_field = field == fields_per_definition - 1; in FuzzTest2()
177 // Don't deprecate the last field to avoid dangling commas in JSON. in FuzzTest2()
230 deprecated ? "" : "255"); // No fixed-length arrays in tables. in FuzzTest2()
237 schema += flatbuffers::TypeName(base_type); in FuzzTest2()
257 schema += "root_type D" + flatbuffers::NumToString(num_definitions - 1); in FuzzTest2()
258 schema += ";\n"; in FuzzTest2()
265 // Parse the schema, parse the generated data, then generate text back in FuzzTest2()
267 TEST_EQ(parser.Parse(schema.c_str()), true); in FuzzTest2()
269 const std::string &json = in FuzzTest2() local
270 definitions[num_definitions - 1].instances[0] + "\n"; in FuzzTest2()
272 TEST_EQ(parser.Parse(json.c_str()), true); in FuzzTest2()
279 if (jsongen != json) { in FuzzTest2()
282 size_t len = std::min(json.length(), jsongen.length()); in FuzzTest2()
284 if (json[i] != jsongen[i]) { in FuzzTest2()
285 i -= std::min(static_cast<size_t>(10), i); // show some context; in FuzzTest2()
289 static_cast<int>(i), jsongen[i], json[i]); in FuzzTest2()
293 TEST_NOTNULL(nullptr); //-V501 (this comment suppresses CWE-570 warning) in FuzzTest2()
296 // clang-format off in FuzzTest2()
298 TEST_OUTPUT_LINE("%dk schema tested with %dk of json\n", in FuzzTest2()
299 static_cast<int>(schema.length() / 1024), in FuzzTest2()
300 static_cast<int>(json.length() / 1024)); in FuzzTest2()
302 // clang-format on in FuzzTest2()