[go: up one dir, main page]

File: test_lex_boolean.cpp

package info (click to toggle)
toml11 3.7.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,120 kB
  • sloc: cpp: 17,500; sh: 6; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 715 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#define BOOST_TEST_MODULE "test_lex_boolean"
#include <boost/test/unit_test.hpp>
#include <toml/lexer.hpp>
#include "test_lex_aux.hpp"

using namespace toml;
using namespace detail;

BOOST_AUTO_TEST_CASE(test_correct)
{
    TOML11_TEST_LEX_ACCEPT(lex_boolean, "true", "true");
    TOML11_TEST_LEX_ACCEPT(lex_boolean, "false", "false");
    TOML11_TEST_LEX_ACCEPT(lex_boolean, "true  # trailing", "true");
    TOML11_TEST_LEX_ACCEPT(lex_boolean, "false # trailing", "false");
}

BOOST_AUTO_TEST_CASE(test_invalid)
{
    TOML11_TEST_LEX_REJECT(lex_boolean, "TRUE");
    TOML11_TEST_LEX_REJECT(lex_boolean, "FALSE");
    TOML11_TEST_LEX_REJECT(lex_boolean, "True");
    TOML11_TEST_LEX_REJECT(lex_boolean, "False");
}