mirror of
https://github.com/marzer/tomlplusplus.git
synced 2024-11-02 11:26:26 +00:00
83315a3912
also: - significantly improved the performance of toml::parse_file - improved the performance of printing to streams for deepy-nested TOML data - simplified some of the examples - added more tests - cleaned up some of the test code
30 lines
753 B
C++
30 lines
753 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);
|
|
}
|