tomlplusplus/tests/parsing_booleans.cpp
Mark Gillard 5ca6b29cb9 added support for implementations without <charconv> (fixes #21)
also:
- fixed some parsing and printing ops being locale-dependent (fixes #19)
- fixed pkgconfig subdir being wrong (fixes #23)
- fixed some parsing errors at EOF when `TOML_EXCEPTIONS = 0`
- fixed some unreferenced variable warnings on older compilers
- fixed some 'maybe-uninitialized' false-positives on GCC9
- added debug/release awareness to CI tests
- added locale awareness to catch test runner
2020-04-07 18:01:22 +03:00

30 lines
754 B
C++

#include "tests.h"
TEST_CASE("parsing - booleans")
{
parsing_should_succeed(
FILE_LINE_ARGS,
S(R"(
bool1 = true
bool2 = false
)"sv),
[](table&& tbl) noexcept
{
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);
}