diff --git a/test/src/unit-class_lexer.cpp b/test/src/unit-class_lexer.cpp index c5999e35e5..b435676c6d 100644 --- a/test/src/unit-class_lexer.cpp +++ b/test/src/unit-class_lexer.cpp @@ -38,86 +38,86 @@ TEST_CASE("lexer class") { SECTION("structural characters") { - CHECK(json::lexer(reinterpret_cast("["), - 1).scan() == json::lexer::token_type::begin_array); - CHECK(json::lexer(reinterpret_cast("]"), - 1).scan() == json::lexer::token_type::end_array); - CHECK(json::lexer(reinterpret_cast("{"), - 1).scan() == json::lexer::token_type::begin_object); - CHECK(json::lexer(reinterpret_cast("}"), - 1).scan() == json::lexer::token_type::end_object); - CHECK(json::lexer(reinterpret_cast(","), - 1).scan() == json::lexer::token_type::value_separator); - CHECK(json::lexer(reinterpret_cast(":"), - 1).scan() == json::lexer::token_type::name_separator); + CHECK((json::lexer(reinterpret_cast("["), + 1).scan() == json::lexer::token_type::begin_array)); + CHECK((json::lexer(reinterpret_cast("]"), + 1).scan() == json::lexer::token_type::end_array)); + CHECK((json::lexer(reinterpret_cast("{"), + 1).scan() == json::lexer::token_type::begin_object)); + CHECK((json::lexer(reinterpret_cast("}"), + 1).scan() == json::lexer::token_type::end_object)); + CHECK((json::lexer(reinterpret_cast(","), + 1).scan() == json::lexer::token_type::value_separator)); + CHECK((json::lexer(reinterpret_cast(":"), + 1).scan() == json::lexer::token_type::name_separator)); } SECTION("literal names") { - CHECK(json::lexer(reinterpret_cast("null"), - 4).scan() == json::lexer::token_type::literal_null); - CHECK(json::lexer(reinterpret_cast("true"), - 4).scan() == json::lexer::token_type::literal_true); - CHECK(json::lexer(reinterpret_cast("false"), - 5).scan() == json::lexer::token_type::literal_false); + CHECK((json::lexer(reinterpret_cast("null"), + 4).scan() == json::lexer::token_type::literal_null)); + CHECK((json::lexer(reinterpret_cast("true"), + 4).scan() == json::lexer::token_type::literal_true)); + CHECK((json::lexer(reinterpret_cast("false"), + 5).scan() == json::lexer::token_type::literal_false)); } SECTION("numbers") { - CHECK(json::lexer(reinterpret_cast("0"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("1"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("2"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("3"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("4"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("5"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("6"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("7"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("8"), - 1).scan() == json::lexer::token_type::value_number); - CHECK(json::lexer(reinterpret_cast("9"), - 1).scan() == json::lexer::token_type::value_number); + CHECK((json::lexer(reinterpret_cast("0"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("1"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("2"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("3"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("4"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("5"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("6"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("7"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("8"), + 1).scan() == json::lexer::token_type::value_number)); + CHECK((json::lexer(reinterpret_cast("9"), + 1).scan() == json::lexer::token_type::value_number)); } SECTION("whitespace") { // result is end_of_input, because not token is following - CHECK(json::lexer(reinterpret_cast(" "), - 1).scan() == json::lexer::token_type::end_of_input); - CHECK(json::lexer(reinterpret_cast("\t"), - 1).scan() == json::lexer::token_type::end_of_input); - CHECK(json::lexer(reinterpret_cast("\n"), - 1).scan() == json::lexer::token_type::end_of_input); - CHECK(json::lexer(reinterpret_cast("\r"), - 1).scan() == json::lexer::token_type::end_of_input); - CHECK(json::lexer(reinterpret_cast(" \t\n\r\n\t "), - 7).scan() == json::lexer::token_type::end_of_input); + CHECK((json::lexer(reinterpret_cast(" "), + 1).scan() == json::lexer::token_type::end_of_input)); + CHECK((json::lexer(reinterpret_cast("\t"), + 1).scan() == json::lexer::token_type::end_of_input)); + CHECK((json::lexer(reinterpret_cast("\n"), + 1).scan() == json::lexer::token_type::end_of_input)); + CHECK((json::lexer(reinterpret_cast("\r"), + 1).scan() == json::lexer::token_type::end_of_input)); + CHECK((json::lexer(reinterpret_cast(" \t\n\r\n\t "), + 7).scan() == json::lexer::token_type::end_of_input)); } } SECTION("token_type_name") { - CHECK(json::lexer::token_type_name(json::lexer::token_type::uninitialized) == ""); - CHECK(json::lexer::token_type_name(json::lexer::token_type::literal_true) == "true literal"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::literal_false) == "false literal"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::literal_null) == "null literal"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::value_string) == "string literal"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::value_number) == "number literal"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::begin_array) == "'['"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::begin_object) == "'{'"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::end_array) == "']'"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::end_object) == "'}'"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::name_separator) == "':'"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::value_separator) == "','"); - CHECK(json::lexer::token_type_name(json::lexer::token_type::parse_error) == ""); - CHECK(json::lexer::token_type_name(json::lexer::token_type::end_of_input) == "end of input"); + CHECK((json::lexer::token_type_name(json::lexer::token_type::uninitialized) == "")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::literal_true) == "true literal")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::literal_false) == "false literal")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::literal_null) == "null literal")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::value_string) == "string literal")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::value_number) == "number literal")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::begin_array) == "'['")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::begin_object) == "'{'")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::end_array) == "']'")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::end_object) == "'}'")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::name_separator) == "':'")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::value_separator) == "','")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::parse_error) == "")); + CHECK((json::lexer::token_type_name(json::lexer::token_type::end_of_input) == "end of input")); } SECTION("parse errors on first character") @@ -150,7 +150,7 @@ TEST_CASE("lexer class") case ('8'): case ('9'): { - CHECK(res != json::lexer::token_type::parse_error); + CHECK((res != json::lexer::token_type::parse_error)); break; } @@ -160,14 +160,14 @@ TEST_CASE("lexer class") case ('\n'): case ('\r'): { - CHECK(res == json::lexer::token_type::end_of_input); + CHECK((res == json::lexer::token_type::end_of_input)); break; } // anything else is not expected default: { - CHECK(res == json::lexer::token_type::parse_error); + CHECK((res == json::lexer::token_type::parse_error)); break; } }