Cleaned up test output.

Change-Id: I4bec0e728cc162aa3f19091a0d154124ffbccdff
parent dca33ddb
...@@ -104,19 +104,19 @@ flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer) { ...@@ -104,19 +104,19 @@ flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer) {
auto testv = builder.CreateVectorOfStructs(tests, 2); auto testv = builder.CreateVectorOfStructs(tests, 2);
#ifndef FLATBUFFERS_CPP98_STL #ifndef FLATBUFFERS_CPP98_STL
// Create a vector of structures from a lambda. // Create a vector of structures from a lambda.
auto testv2 = builder.CreateVectorOfStructs<Test>( auto testv2 = builder.CreateVectorOfStructs<Test>(
2, [&](size_t i, Test* s) -> void { 2, [&](size_t i, Test* s) -> void {
*s = tests[i]; *s = tests[i];
}); });
#else #else
// Create a vector of structures using a plain old C++ function. // Create a vector of structures using a plain old C++ function.
auto testv2 = builder.CreateVectorOfStructs<Test>( auto testv2 = builder.CreateVectorOfStructs<Test>(
2, [](size_t i, Test* s, void *state) -> void { 2, [](size_t i, Test* s, void *state) -> void {
*s = (reinterpret_cast<Test*>(state))[i]; *s = (reinterpret_cast<Test*>(state))[i];
}, tests); }, tests);
#endif // FLATBUFFERS_CPP98_STL #endif // FLATBUFFERS_CPP98_STL
// create monster with very few fields set: // create monster with very few fields set:
// (same functionality as CreateMonster below, but sets fields manually) // (same functionality as CreateMonster below, but sets fields manually)
...@@ -1071,9 +1071,11 @@ void FuzzTest2() { ...@@ -1071,9 +1071,11 @@ void FuzzTest2() {
TEST_NOTNULL(NULL); TEST_NOTNULL(NULL);
} }
#ifdef FLATBUFFERS_TEST_VERBOSE
TEST_OUTPUT_LINE("%dk schema tested with %dk of json\n", TEST_OUTPUT_LINE("%dk schema tested with %dk of json\n",
static_cast<int>(schema.length() / 1024), static_cast<int>(schema.length() / 1024),
static_cast<int>(json.length() / 1024)); static_cast<int>(json.length() / 1024));
#endif
} }
// Test that parser errors are actually generated. // Test that parser errors are actually generated.
...@@ -1594,7 +1596,7 @@ void FlexBuffersTest() { ...@@ -1594,7 +1596,7 @@ void FlexBuffersTest() {
// Write the equivalent of: // Write the equivalent of:
// { vec: [ -100, "Fred", 4.0, false ], bar: [ 1, 2, 3 ], bar3: [ 1, 2, 3 ], foo: 100, bool: true, mymap: { foo: "Fred" } } // { vec: [ -100, "Fred", 4.0, false ], bar: [ 1, 2, 3 ], bar3: [ 1, 2, 3 ], foo: 100, bool: true, mymap: { foo: "Fred" } }
#ifndef FLATBUFFERS_CPP98_STL #ifndef FLATBUFFERS_CPP98_STL
// It's possible to do this without std::function support as well. // It's possible to do this without std::function support as well.
slb.Map([&]() { slb.Map([&]() {
slb.Vector("vec", [&]() { slb.Vector("vec", [&]() {
...@@ -1617,7 +1619,7 @@ void FlexBuffersTest() { ...@@ -1617,7 +1619,7 @@ void FlexBuffersTest() {
}); });
}); });
slb.Finish(); slb.Finish();
#else #else
// It's possible to do this without std::function support as well. // It's possible to do this without std::function support as well.
slb.Map([](flexbuffers::Builder& slb2) { slb.Map([](flexbuffers::Builder& slb2) {
slb2.Vector("vec", [](flexbuffers::Builder& slb3) { slb2.Vector("vec", [](flexbuffers::Builder& slb3) {
...@@ -1638,11 +1640,13 @@ void FlexBuffersTest() { ...@@ -1638,11 +1640,13 @@ void FlexBuffersTest() {
}, slb2); }, slb2);
}, slb); }, slb);
slb.Finish(); slb.Finish();
#endif // FLATBUFFERS_CPP98_STL #endif // FLATBUFFERS_CPP98_STL
#ifdef FLATBUFFERS_TEST_VERBOSE
for (size_t i = 0; i < slb.GetBuffer().size(); i++) for (size_t i = 0; i < slb.GetBuffer().size(); i++)
printf("%d ", flatbuffers::vector_data(slb.GetBuffer())[i]); printf("%d ", flatbuffers::vector_data(slb.GetBuffer())[i]);
printf("\n"); printf("\n");
#endif
auto map = flexbuffers::GetRoot(slb.GetBuffer()).AsMap(); auto map = flexbuffers::GetRoot(slb.GetBuffer()).AsMap();
TEST_EQ(map.size(), 7); TEST_EQ(map.size(), 7);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment