tomlplusplus/tests/parsing_booleans.cpp
Mark Gillard 5e683e9a73 fixed is_unicode_XXXXXX functions being wrong in some cases
also:
- added tests for unicode functions
- changed `TOML_LIKELY` semantics to work with gcc-style intrinsics
- greatly improved unicode-related codegen
- parser refactoring
2020-04-18 23:42:33 +03:00

30 lines
745 B
C++

#include "tests.h"
TEST_CASE("parsing - booleans")
{
parsing_should_succeed(
FILE_LINE_ARGS,
S(R"(
bool1 = true
bool2 = false
)"sv),
[](table&& tbl)
{
CHECK(tbl[S("bool1")] == true);
CHECK(tbl[S("bool2")] == false);
}
);
// "Always lowercase."
parsing_should_fail(FILE_LINE_ARGS, S("bool = True"sv));
parsing_should_fail(FILE_LINE_ARGS, S("bool = TRUE"sv));
parsing_should_fail(FILE_LINE_ARGS, S("bool = tRUE"sv));
parsing_should_fail(FILE_LINE_ARGS, S("bool = False"sv));
parsing_should_fail(FILE_LINE_ARGS, S("bool = FALSE"sv));
parsing_should_fail(FILE_LINE_ARGS, S("bool = fALSE"sv));
// value tests
parse_expected_value(FILE_LINE_ARGS, " true", true);
parse_expected_value(FILE_LINE_ARGS, "false", false);
}