mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-08 13:50:06 +00:00
10fd14f8b9
This patch consistently changes the inclusion order for unit test files to the following: 1. The header of the unit under test (using <> includes). 2. The unit_test.hpp header (using "" includes). 3. Any additional auxiliary test headers (using "" includes and sorted alphabetically). 4. Additional system headers needed for the test (using <> includes and sorted alphabetically). 5. Conditionally included system headers (using <> includes). Putting the unit under test's header at the very beginning has the advantage of also testing that the header is self-contained. It also makes it very quick to tell what unit is tested in this file.
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
#include <toml/lexer.hpp>
|
|
|
|
#include "unit_test.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");
|
|
}
|