tomlplusplus/tests/conformance.cpp

2994 lines
90 KiB
C++

// This file is a part of toml++ and is subject to the the terms of the MIT license.
// Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
//-----
// this file was generated by generate_conformance_tests.py - do not modify it directly
#include "tests.h"
using namespace toml::impl;
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS // unused variable spam
namespace {
namespace valid
{
static constexpr auto burntsushi_array_empty = R"(thevoid = [[[[[]]]]])"sv;
static constexpr auto burntsushi_array_nospaces = R"(ints = [1,2,3])"sv;
static constexpr auto burntsushi_array_string_quote_comma_2 = R"(title = [ " \", ",])"sv;
static constexpr auto burntsushi_array_string_quote_comma = R"(title = [
"Client: \"XXXX\", Job: XXXX",
"Code: XXXX"
])"sv;
static constexpr auto burntsushi_array_string_with_comma = R"(title = [
"Client: XXXX, Job: XXXX",
"Code: XXXX"
])"sv;
static constexpr auto burntsushi_array_table_array_string_backslash = R"(foo = [ { bar="\"{{baz}}\""} ])"sv;
static constexpr auto burntsushi_arrays_hetergeneous = R"(mixed = [[1, 2], ["a", "b"], [1.1, 2.1]])"sv;
static constexpr auto burntsushi_arrays_nested = R"(nest = [["a"], ["b"]])"sv;
static constexpr auto burntsushi_arrays = R"(ints = [1, 2, 3]
floats = [1.1, 2.1, 3.1]
strings = ["a", "b", "c"]
dates = [
1987-07-05T17:45:00Z,
1979-05-27T07:32:00Z,
2006-06-01T11:00:00Z,
]
comments = [
1,
2, #this is ok
])"sv;
static constexpr auto burntsushi_bool = R"(t = true
f = false)"sv;
static constexpr auto burntsushi_comments_at_eof = R"(# This is a full-line comment
key = "value" # This is a comment at the end of a line)"sv;
static constexpr auto burntsushi_comments_at_eof2 = R"(# This is a full-line comment
key = "value" # This is a comment at the end of a line)"sv;
static constexpr auto burntsushi_comments_everywhere = R"(# Top comment.
# Top comment.
# Top comment.
# [no-extraneous-groups-please]
[group] # Comment
answer = 42 # Comment
# no-extraneous-keys-please = 999
# Inbetween comment.
more = [ # Comment
# What about multiple # comments?
# Can you handle it?
#
# Evil.
# Evil.
42, 42, # Comments within arrays are fun.
# What about multiple # comments?
# Can you handle it?
#
# Evil.
# Evil.
# ] Did I fool you?
] # Hopefully not.)"sv;
static constexpr auto burntsushi_datetime_timezone = R"(bestdayever = 2017-06-06T12:34:56-05:00)"sv;
static constexpr auto burntsushi_double_quote_escape = R"(test = "\"one\"")"sv;
static constexpr auto burntsushi_empty = R"()"sv;
static constexpr auto burntsushi_escaped_escape = R"(answer = "\\x64")"sv;
static constexpr auto burntsushi_example = R"(best-day-ever = 1987-07-05T17:45:00Z
[numtheory]
boring = false
perfection = [6, 28, 496])"sv;
static constexpr auto burntsushi_exponent_part_float = R"(million = 1e6
minustenth = -1E-1
beast = 6.66E2)"sv;
static constexpr auto burntsushi_float_exponent = R"(lower = 3e2
upper = 3E2
neg = 3e-2
pos = 3E+2
zero = 3e0
pointlower = 3.1e2
pointupper = 3.1E2)"sv;
static constexpr auto burntsushi_float_underscore = R"(before = 3_141.5927
after = 3141.592_7
exponent = 3e1_4)"sv;
static constexpr auto burntsushi_float = R"(pi = 3.14
pospi = +3.14
negpi = -3.14
zero-intpart = 0.123)"sv;
static constexpr auto burntsushi_implicit_and_explicit_after = R"([a.b.c]
answer = 42
[a]
better = 43)"sv;
static constexpr auto burntsushi_implicit_and_explicit_before = R"([a]
better = 43
[a.b.c]
answer = 42)"sv;
static constexpr auto burntsushi_implicit_groups = R"([a.b.c]
answer = 42)"sv;
static constexpr auto burntsushi_inline_table_array = R"(people = [{first_name = "Bruce", last_name = "Springsteen"},
{first_name = "Eric", last_name = "Clapton"},
{first_name = "Bob", last_name = "Seger"}])"sv;
static constexpr auto burntsushi_inline_table = R"(name = { first = "Tom", last = "Preston-Werner" }
point = { x = 1, y = 2 }
simple = { a = 1 }
str-key = { "a" = 1 }
table-array = [{ "a" = 1 }, { "b" = 2 }])"sv;
static constexpr auto burntsushi_integer_underscore = R"(kilo = 1_000)"sv;
static constexpr auto burntsushi_integer = R"(answer = 42
posanswer = +42
neganswer = -42
zero = 0)"sv;
static constexpr auto burntsushi_key_equals_nospace = R"(answer=42)"sv;
static constexpr auto burntsushi_key_numeric = R"(1 = 1)"sv;
static constexpr auto burntsushi_key_space = R"("a b" = 1)"sv;
static constexpr auto burntsushi_key_special_chars = R"("~!@$^&*()_+-`1234567890[]|/?><.,;:'" = 1)"sv;
static constexpr auto burntsushi_keys_with_dots = R"(plain = 1
"with.dot" = 2
[plain_table]
plain = 3
"with.dot" = 4
[table.withdot]
plain = 5
"key.with.dots" = 6)"sv;
static constexpr auto burntsushi_long_float = R"(longpi = 3.141592653589793
neglongpi = -3.141592653589793)"sv;
static constexpr auto burntsushi_long_integer = R"(answer = 9223372036854775807
neganswer = -9223372036854775808)"sv;
static constexpr auto burntsushi_multiline_string = R"(multiline_empty_one = """"""
multiline_empty_two = """
"""
multiline_empty_three = """\
"""
multiline_empty_four = """\
\
\
"""
equivalent_one = "The quick brown fox jumps over the lazy dog."
equivalent_two = """
The quick brown \
fox jumps over \
the lazy dog."""
equivalent_three = """\
The quick brown \
fox jumps over \
the lazy dog.\
""")"sv;
static constexpr auto burntsushi_nested_inline_table_array = R"(a = [ { b = {} } ])"sv;
static constexpr auto burntsushi_newline_crlf = R"(os = "DOS"
newline = "crlf")"sv;
static constexpr auto burntsushi_newline_lf = R"(os = "unix"
newline = "lf")"sv;
static constexpr auto burntsushi_raw_multiline_string = R"(oneline = '''This string has a ' quote character.'''
firstnl = '''
This string has a ' quote character.'''
multiline = '''
This string
has ' a quote character
and more than
one newline
in it.''')"sv;
static constexpr auto burntsushi_raw_string = R"(backspace = 'This string has a \b backspace character.'
tab = 'This string has a \t tab character.'
newline = 'This string has a \n new line character.'
formfeed = 'This string has a \f form feed character.'
carriage = 'This string has a \r carriage return character.'
slash = 'This string has a \/ slash character.'
backslash = 'This string has a \\ backslash character.')"sv;
static constexpr auto burntsushi_right_curly_brace_after_boolean = R"(black = { python=">3.6", version=">=18.9b0", allow_prereleases=true })"sv;
static constexpr auto burntsushi_string_empty = R"(answer = "")"sv;
static constexpr auto burntsushi_string_nl = R"(nl_mid = "val\nue"
nl_end = """value\n"""
lit_nl_end = '''value\n'''
lit_nl_mid = 'val\nue'
lit_nl_uni = 'val\ue')"sv;
static constexpr auto burntsushi_string_simple = R"(answer = "You are not drinking enough whisky.")"sv;
static constexpr auto burntsushi_string_with_pound = R"(pound = "We see no # comments here."
poundcomment = "But there are # some comments here." # Did I # mess you up?)"sv;
static constexpr auto burntsushi_table_array_implicit = R"([[albums.songs]]
name = "Glory Days")"sv;
static constexpr auto burntsushi_table_array_many = R"([[people]]
first_name = "Bruce"
last_name = "Springsteen"
[[people]]
first_name = "Eric"
last_name = "Clapton"
[[people]]
first_name = "Bob"
last_name = "Seger")"sv;
static constexpr auto burntsushi_table_array_nest = R"([[albums]]
name = "Born to Run"
[[albums.songs]]
name = "Jungleland"
[[albums.songs]]
name = "Meeting Across the River"
[[albums]]
name = "Born in the USA"
[[albums.songs]]
name = "Glory Days"
[[albums.songs]]
name = "Dancing in the Dark")"sv;
static constexpr auto burntsushi_table_array_one = R"([[people]]
first_name = "Bruce"
last_name = "Springsteen")"sv;
static constexpr auto burntsushi_table_array_table_array = R"([[a]]
[[a.b]]
[a.b.c]
d = "val0"
[[a.b]]
[a.b.c]
d = "val1")"sv;
static constexpr auto burntsushi_table_empty = R"([a])"sv;
static constexpr auto burntsushi_table_no_eol = R"([table])"sv;
static constexpr auto burntsushi_table_sub_empty = R"([a]
[a.b])"sv;
static constexpr auto burntsushi_table_whitespace = R"(["valid key"])"sv;
static constexpr auto burntsushi_table_with_literal_string = R"(['a']
[a.'"b"']
[a.'"b"'.c]
answer = 42)"sv;
static constexpr auto burntsushi_table_with_pound = R"(["key#group"]
answer = 42)"sv;
static constexpr auto burntsushi_table_with_single_quotes = R"(['a']
[a.'b']
[a.'b'.c]
answer = 42)"sv;
static constexpr auto burntsushi_underscored_float = R"(electron_mass = 9_109.109_383e-3_4)"sv;
static constexpr auto burntsushi_underscored_integer = R"(million = 1_000_000)"sv;
static constexpr auto burntsushi_unicode_escape = R"(answer4 = "\u03B4"
answer8 = "\U000003B4")"sv;
static constexpr auto burntsushi_unicode_literal = R"(answer = "δ")"sv;
static constexpr auto iarna_spec_array_1 = R"(integers = [ 1, 2, 3 ])"sv;
static constexpr auto iarna_spec_array_2 = R"(colors = [ "red", "yellow", "green" ])"sv;
static constexpr auto iarna_spec_array_3 = R"(nested_array_of_int = [ [ 1, 2 ], [3, 4, 5] ])"sv;
static constexpr auto iarna_spec_array_4 = R"(string_array = [ "all", 'strings', """are the same""", '''type'''])"sv;
static constexpr auto iarna_spec_array_5 = R"(nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ])"sv;
static constexpr auto iarna_spec_array_7 = R"(integers2 = [
1, 2, 3
])"sv;
static constexpr auto iarna_spec_array_8 = R"(integers3 = [
1,
2, # this is ok
])"sv;
static constexpr auto iarna_spec_array_mixed_number_types = R"(numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ])"sv;
static constexpr auto iarna_spec_array_more_mixed_types = R"(contributors = [
"Foo Bar <foo@example.com>",
{ name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" }
])"sv;
static constexpr auto iarna_spec_array_of_tables_1 = R"([[products]]
name = "Hammer"
sku = 738594937
[[products]]
[[products]]
name = "Nail"
sku = 284758393
color = "gray")"sv;
static constexpr auto iarna_spec_array_of_tables_2 = R"([[fruit]]
name = "apple"
[fruit.physical]
color = "red"
shape = "round"
[[fruit.variety]]
name = "red delicious"
[[fruit.variety]]
name = "granny smith"
[[fruit]]
name = "banana"
[[fruit.variety]]
name = "plantain")"sv;
static constexpr auto iarna_spec_array_of_tables_3 = R"(points = [ { x = 1, y = 2, z = 3 },
{ x = 7, y = 8, z = 9 },
{ x = 2, y = 4, z = 8 } ])"sv;
static constexpr auto iarna_spec_boolean_1 = R"(bool1 = true)"sv;
static constexpr auto iarna_spec_boolean_2 = R"(bool1 = false)"sv;
static constexpr auto iarna_spec_case_sensitive = R"(# TOML is case sensitive.
abc = 123
ABC = 456)"sv;
static constexpr auto iarna_spec_comment_mid_array = R"(# eol commetns can go anywhere
abc = [ # this is valid
123,#as is this
456 #so is this
]# and this
# here too)"sv;
static constexpr auto iarna_spec_comment_mid_string = R"(another = "# This is not a comment")"sv;
static constexpr auto iarna_spec_comment_tab = R"(# This is a full-line comment with a tab in the middle
key = "value" # This is a commen with a tab in the middle at the end of a line)"sv;
static constexpr auto iarna_spec_comment = R"(# This is a full-line comment
key = "value" # This is a comment at the end of a line)"sv;
static constexpr auto iarna_spec_date_local_1 = R"(ld1 = 1979-05-27)"sv;
static constexpr auto iarna_spec_date_time_1 = R"(odt1 = 1979-05-27T07:32:00Z)"sv;
static constexpr auto iarna_spec_date_time_2 = R"(odt2 = 1979-05-27T00:32:00-07:00)"sv;
static constexpr auto iarna_spec_date_time_3 = R"(odt3 = 1979-05-27T00:32:00.999999-07:00)"sv;
static constexpr auto iarna_spec_date_time_4 = R"(odt4 = 1979-05-27 07:32:00Z)"sv;
static constexpr auto iarna_spec_date_time_5 = R"(odt5 = 1979-05-27T07:32:00.123Z)"sv;
static constexpr auto iarna_spec_date_time_local_1 = R"(ldt1 = 1979-05-27T07:32:00)"sv;
static constexpr auto iarna_spec_dotted_keys_1 = R"(name = "Orange"
physical.color = "orange"
physical.shape = "round"
site."google.com" = true)"sv;
static constexpr auto iarna_spec_dotted_keys_2 = R"(a . b = 23)"sv;
static constexpr auto iarna_spec_dotted_keys_3 = R"(a . b = 23)"sv;
static constexpr auto iarna_spec_empty_key_name_1 = R"("" = "blank" # VALID but discouraged)"sv;
static constexpr auto iarna_spec_empty_key_name_2 = R"('' = "blank" # VALID but discouraged)"sv;
static constexpr auto iarna_spec_extend_dotted_object_1 = R"(# This makes the key "fruit" into a table.
fruit.apple.smooth = true
# So then you can add to the table "fruit" like so:
fruit.orange = 2)"sv;
static constexpr auto iarna_spec_extend_dotted_object_2 = R"(# VALID BUT DISCOURAGED
apple.type = "fruit"
orange.type = "fruit"
apple.skin = "thin"
orange.skin = "thick"
apple.color = "red"
orange.color = "orange")"sv;
static constexpr auto iarna_spec_extend_dotted_object_3 = R"(# RECOMMENDED
apple.type = "fruit"
apple.skin = "thin"
apple.color = "red"
orange.type = "fruit"
orange.skin = "thick"
orange.color = "orange")"sv;
static constexpr auto iarna_spec_float_1 = R"(flt1 = +1.0)"sv;
static constexpr auto iarna_spec_float_10 = R"(sf1 = inf # positive infinity)"sv;
static constexpr auto iarna_spec_float_11 = R"(sf2 = +inf # positive infinity)"sv;
static constexpr auto iarna_spec_float_12 = R"(sf2 = -inf # negative infinity)"sv;
static constexpr auto iarna_spec_float_13 = R"(sf4 = nan # actual sNaN/qNaN encoding is implementation specific)"sv;
static constexpr auto iarna_spec_float_14 = R"(sf5 = +nan # same as `nan`)"sv;
static constexpr auto iarna_spec_float_15 = R"(sf6 = -nan # valid, actual encoding is implementation specific)"sv;
static constexpr auto iarna_spec_float_2 = R"(flt2 = 3.1415)"sv;
static constexpr auto iarna_spec_float_3 = R"(flt3 = -0.01)"sv;
static constexpr auto iarna_spec_float_4 = R"(flt4 = 5e+22)"sv;
static constexpr auto iarna_spec_float_5 = R"(flt5 = 1e06)"sv;
static constexpr auto iarna_spec_float_6 = R"(flt6 = -2E-2)"sv;
static constexpr auto iarna_spec_float_7 = R"(flt7 = 6.626e-34)"sv;
static constexpr auto iarna_spec_float_8 = R"(flt8 = 224_617.445_991_228)"sv;
static constexpr auto iarna_spec_float_9 = R"(flt9 = -0e0)"sv;
static constexpr auto iarna_spec_int_1 = R"(int1 = +99)"sv;
static constexpr auto iarna_spec_int_2 = R"(int2 = 42)"sv;
static constexpr auto iarna_spec_int_3 = R"(int3 = 0)"sv;
static constexpr auto iarna_spec_int_3a = R"(int3 = +0)"sv;
static constexpr auto iarna_spec_int_3b = R"(int3 = -0)"sv;
static constexpr auto iarna_spec_int_4 = R"(int4 = -17)"sv;
static constexpr auto iarna_spec_int_5 = R"(int5 = 1_000)"sv;
static constexpr auto iarna_spec_int_6 = R"(int6 = 5_349_221)"sv;
static constexpr auto iarna_spec_int_7 = R"(int7 = 1_2_3_4_5 # VALID but discouraged)"sv;
static constexpr auto iarna_spec_int_bin1 = R"(bin1 = 0b11010110)"sv;
static constexpr auto iarna_spec_int_hex1 = R"(hex1 = 0xDEADBEEF)"sv;
static constexpr auto iarna_spec_int_hex2 = R"(hex2 = 0xdeadbeef)"sv;
static constexpr auto iarna_spec_int_hex3 = R"(hex3 = 0xdead_beef)"sv;
static constexpr auto iarna_spec_int_max = R"(max=9_223_372_036_854_775_807)"sv;
static constexpr auto iarna_spec_int_min = R"(min=-9_223_372_036_854_775_808)"sv;
static constexpr auto iarna_spec_int_oct1 = R"(oct1 = 0o01234567)"sv;
static constexpr auto iarna_spec_int_oct2 = R"(oct2 = 0o755 # useful for Unix file permissions)"sv;
static constexpr auto iarna_spec_key_value_pair_1 = R"(key = "value")"sv;
static constexpr auto iarna_spec_key_value_pair_2 = R"(bare_key = "value")"sv;
static constexpr auto iarna_spec_key_value_pair_3 = R"(bare-key = "value")"sv;
static constexpr auto iarna_spec_key_value_pair_4 = R"(1234 = "value")"sv;
static constexpr auto iarna_spec_key_value_pair_5 = R"(1234="value")"sv;
static constexpr auto iarna_spec_key_value_pair_6 = R"(-=1)"sv;
static constexpr auto iarna_spec_key_value_pair_7 = R"(_=1)"sv;
static constexpr auto iarna_spec_key_value_pair_8 = R"(-_-_-_-_-=1)"sv;
static constexpr auto iarna_spec_key_value_pair_9 = R"(3.14159 = "pi")"sv;
static constexpr auto iarna_spec_quoted_basic_keys_1 = R"("ʎǝʞ" = "value")"sv;
static constexpr auto iarna_spec_quoted_literal_keys_1 = R"('quoted "value"' = "value")"sv;
static constexpr auto iarna_spec_readme_example = R"(# This is a TOML document.
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00 # First class dates
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
connection_max = 5000
enabled = true
[servers]
# Indentation (tabs and/or spaces) is allowed but not required
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"
[clients]
data = [ ["gamma", "delta"], [1, 2] ]
# Line breaks are OK when inside arrays
hosts = [
"alpha",
"omega"
])"sv;
static constexpr auto iarna_spec_string_basic_multiline_1 = R"(str1 = """
Roses are red
Violets are blue""")"sv;
static constexpr auto iarna_spec_string_basic_multiline_2 = R"(str = """
The quick brown \
fox jumps over \
the lazy dog.""")"sv;
static constexpr auto iarna_spec_string_basic_multiline_3 = R"(str = """\
The quick brown \
fox jumps over \
the lazy dog.\
""")"sv;
static constexpr auto iarna_spec_string_basic_multiline_5 = R"(ml-escaped-nl = """
foo \
bar \\
baz \\\
quux""")"sv;
static constexpr auto iarna_spec_string_basic_multiline_6 = R"(str4 = """Here are two quotation marks: "". Simple enough.""")"sv;
static constexpr auto iarna_spec_string_basic_multiline_7 = R"(str5 = """Here are three quotation marks: ""\".""")"sv;
static constexpr auto iarna_spec_string_basic_multiline_8 = R"(str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\".""")"sv;
static constexpr auto iarna_spec_string_basic_multiline_9 = R"(str7 = """"This," she said, "is just a pointless statement."""")"sv;
static constexpr auto iarna_spec_string_basic_tab_multiline = R"(str = """This is a tab""")"sv;
static constexpr auto iarna_spec_string_basic_tab = R"(str = "This is a tab")"sv;
static constexpr auto iarna_spec_string_basic = R"(str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF.")"sv;
static constexpr auto iarna_spec_string_literal_1 = R"(winpath = 'C:\Users\nodejs\templates')"sv;
static constexpr auto iarna_spec_string_literal_2 = R"(winpath2 = '\\ServerX\admin$\system32\')"sv;
static constexpr auto iarna_spec_string_literal_3 = R"(quoted = 'Tom "Dubs" Preston-Werner')"sv;
static constexpr auto iarna_spec_string_literal_4 = R"(regex = '<\i\c*\s*>')"sv;
static constexpr auto iarna_spec_string_literal_multiline_1 = R"(regex2 = '''I [dw]on't need \d{2} apples''')"sv;
static constexpr auto iarna_spec_string_literal_multiline_2 = R"(lines = '''
The first newline is
trimmed in raw strings.
All other whitespace
is preserved.
''')"sv;
static constexpr auto iarna_spec_string_literal_multiline_3 = R"(quot15 = '''Here are fifteen quotation marks: """""""""""""""''')"sv;
static constexpr auto iarna_spec_string_literal_multiline_4 = R"(str = ''''That,' she said, 'is still pointless.'''')"sv;
static constexpr auto iarna_spec_table_1 = R"([table-1]
key1 = "some string"
key2 = 123
[table-2]
key1 = "another string"
key2 = 456)"sv;
static constexpr auto iarna_spec_table_2 = R"([dog."tater.man"]
type.name = "pug")"sv;
static constexpr auto iarna_spec_table_3 = R"([a.b.c])"sv;
static constexpr auto iarna_spec_table_4 = R"([ d.e.f ] # same as [d.e.f])"sv;
static constexpr auto iarna_spec_table_5 = R"([ g . h . i ] # same as [g.h.i])"sv;
static constexpr auto iarna_spec_table_6 = R"([ j . "ʞ" . 'l' ] # same as [j."ʞ".'l'])"sv;
static constexpr auto iarna_spec_table_7 = R"(# [x] you
# [x.y] don't
# [x.y.z] need these
[x.y.z.w] # for this to work
[x] # defining a super-table afterwards is ok)"sv;
static constexpr auto iarna_spec_table_8 = R"([fruit]
apple.color = "red"
apple.taste.sweet = true
[fruit.apple.texture] # you can add sub-tables
smooth = true)"sv;
static constexpr auto iarna_spec_table_inline_1 = R"(name = { first = "Tom", last = "Preston-Werner" })"sv;
static constexpr auto iarna_spec_table_inline_2 = R"(point = { x = 1, y = 2 })"sv;
static constexpr auto iarna_spec_table_inline_3 = R"(animal = { type.name = "pug" })"sv;
static constexpr auto iarna_spec_table = R"([table])"sv;
static constexpr auto iarna_spec_time_1 = R"(lt1 = 07:32:00)"sv;
}
namespace invalid
{
static constexpr auto burntsushi_datetime_malformed_no_leads = R"(no-leads = 1987-7-05T17:45:00Z)"sv;
static constexpr auto burntsushi_datetime_malformed_no_secs = R"(no-secs = 1987-07-05T17:45Z)"sv;
static constexpr auto burntsushi_datetime_malformed_no_t = R"(no-t = 1987-07-0517:45:00Z)"sv;
static constexpr auto burntsushi_datetime_malformed_with_milli = R"(with-milli = 1987-07-5T17:45:00.12Z)"sv;
static constexpr auto burntsushi_duplicate_key_table = R"([fruit]
type = "apple"
[fruit.type]
apple = "yes")"sv;
static constexpr auto burntsushi_duplicate_keys = R"(dupe = false
dupe = true)"sv;
static constexpr auto burntsushi_duplicate_tables = R"([a]
[a])"sv;
static constexpr auto burntsushi_empty_implicit_table = R"([naughty..naughty])"sv;
static constexpr auto burntsushi_empty_table = R"([])"sv;
static constexpr auto burntsushi_float_leading_zero_neg = R"(leading-zero = -03.14)"sv;
static constexpr auto burntsushi_float_leading_zero_pos = R"(leading-zero = +03.14)"sv;
static constexpr auto burntsushi_float_leading_zero = R"(leading-zero = 03.14)"sv;
static constexpr auto burntsushi_float_no_leading_zero = R"(answer = .12345
neganswer = -.12345)"sv;
static constexpr auto burntsushi_float_no_trailing_digits = R"(answer = 1.
neganswer = -1.)"sv;
static constexpr auto burntsushi_float_underscore_after_point = R"(bad = 1._2)"sv;
static constexpr auto burntsushi_float_underscore_after = R"(bad = 1.2_)"sv;
static constexpr auto burntsushi_float_underscore_before_point = R"(bad = 1_.2)"sv;
static constexpr auto burntsushi_float_underscore_before = R"(bad = _1.2)"sv;
static constexpr auto burntsushi_inline_table_linebreak = R"(simple = { a = 1
})"sv;
static constexpr auto burntsushi_integer_leading_zero_neg = R"(leading-zero = -012)"sv;
static constexpr auto burntsushi_integer_leading_zero_pos = R"(leading-zero = +012)"sv;
static constexpr auto burntsushi_integer_leading_zero = R"(leading-zero = 012)"sv;
static constexpr auto burntsushi_integer_underscore_after = R"(bad = 123_)"sv;
static constexpr auto burntsushi_integer_underscore_before = R"(bad = _123)"sv;
static constexpr auto burntsushi_integer_underscore_double = R"(bad = 1__23)"sv;
static constexpr auto burntsushi_key_after_array = R"([[agencies]] owner = "S Cjelli")"sv;
static constexpr auto burntsushi_key_after_table = R"([error] this = "should not be here")"sv;
static constexpr auto burntsushi_key_empty = R"(= 1)"sv;
static constexpr auto burntsushi_key_hash = R"(a# = 1)"sv;
static constexpr auto burntsushi_key_newline = R"(a
= 1)"sv;
static constexpr auto burntsushi_key_no_eol = R"(a = 1 b = 2)"sv;
static constexpr auto burntsushi_key_open_bracket = R"([abc = 1)"sv;
static constexpr auto burntsushi_key_single_open_bracket = R"([)"sv;
static constexpr auto burntsushi_key_space = R"(a b = 1)"sv;
static constexpr auto burntsushi_key_start_bracket = R"([a]
[xyz = 5
[b])"sv;
static constexpr auto burntsushi_key_two_equals = R"(key= = 1)"sv;
static constexpr auto burntsushi_llbrace = R"([ [table]])"sv;
static constexpr auto burntsushi_multi_line_inline_table = R"(json_like = {
first = "Tom",
last = "Preston-Werner"
})"sv;
static constexpr auto burntsushi_multi_line_string_no_close = R"(invalid = """
this will fail)"sv;
static constexpr auto burntsushi_rrbrace = R"([[table] ])"sv;
static constexpr auto burntsushi_string_bad_byte_escape = R"(naughty = "\xAg")"sv;
static constexpr auto burntsushi_string_bad_codepoint = R"(invalid-codepoint = "This string contains a non scalar unicode codepoint \uD801")"sv;
static constexpr auto burntsushi_string_bad_escape = R"(invalid-escape = "This string has a bad \a escape character.")"sv;
static constexpr auto burntsushi_string_bad_slash_escape = R"(invalid-escape = "This string has a bad \/ escape character.")"sv;
static constexpr auto burntsushi_string_bad_uni_esc = R"(str = "val\ue")"sv;
static constexpr auto burntsushi_string_byte_escapes = R"(answer = "\x33")"sv;
static constexpr auto burntsushi_string_no_close = R"(no-ending-quote = "One time, at band camp)"sv;
static constexpr auto burntsushi_table_array_implicit = R"(# This test is a bit tricky. It should fail because the first use of
# `[[albums.songs]]` without first declaring `albums` implies that `albums`
# must be a table. The alternative would be quite weird. Namely, it wouldn't
# comply with the TOML spec: "Each double-bracketed sub-table will belong to
# the most *recently* defined table element *above* it."
#
# This is in contrast to the *valid* test, table-array-implicit where
# `[[albums.songs]]` works by itself, so long as `[[albums]]` isn't declared
# later. (Although, `[albums]` could be.)
[[albums.songs]]
name = "Glory Days"
[[albums]]
name = "Born in the USA")"sv;
static constexpr auto burntsushi_table_array_malformed_bracket = R"([[albums]
name = "Born to Run")"sv;
static constexpr auto burntsushi_table_array_malformed_empty = R"([[]]
name = "Born to Run")"sv;
static constexpr auto burntsushi_table_empty = R"([])"sv;
static constexpr auto burntsushi_table_nested_brackets_close = R"([a]b]
zyx = 42)"sv;
static constexpr auto burntsushi_table_nested_brackets_open = R"([a[b]
zyx = 42)"sv;
static constexpr auto burntsushi_table_whitespace = R"([invalid key])"sv;
static constexpr auto burntsushi_table_with_pound = R"([key#group]
answer = 42)"sv;
static constexpr auto burntsushi_text_after_array_entries = R"(array = [
"Is there life after an array separator?", No
"Entry"
])"sv;
static constexpr auto burntsushi_text_after_integer = R"(answer = 42 the ultimate answer?)"sv;
static constexpr auto burntsushi_text_after_string = R"(string = "Is there life after strings?" No.)"sv;
static constexpr auto burntsushi_text_after_table = R"([error] this shouldn't be here)"sv;
static constexpr auto burntsushi_text_before_array_separator = R"(array = [
"Is there life before an array separator?" No,
"Entry"
])"sv;
static constexpr auto burntsushi_text_in_array = R"(array = [
"Entry 1",
I don't belong,
"Entry 2",
])"sv;
static constexpr auto iarna_array_of_tables_1 = R"(# INVALID TOML DOC
fruit = []
[[fruit]] # Not allowed)"sv;
static constexpr auto iarna_array_of_tables_2 = R"(# INVALID TOML DOC
[[fruit]]
name = "apple"
[[fruit.variety]]
name = "red delicious"
# This table conflicts with the previous table
[fruit.variety]
name = "granny smith")"sv;
static constexpr auto iarna_bare_key_1 = R"(bare!key = 123)"sv;
static constexpr auto iarna_bare_key_2 = R"(barekey
= 123)"sv;
static constexpr auto iarna_bare_key_3 = R"(barekey =)"sv;
static constexpr auto iarna_inline_table_imutable_1 = R"([product]
type = { name = "Nail" }
type.edible = false # INVALID)"sv;
static constexpr auto iarna_inline_table_imutable_2 = R"([product]
type.name = "Nail"
type = { edible = false } # INVALID)"sv;
static constexpr auto iarna_inline_table_trailing_comma = R"(abc = { abc = 123, })"sv;
static constexpr auto iarna_int_0_padded = R"(int = 0123)"sv;
static constexpr auto iarna_int_signed_bin = R"(bin = +0b10)"sv;
static constexpr auto iarna_int_signed_hex = R"(hex = +0xab)"sv;
static constexpr auto iarna_int_signed_oct = R"(oct = +0o23)"sv;
static constexpr auto iarna_key_value_pair_1 = R"(key = # INVALID)"sv;
static constexpr auto iarna_key_value_pair_2 = R"(first = "Tom" last = "Preston-Werner" # INVALID)"sv;
static constexpr auto iarna_multiple_dot_key = R"(# THE FOLLOWING IS INVALID
# This defines the value of fruit.apple to be an integer.
fruit.apple = 1
# But then this treats fruit.apple like it's a table.
# You can't turn an integer into a table.
fruit.apple.smooth = true)"sv;
static constexpr auto iarna_multiple_key = R"(# DO NOT DO THIS
name = "Tom"
name = "Pradyun")"sv;
static constexpr auto iarna_no_key_name = R"(= "no key name" # INVALID)"sv;
static constexpr auto iarna_string_basic_multiline_invalid_backslash = R"(a = """
foo \ \n
bar""")"sv;
static constexpr auto iarna_string_basic_multiline_out_of_range_unicode_escape_1 = R"(a = """\UFFFFFFFF""")"sv;
static constexpr auto iarna_string_basic_multiline_out_of_range_unicode_escape_2 = R"(a = """\U00D80000""")"sv;
static constexpr auto iarna_string_basic_multiline_quotes = R"(str5 = """Here are three quotation marks: """.""")"sv;
static constexpr auto iarna_string_basic_multiline_unknown_escape = R"(a = """\@""")"sv;
static constexpr auto iarna_string_basic_out_of_range_unicode_escape_1 = R"(a = "\UFFFFFFFF")"sv;
static constexpr auto iarna_string_basic_out_of_range_unicode_escape_2 = R"(a = "\U00D80000")"sv;
static constexpr auto iarna_string_basic_unknown_escape = R"(a = "\@")"sv;
static constexpr auto iarna_string_literal_multiline_quotes = R"(apos15 = '''Here are fifteen apostrophes: '''''''''''''''''' # INVALID)"sv;
static constexpr auto iarna_table_1 = R"(# DO NOT DO THIS
[fruit]
apple = "red"
[fruit]
orange = "orange")"sv;
static constexpr auto iarna_table_2 = R"(# DO NOT DO THIS EITHER
[fruit]
apple = "red"
[fruit.apple]
texture = "smooth")"sv;
static constexpr auto iarna_table_3 = R"([fruit]
apple.color = "red"
apple.taste.sweet = true
[fruit.apple] # INVALID)"sv;
static constexpr auto iarna_table_4 = R"([fruit]
apple.color = "red"
apple.taste.sweet = true
[fruit.apple.taste] # INVALID)"sv;
static constexpr auto iarna_table_invalid_1 = R"([fruit.physical] # subtable, but to which parent element should it belong?
color = "red"
shape = "round"
[[fruit]] # parser must throw an error upon discovering that "fruit" is
# an array rather than a table
name = "apple")"sv;
static constexpr auto iarna_table_invalid_2 = R"(# INVALID TOML DOC
fruit = []
[[fruit]] # Not allowed)"sv;
static constexpr auto iarna_table_invalid_3 = R"(# INVALID TOML DOC
[[fruit]]
name = "apple"
[[fruit.variety]]
name = "red delicious"
# INVALID: This table conflicts with the previous array of tables
[fruit.variety]
name = "granny smith"
[fruit.physical]
color = "red"
shape = "round")"sv;
static constexpr auto iarna_table_invalid_4 = R"(# INVALID TOML DOC
[[fruit]]
name = "apple"
[[fruit.variety]]
name = "red delicious"
[fruit.physical]
color = "red"
shape = "round"
# INVALID: This array of tables conflicts with the previous table
[[fruit.physical]]
color = "green")"sv;
}
}
TOML_POP_WARNINGS
TEST_CASE("conformance")
{
//------------------ valid inputs --------------------------------------------------------------------------------
#if 1
{
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_array_empty, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(thevoid)"sv), toml::array{
toml::inserter{toml::array{
toml::inserter{toml::array{
toml::inserter{toml::array{
toml::inserter{toml::array{}},
}},
}},
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_array_nospaces, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(ints)"sv), toml::array{
1,
2,
3,
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_array_string_quote_comma_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(title)"sv), toml::array{
S(R"( ", )"sv),
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_array_string_quote_comma, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(title)"sv), toml::array{
S(R"(Client: "XXXX", Job: XXXX)"sv),
S(R"(Code: XXXX)"sv),
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_array_string_with_comma, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(title)"sv), toml::array{
S(R"(Client: XXXX, Job: XXXX)"sv),
S(R"(Code: XXXX)"sv),
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_array_table_array_string_backslash, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(foo)"sv), toml::array{
toml::table{{
{ S(R"(bar)"sv), S(R"("{{baz}}")"sv) },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_arrays_hetergeneous, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(mixed)"sv), toml::array{
toml::array{
1,
2,
},
toml::array{
S(R"(a)"sv),
S(R"(b)"sv),
},
toml::array{
1.1,
2.1,
},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_arrays_nested, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(nest)"sv), toml::array{
toml::array{
S(R"(a)"sv),
},
toml::array{
S(R"(b)"sv),
},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_arrays, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(ints)"sv), toml::array{
1,
2,
3,
}
},
{
S(R"(floats)"sv), toml::array{
1.1,
2.1,
3.1,
}
},
{
S(R"(strings)"sv), toml::array{
S(R"(a)"sv),
S(R"(b)"sv),
S(R"(c)"sv),
}
},
{
S(R"(dates)"sv), toml::array{
toml::date_time{ { 1987, 7, 5 }, { 17, 45, 0, 0u }, { 0, 0 } },
toml::date_time{ { 1979, 5, 27 }, { 7, 32, 0, 0u }, { 0, 0 } },
toml::date_time{ { 2006, 6, 1 }, { 11, 0, 0, 0u }, { 0, 0 } },
}
},
{
S(R"(comments)"sv), toml::array{
1,
2,
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_bool, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(f)"sv), false },
{ S(R"(t)"sv), true },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_comments_at_eof, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(key)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_comments_at_eof2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(key)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_comments_everywhere, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(group)"sv), toml::table{{
{ S(R"(answer)"sv), 42 },
{
S(R"(more)"sv), toml::array{
42,
42,
}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_datetime_timezone, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(bestdayever)"sv), toml::date_time{ { 2017, 6, 6 }, { 12, 34, 56, 0u }, { -5, 0 } } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_double_quote_escape, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(test)"sv), S(R"("one")"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_empty, [](toml::table&& tbl)
{
auto expected = toml::table{};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_escaped_escape, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer)"sv), S(R"(\x64)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_example, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(best-day-ever)"sv), toml::date_time{ { 1987, 7, 5 }, { 17, 45, 0, 0u }, { 0, 0 } } },
{
S(R"(numtheory)"sv), toml::table{{
{ S(R"(boring)"sv), false },
{
S(R"(perfection)"sv), toml::array{
6,
28,
496,
}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_exponent_part_float, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(million)"sv), 1000000.0 },
{ S(R"(minustenth)"sv), -0.1 },
{ S(R"(beast)"sv), 666.0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_float_exponent, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(lower)"sv), 300.0 },
{ S(R"(upper)"sv), 300.0 },
{ S(R"(neg)"sv), 0.03 },
{ S(R"(pos)"sv), 300.0 },
{ S(R"(zero)"sv), 3.0 },
{ S(R"(pointlower)"sv), 310.0 },
{ S(R"(pointupper)"sv), 310.0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_float_underscore, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(before)"sv), 3141.5927 },
{ S(R"(after)"sv), 3141.5927 },
{ S(R"(exponent)"sv), 300000000000000.0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_float, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(pi)"sv), 3.14 },
{ S(R"(pospi)"sv), 3.14 },
{ S(R"(negpi)"sv), -3.14 },
{ S(R"(zero-intpart)"sv), 0.123 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_implicit_and_explicit_after, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{ S(R"(better)"sv), 43 },
{
S(R"(b)"sv), toml::table{{
{
S(R"(c)"sv), toml::table{{
{ S(R"(answer)"sv), 42 },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_implicit_and_explicit_before, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{ S(R"(better)"sv), 43 },
{
S(R"(b)"sv), toml::table{{
{
S(R"(c)"sv), toml::table{{
{ S(R"(answer)"sv), 42 },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_implicit_groups, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{
S(R"(b)"sv), toml::table{{
{
S(R"(c)"sv), toml::table{{
{ S(R"(answer)"sv), 42 },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_inline_table_array, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(people)"sv), toml::array{
toml::table{{
{ S(R"(first_name)"sv), S(R"(Bruce)"sv) },
{ S(R"(last_name)"sv), S(R"(Springsteen)"sv) },
}},
toml::table{{
{ S(R"(first_name)"sv), S(R"(Eric)"sv) },
{ S(R"(last_name)"sv), S(R"(Clapton)"sv) },
}},
toml::table{{
{ S(R"(first_name)"sv), S(R"(Bob)"sv) },
{ S(R"(last_name)"sv), S(R"(Seger)"sv) },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_inline_table, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(name)"sv), toml::table{{
{ S(R"(first)"sv), S(R"(Tom)"sv) },
{ S(R"(last)"sv), S(R"(Preston-Werner)"sv) },
}}
},
{
S(R"(point)"sv), toml::table{{
{ S(R"(x)"sv), 1 },
{ S(R"(y)"sv), 2 },
}}
},
{
S(R"(simple)"sv), toml::table{{
{ S(R"(a)"sv), 1 },
}}
},
{
S(R"(str-key)"sv), toml::table{{
{ S(R"(a)"sv), 1 },
}}
},
{
S(R"(table-array)"sv), toml::array{
toml::table{{
{ S(R"(a)"sv), 1 },
}},
toml::table{{
{ S(R"(b)"sv), 2 },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_integer_underscore, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(kilo)"sv), 1000 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_integer, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer)"sv), 42 },
{ S(R"(neganswer)"sv), -42 },
{ S(R"(posanswer)"sv), 42 },
{ S(R"(zero)"sv), 0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_key_equals_nospace, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer)"sv), 42 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_key_numeric, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(1)"sv), 1 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_key_space, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(a b)"sv), 1 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_key_special_chars, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(~!@$^&*()_+-`1234567890[]|/?><.,;:')"sv), 1 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_keys_with_dots, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(plain)"sv), 1 },
{ S(R"(with.dot)"sv), 2 },
{
S(R"(plain_table)"sv), toml::table{{
{ S(R"(plain)"sv), 3 },
{ S(R"(with.dot)"sv), 4 },
}}
},
{
S(R"(table)"sv), toml::table{{
{
S(R"(withdot)"sv), toml::table{{
{ S(R"(plain)"sv), 5 },
{ S(R"(key.with.dots)"sv), 6 },
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_long_float, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(longpi)"sv), 3.141592653589793 },
{ S(R"(neglongpi)"sv), -3.141592653589793 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_long_integer, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer)"sv), INT64_MAX },
{ S(R"(neganswer)"sv), INT64_MIN },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_multiline_string, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(multiline_empty_one)"sv), S(R"()"sv) },
{ S(R"(multiline_empty_two)"sv), S(R"()"sv) },
{ S(R"(multiline_empty_three)"sv), S(R"()"sv) },
{ S(R"(multiline_empty_four)"sv), S(R"()"sv) },
{ S(R"(equivalent_one)"sv), S(R"(The quick brown fox jumps over the lazy dog.)"sv) },
{ S(R"(equivalent_two)"sv), S(R"(The quick brown fox jumps over the lazy dog.)"sv) },
{ S(R"(equivalent_three)"sv), S(R"(The quick brown fox jumps over the lazy dog.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_nested_inline_table_array, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::array{
toml::table{{
{ S(R"(b)"sv), toml::table{} },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_newline_crlf, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(os)"sv), S(R"(DOS)"sv) },
{ S(R"(newline)"sv), S(R"(crlf)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_newline_lf, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(os)"sv), S(R"(unix)"sv) },
{ S(R"(newline)"sv), S(R"(lf)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_raw_multiline_string, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(oneline)"sv), S(R"(This string has a ' quote character.)"sv) },
{ S(R"(firstnl)"sv), S(R"(This string has a ' quote character.)"sv) },
{ S(R"(multiline)"sv), S(R"(This string
has ' a quote character
and more than
one newline
in it.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_raw_string, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(backspace)"sv), S(R"(This string has a \b backspace character.)"sv) },
{ S(R"(tab)"sv), S(R"(This string has a \t tab character.)"sv) },
{ S(R"(newline)"sv), S(R"(This string has a \n new line character.)"sv) },
{ S(R"(formfeed)"sv), S(R"(This string has a \f form feed character.)"sv) },
{ S(R"(carriage)"sv), S(R"(This string has a \r carriage return character.)"sv) },
{ S(R"(slash)"sv), S(R"(This string has a \/ slash character.)"sv) },
{ S(R"(backslash)"sv), S(R"(This string has a \\ backslash character.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_right_curly_brace_after_boolean, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(black)"sv), toml::table{{
{ S(R"(allow_prereleases)"sv), true },
{ S(R"(python)"sv), S(R"(>3.6)"sv) },
{ S(R"(version)"sv), S(R"(>=18.9b0)"sv) },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_string_empty, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer)"sv), S(R"()"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_string_nl, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(nl_mid)"sv), S(R"(val
ue)"sv) },
{ S(R"(nl_end)"sv), S(R"(value
)"sv) },
{ S(R"(lit_nl_end)"sv), S(R"(value\n)"sv) },
{ S(R"(lit_nl_mid)"sv), S(R"(val\nue)"sv) },
{ S(R"(lit_nl_uni)"sv), S(R"(val\ue)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_string_simple, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer)"sv), S(R"(You are not drinking enough whisky.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_string_with_pound, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(pound)"sv), S(R"(We see no # comments here.)"sv) },
{ S(R"(poundcomment)"sv), S(R"(But there are # some comments here.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_array_implicit, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(albums)"sv), toml::table{{
{
S(R"(songs)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(Glory Days)"sv) },
}},
}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_array_many, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(people)"sv), toml::array{
toml::table{{
{ S(R"(first_name)"sv), S(R"(Bruce)"sv) },
{ S(R"(last_name)"sv), S(R"(Springsteen)"sv) },
}},
toml::table{{
{ S(R"(first_name)"sv), S(R"(Eric)"sv) },
{ S(R"(last_name)"sv), S(R"(Clapton)"sv) },
}},
toml::table{{
{ S(R"(first_name)"sv), S(R"(Bob)"sv) },
{ S(R"(last_name)"sv), S(R"(Seger)"sv) },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_array_nest, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(albums)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(Born to Run)"sv) },
{
S(R"(songs)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(Jungleland)"sv) },
}},
toml::table{{
{ S(R"(name)"sv), S(R"(Meeting Across the River)"sv) },
}},
}
},
}},
toml::table{{
{ S(R"(name)"sv), S(R"(Born in the USA)"sv) },
{
S(R"(songs)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(Glory Days)"sv) },
}},
toml::table{{
{ S(R"(name)"sv), S(R"(Dancing in the Dark)"sv) },
}},
}
},
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_array_one, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(people)"sv), toml::array{
toml::table{{
{ S(R"(first_name)"sv), S(R"(Bruce)"sv) },
{ S(R"(last_name)"sv), S(R"(Springsteen)"sv) },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_array_table_array, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::array{
toml::table{{
{
S(R"(b)"sv), toml::array{
toml::table{{
{
S(R"(c)"sv), toml::table{{
{ S(R"(d)"sv), S(R"(val0)"sv) },
}}
},
}},
toml::table{{
{
S(R"(c)"sv), toml::table{{
{ S(R"(d)"sv), S(R"(val1)"sv) },
}}
},
}},
}
},
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_empty, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(a)"sv), toml::table{} },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_no_eol, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(table)"sv), toml::table{} },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_sub_empty, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{ S(R"(b)"sv), toml::table{} },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_whitespace, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(valid key)"sv), toml::table{} },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_with_literal_string, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{
S(R"("b")"sv), toml::table{{
{
S(R"(c)"sv), toml::table{{
{ S(R"(answer)"sv), 42 },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_with_pound, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(key#group)"sv), toml::table{{
{ S(R"(answer)"sv), 42 },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_table_with_single_quotes, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{
S(R"(b)"sv), toml::table{{
{
S(R"(c)"sv), toml::table{{
{ S(R"(answer)"sv), 42 },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_underscored_float, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(electron_mass)"sv), 9.109109383e-31 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_underscored_integer, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(million)"sv), 1000000 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_unicode_escape, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer4)"sv), S(R"(δ)"sv) },
{ S(R"(answer8)"sv), S(R"(δ)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::burntsushi_unicode_literal, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(answer)"sv), S(R"(δ)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(integers)"sv), toml::array{
1,
2,
3,
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(colors)"sv), toml::array{
S(R"(red)"sv),
S(R"(yellow)"sv),
S(R"(green)"sv),
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(nested_array_of_int)"sv), toml::array{
toml::array{
1,
2,
},
toml::array{
3,
4,
5,
},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(string_array)"sv), toml::array{
S(R"(all)"sv),
S(R"(strings)"sv),
S(R"(are the same)"sv),
S(R"(type)"sv),
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_5, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(nested_mixed_array)"sv), toml::array{
toml::array{
1,
2,
},
toml::array{
S(R"(a)"sv),
S(R"(b)"sv),
S(R"(c)"sv),
},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_7, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(integers2)"sv), toml::array{
1,
2,
3,
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_8, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(integers3)"sv), toml::array{
1,
2,
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_mixed_number_types, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(numbers)"sv), toml::array{
0.1,
0.2,
0.5,
1,
2,
5,
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_more_mixed_types, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(contributors)"sv), toml::array{
S(R"(Foo Bar <foo@example.com>)"sv),
toml::table{{
{ S(R"(name)"sv), S(R"(Baz Qux)"sv) },
{ S(R"(email)"sv), S(R"(bazqux@example.com)"sv) },
{ S(R"(url)"sv), S(R"(https://example.com/bazqux)"sv) },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_of_tables_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(products)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(Hammer)"sv) },
{ S(R"(sku)"sv), 738594937 },
}},
toml::table{},
toml::table{{
{ S(R"(name)"sv), S(R"(Nail)"sv) },
{ S(R"(sku)"sv), 284758393 },
{ S(R"(color)"sv), S(R"(gray)"sv) },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_of_tables_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(fruit)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(apple)"sv) },
{
S(R"(physical)"sv), toml::table{{
{ S(R"(color)"sv), S(R"(red)"sv) },
{ S(R"(shape)"sv), S(R"(round)"sv) },
}}
},
{
S(R"(variety)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(red delicious)"sv) },
}},
toml::table{{
{ S(R"(name)"sv), S(R"(granny smith)"sv) },
}},
}
},
}},
toml::table{{
{ S(R"(name)"sv), S(R"(banana)"sv) },
{
S(R"(variety)"sv), toml::array{
toml::table{{
{ S(R"(name)"sv), S(R"(plantain)"sv) },
}},
}
},
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_array_of_tables_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(points)"sv), toml::array{
toml::table{{
{ S(R"(x)"sv), 1 },
{ S(R"(y)"sv), 2 },
{ S(R"(z)"sv), 3 },
}},
toml::table{{
{ S(R"(x)"sv), 7 },
{ S(R"(y)"sv), 8 },
{ S(R"(z)"sv), 9 },
}},
toml::table{{
{ S(R"(x)"sv), 2 },
{ S(R"(y)"sv), 4 },
{ S(R"(z)"sv), 8 },
}},
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_boolean_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(bool1)"sv), true },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_boolean_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(bool1)"sv), false },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_case_sensitive, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(abc)"sv), 123 },
{ S(R"(ABC)"sv), 456 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_comment_mid_array, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(abc)"sv), toml::array{
123,
456,
}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_comment_mid_string, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(another)"sv), S(R"(# This is not a comment)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_comment_tab, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(key)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_comment, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(key)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_date_local_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(ld1)"sv), toml::date{ 1979, 5, 27 } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_date_time_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(odt1)"sv), toml::date_time{ { 1979, 5, 27 }, { 7, 32, 0, 0u }, { 0, 0 } } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_date_time_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(odt2)"sv), toml::date_time{ { 1979, 5, 27 }, { 0, 32, 0, 0u }, { -7, 0 } } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_date_time_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(odt3)"sv), toml::date_time{ { 1979, 5, 27 }, { 0, 32, 0, 999999000u }, { -7, 0 } } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_date_time_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(odt4)"sv), toml::date_time{ { 1979, 5, 27 }, { 7, 32, 0, 0u }, { 0, 0 } } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_date_time_5, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(odt5)"sv), toml::date_time{ { 1979, 5, 27 }, { 7, 32, 0, 123000000u }, { 0, 0 } } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_date_time_local_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(ldt1)"sv), toml::date_time{ { 1979, 5, 27 }, { 7, 32, 0, 0u } } },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_dotted_keys_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(name)"sv), S(R"(Orange)"sv) },
{
S(R"(physical)"sv), toml::table{{
{ S(R"(color)"sv), S(R"(orange)"sv) },
{ S(R"(shape)"sv), S(R"(round)"sv) },
}}
},
{
S(R"(site)"sv), toml::table{{
{ S(R"(google.com)"sv), true },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_dotted_keys_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{ S(R"(b)"sv), 23 },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_dotted_keys_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{ S(R"(b)"sv), 23 },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_empty_key_name_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"()"sv), S(R"(blank)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_empty_key_name_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"()"sv), S(R"(blank)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_extend_dotted_object_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(fruit)"sv), toml::table{{
{
S(R"(apple)"sv), toml::table{{
{ S(R"(smooth)"sv), true },
}}
},
{ S(R"(orange)"sv), 2 },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_extend_dotted_object_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(apple)"sv), toml::table{{
{ S(R"(type)"sv), S(R"(fruit)"sv) },
{ S(R"(skin)"sv), S(R"(thin)"sv) },
{ S(R"(color)"sv), S(R"(red)"sv) },
}}
},
{
S(R"(orange)"sv), toml::table{{
{ S(R"(type)"sv), S(R"(fruit)"sv) },
{ S(R"(skin)"sv), S(R"(thick)"sv) },
{ S(R"(color)"sv), S(R"(orange)"sv) },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_extend_dotted_object_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(apple)"sv), toml::table{{
{ S(R"(type)"sv), S(R"(fruit)"sv) },
{ S(R"(skin)"sv), S(R"(thin)"sv) },
{ S(R"(color)"sv), S(R"(red)"sv) },
}}
},
{
S(R"(orange)"sv), toml::table{{
{ S(R"(type)"sv), S(R"(fruit)"sv) },
{ S(R"(skin)"sv), S(R"(thick)"sv) },
{ S(R"(color)"sv), S(R"(orange)"sv) },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt1)"sv), 1.0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_10, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(sf1)"sv), std::numeric_limits<double>::infinity() },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_11, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(sf2)"sv), std::numeric_limits<double>::infinity() },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_12, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(sf2)"sv), -std::numeric_limits<double>::infinity() },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_13, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(sf4)"sv), std::numeric_limits<double>::quiet_NaN() },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_14, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(sf5)"sv), std::numeric_limits<double>::quiet_NaN() },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_15, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(sf6)"sv), std::numeric_limits<double>::quiet_NaN() },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt2)"sv), 3.1415 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt3)"sv), -0.01 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt4)"sv), 5e+22 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_5, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt5)"sv), 1000000.0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_6, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt6)"sv), -0.02 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_7, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt7)"sv), 6.626e-34 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_8, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt8)"sv), 224617.445991228 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_float_9, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(flt9)"sv), -0.0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int1)"sv), 99 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int2)"sv), 42 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int3)"sv), 0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_3a, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int3)"sv), 0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_3b, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int3)"sv), 0 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int4)"sv), -17 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_5, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int5)"sv), 1000 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_6, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int6)"sv), 5349221 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_7, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(int7)"sv), 12345 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_bin1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(bin1)"sv), 214 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_hex1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(hex1)"sv), 3735928559 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_hex2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(hex2)"sv), 3735928559 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_hex3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(hex3)"sv), 3735928559 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_max, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(max)"sv), INT64_MAX },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_min, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(min)"sv), INT64_MIN },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_oct1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(oct1)"sv), 342391 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_int_oct2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(oct2)"sv), 493 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(key)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(bare_key)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(bare-key)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(1234)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_5, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(1234)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_6, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(-)"sv), 1 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_7, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(_)"sv), 1 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_8, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(-_-_-_-_-)"sv), 1 },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_key_value_pair_9, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(3)"sv), toml::table{{
{ S(R"(14159)"sv), S(R"(pi)"sv) },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_quoted_basic_keys_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(ʎǝʞ)"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_quoted_literal_keys_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(quoted "value")"sv), S(R"(value)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_readme_example, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(title)"sv), S(R"(TOML Example)"sv) },
{
S(R"(owner)"sv), toml::table{{
{ S(R"(name)"sv), S(R"(Tom Preston-Werner)"sv) },
{ S(R"(dob)"sv), toml::date_time{ { 1979, 5, 27 }, { 7, 32, 0, 0u }, { -8, 0 } } },
}}
},
{
S(R"(database)"sv), toml::table{{
{ S(R"(server)"sv), S(R"(192.168.1.1)"sv) },
{
S(R"(ports)"sv), toml::array{
8001,
8001,
8002,
}
},
{ S(R"(connection_max)"sv), 5000 },
{ S(R"(enabled)"sv), true },
}}
},
{
S(R"(servers)"sv), toml::table{{
{
S(R"(alpha)"sv), toml::table{{
{ S(R"(ip)"sv), S(R"(10.0.0.1)"sv) },
{ S(R"(dc)"sv), S(R"(eqdc10)"sv) },
}}
},
{
S(R"(beta)"sv), toml::table{{
{ S(R"(ip)"sv), S(R"(10.0.0.2)"sv) },
{ S(R"(dc)"sv), S(R"(eqdc10)"sv) },
}}
},
}}
},
{
S(R"(clients)"sv), toml::table{{
{
S(R"(data)"sv), toml::array{
toml::array{
S(R"(gamma)"sv),
S(R"(delta)"sv),
},
toml::array{
1,
2,
},
}
},
{
S(R"(hosts)"sv), toml::array{
S(R"(alpha)"sv),
S(R"(omega)"sv),
}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str1)"sv), S(R"(Roses are red
Violets are blue)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str)"sv), S(R"(The quick brown fox jumps over the lazy dog.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str)"sv), S(R"(The quick brown fox jumps over the lazy dog.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_5, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(ml-escaped-nl)"sv), S(R"( foo bar \
baz \quux)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_6, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str4)"sv), S(R"(Here are two quotation marks: "". Simple enough.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_7, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str5)"sv), S(R"(Here are three quotation marks: """.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_8, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str6)"sv), S(R"(Here are fifteen quotation marks: """"""""""""""".)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_multiline_9, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str7)"sv), S(R"("This," she said, "is just a pointless statement.")"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_tab_multiline, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str)"sv), S(R"(This is a tab)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic_tab, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str)"sv), S(R"(This is a tab)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_basic, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str)"sv), S(R"(I'm a string. "You can quote me". Name José
Location SF.)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(winpath)"sv), S(R"(C:\Users\nodejs\templates)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(winpath2)"sv), S(R"(\\ServerX\admin$\system32\)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(quoted)"sv), S(R"(Tom "Dubs" Preston-Werner)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(regex)"sv), S(R"(<\i\c*\s*>)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_multiline_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(regex2)"sv), S(R"(I [dw]on't need \d{2} apples)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_multiline_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(lines)"sv), S(R"(The first newline is
trimmed in raw strings.
All other whitespace
is preserved.
)"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_multiline_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(quot15)"sv), S(R"(Here are fifteen quotation marks: """"""""""""""")"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_string_literal_multiline_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(str)"sv), S(R"('That,' she said, 'is still pointless.')"sv) },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(table-1)"sv), toml::table{{
{ S(R"(key1)"sv), S(R"(some string)"sv) },
{ S(R"(key2)"sv), 123 },
}}
},
{
S(R"(table-2)"sv), toml::table{{
{ S(R"(key1)"sv), S(R"(another string)"sv) },
{ S(R"(key2)"sv), 456 },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(dog)"sv), toml::table{{
{
S(R"(tater.man)"sv), toml::table{{
{
S(R"(type)"sv), toml::table{{
{ S(R"(name)"sv), S(R"(pug)"sv) },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(a)"sv), toml::table{{
{
S(R"(b)"sv), toml::table{{
{ S(R"(c)"sv), toml::table{} },
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_4, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(d)"sv), toml::table{{
{
S(R"(e)"sv), toml::table{{
{ S(R"(f)"sv), toml::table{} },
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_5, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(g)"sv), toml::table{{
{
S(R"(h)"sv), toml::table{{
{ S(R"(i)"sv), toml::table{} },
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_6, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(j)"sv), toml::table{{
{
S(R"(ʞ)"sv), toml::table{{
{ S(R"(l)"sv), toml::table{} },
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_7, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(x)"sv), toml::table{{
{
S(R"(y)"sv), toml::table{{
{
S(R"(z)"sv), toml::table{{
{ S(R"(w)"sv), toml::table{} },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_8, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(fruit)"sv), toml::table{{
{
S(R"(apple)"sv), toml::table{{
{ S(R"(color)"sv), S(R"(red)"sv) },
{
S(R"(taste)"sv), toml::table{{
{ S(R"(sweet)"sv), true },
}}
},
{
S(R"(texture)"sv), toml::table{{
{ S(R"(smooth)"sv), true },
}}
},
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_inline_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(name)"sv), toml::table{{
{ S(R"(first)"sv), S(R"(Tom)"sv) },
{ S(R"(last)"sv), S(R"(Preston-Werner)"sv) },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_inline_2, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(point)"sv), toml::table{{
{ S(R"(x)"sv), 1 },
{ S(R"(y)"sv), 2 },
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table_inline_3, [](toml::table&& tbl)
{
auto expected = toml::table{{
{
S(R"(animal)"sv), toml::table{{
{
S(R"(type)"sv), toml::table{{
{ S(R"(name)"sv), S(R"(pug)"sv) },
}}
},
}}
},
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_table, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(table)"sv), toml::table{} },
}};
REQUIRE(tbl == expected);
});
parsing_should_succeed(FILE_LINE_ARGS, valid::iarna_spec_time_1, [](toml::table&& tbl)
{
auto expected = toml::table{{
{ S(R"(lt1)"sv), toml::time{ 7, 32, 0, 0 } },
}};
REQUIRE(tbl == expected);
});
#if !TOML_LANG_UNRELEASED
#endif // !TOML_LANG_UNRELEASED
}
#endif
//------------------ invalid inputs ------------------------------------------------------------------------------
#if 1
{
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_datetime_malformed_no_leads);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_datetime_malformed_no_t);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_datetime_malformed_with_milli);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_duplicate_key_table);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_duplicate_keys);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_duplicate_tables);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_empty_implicit_table);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_empty_table);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_leading_zero_neg);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_leading_zero_pos);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_leading_zero);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_no_leading_zero);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_no_trailing_digits);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_underscore_after_point);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_underscore_after);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_underscore_before_point);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_float_underscore_before);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_integer_leading_zero_neg);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_integer_leading_zero_pos);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_integer_leading_zero);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_integer_underscore_after);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_integer_underscore_before);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_integer_underscore_double);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_after_array);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_after_table);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_empty);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_hash);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_newline);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_no_eol);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_open_bracket);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_single_open_bracket);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_space);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_start_bracket);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_key_two_equals);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_llbrace);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_multi_line_string_no_close);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_rrbrace);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_string_bad_byte_escape);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_string_bad_codepoint);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_string_bad_escape);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_string_bad_slash_escape);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_string_bad_uni_esc);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_string_no_close);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_array_implicit);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_array_malformed_bracket);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_array_malformed_empty);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_empty);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_nested_brackets_close);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_nested_brackets_open);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_whitespace);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_table_with_pound);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_text_after_array_entries);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_text_after_integer);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_text_after_string);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_text_after_table);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_text_before_array_separator);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_text_in_array);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_array_of_tables_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_array_of_tables_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_bare_key_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_bare_key_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_bare_key_3);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_inline_table_imutable_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_inline_table_imutable_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_int_0_padded);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_int_signed_bin);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_int_signed_hex);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_int_signed_oct);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_key_value_pair_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_key_value_pair_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_multiple_dot_key);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_multiple_key);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_no_key_name);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_multiline_invalid_backslash);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_multiline_out_of_range_unicode_escape_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_multiline_out_of_range_unicode_escape_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_multiline_quotes);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_multiline_unknown_escape);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_out_of_range_unicode_escape_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_out_of_range_unicode_escape_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_basic_unknown_escape);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_string_literal_multiline_quotes);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_3);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_4);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_invalid_1);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_invalid_2);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_invalid_3);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_table_invalid_4);
#if !TOML_LANG_UNRELEASED
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_datetime_malformed_no_secs);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_inline_table_linebreak);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_multi_line_inline_table);
parsing_should_fail(FILE_LINE_ARGS, invalid::burntsushi_string_byte_escapes);
parsing_should_fail(FILE_LINE_ARGS, invalid::iarna_inline_table_trailing_comma);
#endif // !TOML_LANG_UNRELEASED
}
#endif
}