Current section
Files
Jump to
Current section
Files
gen/test/json_test_suite.erl
-module(json_test_suite).
-compile(no_auto_import).
-export([json_test_suite_test/0]).
json_test_suite_test() ->
AcceptExtra = [<<"i_number_double_huge_neg_exp.json"/utf8>>,
<<"i_number_real_underflow.json"/utf8>>,
<<"i_number_too_big_neg_int.json"/utf8>>,
<<"i_number_too_big_pos_int.json"/utf8>>,
<<"i_number_very_big_negative_int.json"/utf8>>,
<<"i_structure_500_nested_arrays.json"/utf8>>],
RejectExtra = [<<"i_number_neg_int_huge_exp.json"/utf8>>,
<<"i_number_pos_double_huge_exp.json"/utf8>>,
<<"i_number_real_neg_overflow.json"/utf8>>,
<<"i_number_real_pos_overflow.json"/utf8>>,
<<"i_object_key_lone_2nd_surrogate.json"/utf8>>,
<<"i_string_1st_surrogate_but_2nd_missing.json"/utf8>>,
<<"i_string_1st_valid_surrogate_2nd_invalid.json"/utf8>>,
<<"i_string_UTF-16LE_with_BOM.json"/utf8>>,
<<"i_string_UTF-8_invalid_sequence.json"/utf8>>,
<<"i_string_UTF8_surrogate_U+D800.json"/utf8>>,
<<"i_string_incomplete_surrogate_and_escape_valid.json"/utf8>>,
<<"i_string_incomplete_surrogate_pair.json"/utf8>>,
<<"i_string_incomplete_surrogates_escape_valid.json"/utf8>>,
<<"i_string_invalid_surrogate.json"/utf8>>,
<<"i_string_invalid_utf-8.json"/utf8>>,
<<"i_string_inverted_surrogates_U+1D11E.json"/utf8>>,
<<"i_string_iso_latin_1.json"/utf8>>,
<<"i_string_lone_second_surrogate.json"/utf8>>,
<<"i_string_lone_utf8_continuation_byte.json"/utf8>>,
<<"i_string_not_in_unicode_range.json"/utf8>>,
<<"i_string_overlong_sequence_2_bytes.json"/utf8>>,
<<"i_string_overlong_sequence_6_bytes.json"/utf8>>,
<<"i_string_overlong_sequence_6_bytes_null.json"/utf8>>,
<<"i_string_truncated-utf-8.json"/utf8>>,
<<"i_string_utf16BE_no_BOM.json"/utf8>>,
<<"i_string_utf16LE_no_BOM.json"/utf8>>,
<<"i_structure_UTF-8_BOM_empty_object.json"/utf8>>],
Dir = <<"./json_test_suite/"/utf8>>,
{ok, Files} = gleam@result:map(
file:list_dir(Dir),
fun(GleamCaptureVariable) ->
gleam@list:map(GleamCaptureVariable, fun erlang:list_to_binary/1)
end
),
{Accept, Other} = gleam@list:partition(
Files,
fun(F) -> gleam@string:starts_with(F, <<"y"/utf8>>) end
),
{Reject, _} = gleam@list:partition(
Other,
fun(F@1) -> gleam@string:starts_with(F@1, <<"n"/utf8>>) end
),
gleam@should:equal(
gleam@list:any(
gleam@list:map(
gleam@list:append(Accept, AcceptExtra),
fun(File) ->
{ok, Json} = file:read_file(
gleam@string:concat([Dir, File])
),
Res = gj:decode(Json),
case Res of
{ok, _} ->
true;
_ ->
test_help:debug(File),
test_help:debug(Res),
false
end
end
),
fun(X) -> X =:= false end
),
false
),
gleam@should:equal(
gleam@list:any(
gleam@list:map(
gleam@list:append(Reject, RejectExtra),
fun(File@1) ->
{ok, Json@1} = file:read_file(
gleam@string:concat([Dir, File@1])
),
Res@1 = gj:decode(Json@1),
case Res@1 of
{error, _} ->
true;
{ok, _} ->
test_help:debug(File@1),
test_help:debug(Res@1),
false
end
end
),
fun(X@1) -> X@1 =:= false end
),
false
).