mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 10:28:09 +08:00

This removes one #define from each unit test file and ensures consistency between file and module names. This consistency, was not strictly maintained before. I hope that any discrepancies were unintentional and that a 1:1 mapping is actually what is desired. Since the definition is now done at one single place, it would be easy to apply transformations like removing the 'test_' prefix or replacing '_' with '-' if this should be desired.
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
#include "unit_test.hpp"
|
|
|
|
#include <toml/lexer.hpp>
|
|
#include "test_lex_aux.hpp"
|
|
|
|
using namespace toml;
|
|
using namespace detail;
|
|
|
|
BOOST_AUTO_TEST_CASE(test_offset_datetime)
|
|
{
|
|
TOML11_TEST_LEX_ACCEPT(lex_offset_date_time,
|
|
"1979-05-27T07:32:00Z",
|
|
"1979-05-27T07:32:00Z");
|
|
TOML11_TEST_LEX_ACCEPT(lex_offset_date_time,
|
|
"1979-05-27T07:32:00-07:00",
|
|
"1979-05-27T07:32:00-07:00");
|
|
TOML11_TEST_LEX_ACCEPT(lex_offset_date_time,
|
|
"1979-05-27T07:32:00.999999-07:00",
|
|
"1979-05-27T07:32:00.999999-07:00");
|
|
|
|
TOML11_TEST_LEX_ACCEPT(lex_offset_date_time,
|
|
"1979-05-27 07:32:00Z",
|
|
"1979-05-27 07:32:00Z");
|
|
TOML11_TEST_LEX_ACCEPT(lex_offset_date_time,
|
|
"1979-05-27 07:32:00-07:00",
|
|
"1979-05-27 07:32:00-07:00");
|
|
TOML11_TEST_LEX_ACCEPT(lex_offset_date_time,
|
|
"1979-05-27 07:32:00.999999-07:00",
|
|
"1979-05-27 07:32:00.999999-07:00");
|
|
}
|
|
|
|
BOOST_AUTO_TEST_CASE(test_local_datetime)
|
|
{
|
|
TOML11_TEST_LEX_ACCEPT(lex_local_date_time,
|
|
"1979-05-27T07:32:00",
|
|
"1979-05-27T07:32:00");
|
|
TOML11_TEST_LEX_ACCEPT(lex_local_date_time,
|
|
"1979-05-27T07:32:00.999999",
|
|
"1979-05-27T07:32:00.999999");
|
|
|
|
TOML11_TEST_LEX_ACCEPT(lex_local_date_time,
|
|
"1979-05-27 07:32:00",
|
|
"1979-05-27 07:32:00");
|
|
TOML11_TEST_LEX_ACCEPT(lex_local_date_time,
|
|
"1979-05-27 07:32:00.999999",
|
|
"1979-05-27 07:32:00.999999");
|
|
}
|
|
|
|
BOOST_AUTO_TEST_CASE(test_local_date)
|
|
{
|
|
TOML11_TEST_LEX_ACCEPT(lex_local_date, "1979-05-27", "1979-05-27");
|
|
}
|
|
BOOST_AUTO_TEST_CASE(test_local_time)
|
|
{
|
|
TOML11_TEST_LEX_ACCEPT(lex_local_time, "07:32:00", "07:32:00");
|
|
TOML11_TEST_LEX_ACCEPT(lex_local_time, "07:32:00.999999", "07:32:00.999999");
|
|
}
|