mirror of
https://github.com/valitydev/yamerl.git
synced 2024-11-06 10:55:16 +00:00
31e0453f04
References #15.
696 lines
29 KiB
Erlang
696 lines
29 KiB
Erlang
-module(float).
|
|
|
|
-include_lib("eunit/include/eunit.hrl").
|
|
|
|
-define(FILENAME, "test/construction/" ?MODULE_STRING ".yaml").
|
|
|
|
setup() ->
|
|
application:start(yamerl).
|
|
|
|
schema_failsafe_simple_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[
|
|
[
|
|
"0", "+0", "-0",
|
|
"123", "+123", "-123",
|
|
"12.34", "+12.34", "-12.34",
|
|
"12e10", "+12e10", "-12e10",
|
|
"1.2e11", "1.2e+11", "1.2e-11",
|
|
"1.0e10", "1.0E10",
|
|
".", ".1", ".e+3", "1.", "1.e+3",
|
|
"190:20:30.15", "+190:20:30.15", "-190:20:30.15",
|
|
".inf", "+.inf", "-.inf", ".nan",
|
|
".Inf", ".INF", ".iNF",
|
|
".NaN", ".NAN", ".Nan", ".nAN",
|
|
"Not a float.0e+10", "+Not a float.0e+10", "-Not a float.0e+10"
|
|
]
|
|
],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, false}, {schema, failsafe}]) %% No float parsing
|
|
)
|
|
]
|
|
}.
|
|
|
|
schema_failsafe_float_json_simple_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[
|
|
[
|
|
0.0, "+0", 0.0,
|
|
123.0, "+123", -123.0,
|
|
12.34, "+12.34", -12.34,
|
|
1.2e+11, "+12e10", -1.2e+11,
|
|
1.2e+11, 1.2e+11, 1.2e-11,
|
|
1.0e+10, 1.0e+10,
|
|
".", ".1", ".e+3", 1.0, 1000.0,
|
|
"190:20:30.15", "+190:20:30.15", "-190:20:30.15",
|
|
'+inf', "+.inf", '-inf', 'nan',
|
|
".Inf", ".INF", ".iNF",
|
|
".NaN", ".NAN", ".Nan", ".nAN",
|
|
"Not a float.0e+10", "+Not a float.0e+10", "-Not a float.0e+10"
|
|
]
|
|
],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, false}, {schema, failsafe},
|
|
{node_mods, [yamerl_node_float_json]}])
|
|
)
|
|
]
|
|
}.
|
|
|
|
schema_failsafe_float_simple_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[
|
|
[
|
|
0.0, 0.0, 0.0,
|
|
123.0, 123.0, -123.0,
|
|
12.34, 12.34, -12.34,
|
|
1.2e+11, 1.2e+11, -1.2e+11,
|
|
1.2e+11, 1.2e+11, 1.2e-11,
|
|
1.0e+10, 1.0e+10,
|
|
".", 0.1, ".e+3", 1.0, 1000.0,
|
|
"190:20:30.15", "+190:20:30.15", "-190:20:30.15",
|
|
'+inf', '+inf', '-inf', 'nan',
|
|
'+inf', '+inf', ".iNF",
|
|
'nan', 'nan', ".Nan", ".nAN",
|
|
"Not a float.0e+10", "+Not a float.0e+10", "-Not a float.0e+10"
|
|
]
|
|
],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, false}, {schema, failsafe},
|
|
{node_mods, [yamerl_node_float]}])
|
|
)
|
|
]
|
|
}.
|
|
|
|
schema_failsafe_float_ext_simple_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[
|
|
[
|
|
0.0, 0.0, 0.0,
|
|
"123", "+123", "-123",
|
|
12.34, 12.34, -12.34,
|
|
"12e10", "+12e10", "-12e10",
|
|
"1.2e11", 1.2e+11, 1.2e-11,
|
|
"1.0e10", "1.0E10",
|
|
".", 0.1, 0.0, 1.0, 1000.0,
|
|
685230.15, 685230.15, -685230.15,
|
|
'+inf', '+inf', '-inf', 'nan',
|
|
'+inf', '+inf', ".iNF",
|
|
'nan', 'nan', ".Nan", ".nAN",
|
|
"Not a float.0e+10", "+Not a float.0e+10", "-Not a float.0e+10"
|
|
]
|
|
],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, false}, {schema, failsafe},
|
|
{node_mods, [yamerl_node_float_ext]}])
|
|
)
|
|
]
|
|
}.
|
|
|
|
schema_failsafe_detailed_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[{yamerl_doc,
|
|
{yamerl_seq,yamerl_node_seq,"tag:yaml.org,2002:seq",
|
|
[{line,1},{column,1}],
|
|
[
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,1},{column,4}],
|
|
"0"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,2},{column,3}],
|
|
"+0"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,3},{column,3}],
|
|
"-0"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,5},{column,4}],
|
|
"123"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,6},{column,3}],
|
|
"+123"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,7},{column,3}],
|
|
"-123"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,9},{column,4}],
|
|
"12.34"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,10},{column,3}],
|
|
"+12.34"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,11},{column,3}],
|
|
"-12.34"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,13},{column,4}],
|
|
"12e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,14},{column,3}],
|
|
"+12e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,15},{column,3}],
|
|
"-12e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,17},{column,3}],
|
|
"1.2e11"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,18},{column,3}],
|
|
"1.2e+11"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,19},{column,3}],
|
|
"1.2e-11"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,21},{column,3}],
|
|
"1.0e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,22},{column,3}],
|
|
"1.0E10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,24},{column,4}],
|
|
"."},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,25},{column,4}],
|
|
".1"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,26},{column,4}],
|
|
".e+3"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,27},{column,3}],
|
|
"1."},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,28},{column,3}],
|
|
"1.e+3"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,30},{column,4}],
|
|
"190:20:30.15"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,31},{column,3}],
|
|
"+190:20:30.15"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,32},{column,3}],
|
|
"-190:20:30.15"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,34},{column,4}],
|
|
".inf"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,35},{column,3}],
|
|
"+.inf"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,36},{column,3}],
|
|
"-.inf"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,37},{column,4}],
|
|
".nan"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,39},{column,3}],
|
|
".Inf"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,40},{column,3}],
|
|
".INF"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,41},{column,3}],
|
|
".iNF"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,43},{column,3}],
|
|
".NaN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,44},{column,3}],
|
|
".NAN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,45},{column,3}],
|
|
".Nan"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,46},{column,3}],
|
|
".nAN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,48},{column,4}],
|
|
"Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,49},{column,3}],
|
|
"+Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,50},{column,3}],
|
|
"-Not a float.0e+10"}],
|
|
39}}],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, true}, {schema, failsafe}]) %% No float parsing
|
|
)
|
|
]
|
|
}.
|
|
|
|
schema_failsafe_float_json_detailed_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[{yamerl_doc,
|
|
{yamerl_seq,yamerl_node_seq,"tag:yaml.org,2002:seq",
|
|
[{line,1},{column,1}],
|
|
[
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,1},{column,4}],
|
|
0.0},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,2},{column,3}],
|
|
"+0"},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,3},{column,3}],
|
|
0.0},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,5},{column,4}],
|
|
123.0},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,6},{column,3}],
|
|
"+123"},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,7},{column,3}],
|
|
-123.0},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,9},{column,4}],
|
|
12.34},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,10},{column,3}],
|
|
"+12.34"},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,11},{column,3}],
|
|
-12.34},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,13},{column,4}],
|
|
1.2e11},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,14},{column,3}],
|
|
"+12e10"},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,15},{column,3}],
|
|
-1.2e11},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,17},{column,3}],
|
|
1.2e11},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,18},{column,3}],
|
|
1.2e11},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,19},{column,3}],
|
|
1.2e-11},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,21},{column,3}],
|
|
1.0e10},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,22},{column,3}],
|
|
1.0e10},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,24},{column,4}],
|
|
"."},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,25},{column,4}],
|
|
".1"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,26},{column,4}],
|
|
".e+3"},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,27},{column,3}],
|
|
1.0},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,28},{column,3}],
|
|
1000.0},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,30},{column,4}],
|
|
"190:20:30.15"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,31},{column,3}],
|
|
"+190:20:30.15"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,32},{column,3}],
|
|
"-190:20:30.15"},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,34},{column,4}],
|
|
'+inf'},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,35},{column,3}],
|
|
"+.inf"},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,36},{column,3}],
|
|
'-inf'},
|
|
{yamerl_float,yamerl_node_float_json,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,37},{column,4}],
|
|
nan},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,39},{column,3}],
|
|
".Inf"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,40},{column,3}],
|
|
".INF"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,41},{column,3}],
|
|
".iNF"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,43},{column,3}],
|
|
".NaN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,44},{column,3}],
|
|
".NAN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,45},{column,3}],
|
|
".Nan"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,46},{column,3}],
|
|
".nAN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,48},{column,4}],
|
|
"Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,49},{column,3}],
|
|
"+Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,50},{column,3}],
|
|
"-Not a float.0e+10"}],
|
|
39}}],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, true}, {schema, failsafe},
|
|
{node_mods, [yamerl_node_float_json]}])
|
|
)
|
|
]
|
|
}.
|
|
|
|
schema_failsafe_float_detailed_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[{yamerl_doc,
|
|
{yamerl_seq,yamerl_node_seq,"tag:yaml.org,2002:seq",
|
|
[{line,1},{column,1}],
|
|
[
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,1},{column,4}],
|
|
0.0},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,2},{column,3}],
|
|
0.0},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,3},{column,3}],
|
|
0.0},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,5},{column,4}],
|
|
123.0},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,6},{column,3}],
|
|
123.0},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,7},{column,3}],
|
|
-123.0},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,9},{column,4}],
|
|
12.34},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,10},{column,3}],
|
|
12.34},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,11},{column,3}],
|
|
-12.34},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,13},{column,4}],
|
|
1.2e11},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,14},{column,3}],
|
|
1.2e11},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,15},{column,3}],
|
|
-1.2e11},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,17},{column,3}],
|
|
1.2e11},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,18},{column,3}],
|
|
1.2e11},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,19},{column,3}],
|
|
1.2e-11},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,21},{column,3}],
|
|
1.0e10},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,22},{column,3}],
|
|
1.0e10},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,24},{column,4}],
|
|
"."},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,25},{column,4}],
|
|
0.1},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,26},{column,4}],
|
|
".e+3"},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,27},{column,3}],
|
|
1.0},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,28},{column,3}],
|
|
1000.0},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,30},{column,4}],
|
|
"190:20:30.15"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,31},{column,3}],
|
|
"+190:20:30.15"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,32},{column,3}],
|
|
"-190:20:30.15"},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,34},{column,4}],
|
|
'+inf'},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,35},{column,3}],
|
|
'+inf'},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,36},{column,3}],
|
|
'-inf'},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,37},{column,4}],
|
|
nan},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,39},{column,3}],
|
|
'+inf'},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,40},{column,3}],
|
|
'+inf'},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,41},{column,3}],
|
|
".iNF"},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,43},{column,3}],
|
|
nan},
|
|
{yamerl_float,yamerl_node_float,"tag:yaml.org,2002:float",
|
|
[{line,44},{column,3}],
|
|
nan},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,45},{column,3}],
|
|
".Nan"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,46},{column,3}],
|
|
".nAN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,48},{column,4}],
|
|
"Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,49},{column,3}],
|
|
"+Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,50},{column,3}],
|
|
"-Not a float.0e+10"}],
|
|
39}}],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, true}, {schema, failsafe},
|
|
{node_mods, [yamerl_node_float]}])
|
|
)
|
|
]
|
|
}.
|
|
|
|
schema_failsafe_float_ext_detailed_test_() ->
|
|
{setup,
|
|
fun setup/0,
|
|
[
|
|
?_assertMatch(
|
|
[{yamerl_doc,
|
|
{yamerl_seq,yamerl_node_seq,"tag:yaml.org,2002:seq",
|
|
[{line,1},{column,1}],
|
|
[
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,1},{column,4}],
|
|
0.0},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,2},{column,3}],
|
|
0.0},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,3},{column,3}],
|
|
0.0},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,5},{column,4}],
|
|
"123"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,6},{column,3}],
|
|
"+123"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,7},{column,3}],
|
|
"-123"},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,9},{column,4}],
|
|
12.34},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,10},{column,3}],
|
|
12.34},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,11},{column,3}],
|
|
-12.34},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,13},{column,4}],
|
|
"12e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,14},{column,3}],
|
|
"+12e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,15},{column,3}],
|
|
"-12e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,17},{column,3}],
|
|
"1.2e11"},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,18},{column,3}],
|
|
1.2e11},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,19},{column,3}],
|
|
1.2e-11},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,21},{column,3}],
|
|
"1.0e10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,22},{column,3}],
|
|
"1.0E10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,24},{column,4}],
|
|
"."},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,25},{column,4}],
|
|
0.1},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,26},{column,4}],
|
|
0.0},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,27},{column,3}],
|
|
1.0},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,28},{column,3}],
|
|
1000.0},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,30},{column,4}],
|
|
685230.15},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,31},{column,3}],
|
|
685230.15},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,32},{column,3}],
|
|
-685230.15},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,34},{column,4}],
|
|
'+inf'},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,35},{column,3}],
|
|
'+inf'},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,36},{column,3}],
|
|
'-inf'},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,37},{column,4}],
|
|
nan},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,39},{column,3}],
|
|
'+inf'},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,40},{column,3}],
|
|
'+inf'},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,41},{column,3}],
|
|
".iNF"},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,43},{column,3}],
|
|
nan},
|
|
{yamerl_float,yamerl_node_float_ext,
|
|
"tag:yaml.org,2002:float",
|
|
[{line,44},{column,3}],
|
|
nan},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,45},{column,3}],
|
|
".Nan"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,46},{column,3}],
|
|
".nAN"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,48},{column,4}],
|
|
"Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,49},{column,3}],
|
|
"+Not a float.0e+10"},
|
|
{yamerl_str,yamerl_node_str,"tag:yaml.org,2002:str",
|
|
[{line,50},{column,3}],
|
|
"-Not a float.0e+10"}],
|
|
39}}],
|
|
yamerl_constr:file(?FILENAME,
|
|
[{detailed_constr, true}, {schema, failsafe},
|
|
{node_mods, [yamerl_node_float_ext]}])
|
|
)
|
|
]
|
|
}.
|