Commit 2587bc29 authored by Lefebvre, Jordan's avatar Lefebvre, Jordan

Fixing fail04/09 pass tests. Cleaning up failure checks.

parent 6693ba85
Pipeline #96305 passed with stages
in 20 minutes and 56 seconds
......@@ -247,18 +247,9 @@ bool parse_and_test(const std::string& file)
}
bool success = parser.parse_from_file(filename);
if (benchmark) benchmark_timer.stop();
bool return_success = false;
// check if failure is expected
if (file.substr(0, 4).compare("fail") == 0)
{
return_success = !success;
}
else
{
return_success = success;
}
// only show error if parse failed and it was supposed to succeed
if (!success && !return_success)
if (!success)
{
// dump the json error
std::cout << parser.last_error() << std::endl;
......@@ -269,49 +260,49 @@ bool parse_and_test(const std::string& file)
<< ") timing: " << (benchmark_timer.duration() / 1e9)
<< " seconds" << std::endl;
}
return return_success;
return success;
}
TEST(JSONParser, JSONCheckerFailures)
{
// EXPECT_TRUE(parse_and_test("fail01_EXCLUDE.json"));
EXPECT_TRUE(parse_and_test("fail02.json"));
EXPECT_TRUE(parse_and_test("fail03.json"));
EXPECT_TRUE(parse_and_test("fail05.json"));
EXPECT_TRUE(parse_and_test("fail06.json"));
EXPECT_TRUE(parse_and_test("fail07.json"));
EXPECT_TRUE(parse_and_test("fail08.json"));
EXPECT_TRUE(parse_and_test("fail10.json"));
EXPECT_TRUE(parse_and_test("fail11.json"));
EXPECT_TRUE(parse_and_test("fail12.json"));
EXPECT_TRUE(parse_and_test("fail13.json"));
EXPECT_TRUE(parse_and_test("fail14.json"));
EXPECT_TRUE(parse_and_test("fail15.json"));
EXPECT_TRUE(parse_and_test("fail16.json"));
EXPECT_TRUE(parse_and_test("fail17.json"));
// EXPECT_TRUE(parse_and_test("fail18_EXCLUDE.json"));
EXPECT_TRUE(parse_and_test("fail19.json"));
EXPECT_TRUE(parse_and_test("fail20.json"));
EXPECT_TRUE(parse_and_test("fail21.json"));
EXPECT_TRUE(parse_and_test("fail22.json"));
EXPECT_TRUE(parse_and_test("fail23.json"));
EXPECT_TRUE(parse_and_test("fail24.json"));
EXPECT_TRUE(parse_and_test("fail25.json"));
EXPECT_TRUE(parse_and_test("fail26.json"));
EXPECT_TRUE(parse_and_test("fail27.json"));
EXPECT_TRUE(parse_and_test("fail28.json"));
EXPECT_TRUE(parse_and_test("fail29.json"));
EXPECT_TRUE(parse_and_test("fail30.json"));
EXPECT_TRUE(parse_and_test("fail31.json"));
EXPECT_TRUE(parse_and_test("fail32.json"));
EXPECT_TRUE(parse_and_test("fail33.json"));
EXPECT_FALSE(parse_and_test("fail02.json"));
EXPECT_FALSE(parse_and_test("fail03.json"));
EXPECT_FALSE(parse_and_test("fail05.json"));
EXPECT_FALSE(parse_and_test("fail06.json"));
EXPECT_FALSE(parse_and_test("fail07.json"));
EXPECT_FALSE(parse_and_test("fail08.json"));
EXPECT_FALSE(parse_and_test("fail10.json"));
EXPECT_FALSE(parse_and_test("fail11.json"));
EXPECT_FALSE(parse_and_test("fail12.json"));
EXPECT_FALSE(parse_and_test("fail13.json"));
EXPECT_FALSE(parse_and_test("fail14.json"));
EXPECT_FALSE(parse_and_test("fail15.json"));
EXPECT_FALSE(parse_and_test("fail16.json"));
EXPECT_FALSE(parse_and_test("fail17.json"));
// EXPECT_FALSE(parse_and_test("fail18_EXCLUDE.json"));
EXPECT_FALSE(parse_and_test("fail19.json"));
EXPECT_FALSE(parse_and_test("fail20.json"));
EXPECT_FALSE(parse_and_test("fail21.json"));
EXPECT_FALSE(parse_and_test("fail22.json"));
EXPECT_FALSE(parse_and_test("fail23.json"));
EXPECT_FALSE(parse_and_test("fail24.json"));
EXPECT_FALSE(parse_and_test("fail25.json"));
EXPECT_FALSE(parse_and_test("fail26.json"));
EXPECT_FALSE(parse_and_test("fail27.json"));
EXPECT_FALSE(parse_and_test("fail28.json"));
EXPECT_FALSE(parse_and_test("fail29.json"));
EXPECT_FALSE(parse_and_test("fail30.json"));
EXPECT_FALSE(parse_and_test("fail31.json"));
EXPECT_FALSE(parse_and_test("fail32.json"));
EXPECT_FALSE(parse_and_test("fail33.json"));
}
TEST(JSONParser, JSONCheckerPassing)
{
EXPECT_TRUE(parse_and_test("pass01.json"));
EXPECT_TRUE(parse_and_test("pass02.json"));
EXPECT_TRUE(parse_and_test("pass03.json"));
EXPECT_TRUE(parse_and_test("fail04.json"));
EXPECT_TRUE(parse_and_test("fail09.json"));
EXPECT_TRUE(parse_and_test("pass04.json"));
EXPECT_TRUE(parse_and_test("pass05.json"));
EXPECT_TRUE(parse_and_test("roundtrip01.json"));
EXPECT_TRUE(parse_and_test("roundtrip02.json"));
EXPECT_TRUE(parse_and_test("roundtrip03.json"));
......
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