more test cases
This commit is contained in:
parent
48392cfa79
commit
e53e84e1cc
2 changed files with 1291 additions and 313 deletions
637
src/json.hpp
637
src/json.hpp
|
@ -2638,7 +2638,8 @@ class basic_json
|
|||
{
|
||||
lexer_char_t yych;
|
||||
unsigned int yyaccept = 0;
|
||||
static const unsigned char yybm[] = {
|
||||
static const unsigned char yybm[] =
|
||||
{
|
||||
64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 192, 192, 64, 64, 192, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64,
|
||||
|
@ -2674,58 +2675,134 @@ class basic_json
|
|||
};
|
||||
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= ':') {
|
||||
if (yych <= '!') {
|
||||
if (yych <= '\f') {
|
||||
if (yych <= 0x08) goto json_parser_3;
|
||||
if (yych <= '\n') goto json_parser_5;
|
||||
goto json_parser_3;
|
||||
} else {
|
||||
if (yych <= '\r') goto json_parser_5;
|
||||
if (yych == ' ') goto json_parser_5;
|
||||
if (yych <= ':')
|
||||
{
|
||||
if (yych <= '!')
|
||||
{
|
||||
if (yych <= '\f')
|
||||
{
|
||||
if (yych <= 0x08)
|
||||
{
|
||||
goto json_parser_3;
|
||||
}
|
||||
} else {
|
||||
if (yych <= '-') {
|
||||
if (yych <= '"') goto json_parser_6;
|
||||
if (yych <= '+') goto json_parser_3;
|
||||
if (yych <= ',') goto json_parser_7;
|
||||
if (yych <= '\n')
|
||||
{
|
||||
goto json_parser_5;
|
||||
}
|
||||
goto json_parser_3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= '\r')
|
||||
{
|
||||
goto json_parser_5;
|
||||
}
|
||||
if (yych == ' ')
|
||||
{
|
||||
goto json_parser_5;
|
||||
}
|
||||
goto json_parser_3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= '-')
|
||||
{
|
||||
if (yych <= '"')
|
||||
{
|
||||
goto json_parser_6;
|
||||
}
|
||||
if (yych <= '+')
|
||||
{
|
||||
goto json_parser_3;
|
||||
}
|
||||
if (yych <= ',')
|
||||
{
|
||||
goto json_parser_7;
|
||||
}
|
||||
goto json_parser_9;
|
||||
} else {
|
||||
if (yych <= '/') goto json_parser_3;
|
||||
if (yych <= '0') goto json_parser_10;
|
||||
if (yych <= '9') goto json_parser_12;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_3;
|
||||
}
|
||||
if (yych <= '0')
|
||||
{
|
||||
goto json_parser_10;
|
||||
}
|
||||
if (yych <= '9')
|
||||
{
|
||||
goto json_parser_12;
|
||||
}
|
||||
goto json_parser_13;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (yych <= 'm') {
|
||||
if (yych <= '\\') {
|
||||
if (yych == '[') goto json_parser_15;
|
||||
goto json_parser_3;
|
||||
} else {
|
||||
if (yych <= ']') goto json_parser_17;
|
||||
if (yych == 'f') goto json_parser_19;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'm')
|
||||
{
|
||||
if (yych <= '\\')
|
||||
{
|
||||
if (yych == '[')
|
||||
{
|
||||
goto json_parser_15;
|
||||
}
|
||||
goto json_parser_3;
|
||||
}
|
||||
} else {
|
||||
if (yych <= 'z') {
|
||||
if (yych <= 'n') goto json_parser_20;
|
||||
if (yych == 't') goto json_parser_21;
|
||||
else
|
||||
{
|
||||
if (yych <= ']')
|
||||
{
|
||||
goto json_parser_17;
|
||||
}
|
||||
if (yych == 'f')
|
||||
{
|
||||
goto json_parser_19;
|
||||
}
|
||||
goto json_parser_3;
|
||||
} else {
|
||||
if (yych <= '{') goto json_parser_22;
|
||||
if (yych == '}') goto json_parser_24;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'z')
|
||||
{
|
||||
if (yych <= 'n')
|
||||
{
|
||||
goto json_parser_20;
|
||||
}
|
||||
if (yych == 't')
|
||||
{
|
||||
goto json_parser_21;
|
||||
}
|
||||
goto json_parser_3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= '{')
|
||||
{
|
||||
goto json_parser_22;
|
||||
}
|
||||
if (yych == '}')
|
||||
{
|
||||
goto json_parser_24;
|
||||
}
|
||||
goto json_parser_3;
|
||||
}
|
||||
}
|
||||
}
|
||||
json_parser_2:
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
json_parser_3:
|
||||
++buffer_re2c;
|
||||
json_parser_4:
|
||||
{ return last_token = token_type::parse_error; }
|
||||
{
|
||||
return last_token = token_type::parse_error;
|
||||
}
|
||||
json_parser_5:
|
||||
yych = *++buffer_re2c;
|
||||
goto json_parser_60;
|
||||
|
@ -2735,247 +2812,515 @@ json_parser_6:
|
|||
goto json_parser_51;
|
||||
json_parser_7:
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::value_separator; }
|
||||
{
|
||||
return last_token = token_type::value_separator;
|
||||
}
|
||||
json_parser_9:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych <= '/') goto json_parser_4;
|
||||
if (yych <= '0') goto json_parser_49;
|
||||
if (yych <= '9') goto json_parser_40;
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_4;
|
||||
}
|
||||
if (yych <= '0')
|
||||
{
|
||||
goto json_parser_49;
|
||||
}
|
||||
if (yych <= '9')
|
||||
{
|
||||
goto json_parser_40;
|
||||
}
|
||||
goto json_parser_4;
|
||||
json_parser_10:
|
||||
yyaccept = 1;
|
||||
yych = *(marker = ++buffer_re2c);
|
||||
if (yych <= 'D') {
|
||||
if (yych == '.') goto json_parser_42;
|
||||
} else {
|
||||
if (yych <= 'E') goto json_parser_43;
|
||||
if (yych == 'e') goto json_parser_43;
|
||||
if (yych <= 'D')
|
||||
{
|
||||
if (yych == '.')
|
||||
{
|
||||
goto json_parser_42;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'E')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
if (yych == 'e')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
}
|
||||
json_parser_11:
|
||||
{ return last_token = token_type::value_number; }
|
||||
{
|
||||
return last_token = token_type::value_number;
|
||||
}
|
||||
json_parser_12:
|
||||
yyaccept = 1;
|
||||
yych = *(marker = ++buffer_re2c);
|
||||
goto json_parser_41;
|
||||
json_parser_13:
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::name_separator; }
|
||||
{
|
||||
return last_token = token_type::name_separator;
|
||||
}
|
||||
json_parser_15:
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::begin_array; }
|
||||
{
|
||||
return last_token = token_type::begin_array;
|
||||
}
|
||||
json_parser_17:
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::end_array; }
|
||||
{
|
||||
return last_token = token_type::end_array;
|
||||
}
|
||||
json_parser_19:
|
||||
yyaccept = 0;
|
||||
yych = *(marker = ++buffer_re2c);
|
||||
if (yych == 'a') goto json_parser_35;
|
||||
if (yych == 'a')
|
||||
{
|
||||
goto json_parser_35;
|
||||
}
|
||||
goto json_parser_4;
|
||||
json_parser_20:
|
||||
yyaccept = 0;
|
||||
yych = *(marker = ++buffer_re2c);
|
||||
if (yych == 'u') goto json_parser_31;
|
||||
if (yych == 'u')
|
||||
{
|
||||
goto json_parser_31;
|
||||
}
|
||||
goto json_parser_4;
|
||||
json_parser_21:
|
||||
yyaccept = 0;
|
||||
yych = *(marker = ++buffer_re2c);
|
||||
if (yych == 'r') goto json_parser_26;
|
||||
if (yych == 'r')
|
||||
{
|
||||
goto json_parser_26;
|
||||
}
|
||||
goto json_parser_4;
|
||||
json_parser_22:
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::begin_object; }
|
||||
{
|
||||
return last_token = token_type::begin_object;
|
||||
}
|
||||
json_parser_24:
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::end_object; }
|
||||
{
|
||||
return last_token = token_type::end_object;
|
||||
}
|
||||
json_parser_26:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych == 'u') goto json_parser_28;
|
||||
if (yych == 'u')
|
||||
{
|
||||
goto json_parser_28;
|
||||
}
|
||||
json_parser_27:
|
||||
buffer_re2c = marker;
|
||||
if (yyaccept == 0) {
|
||||
if (yyaccept == 0)
|
||||
{
|
||||
goto json_parser_4;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
goto json_parser_11;
|
||||
}
|
||||
json_parser_28:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych != 'e') goto json_parser_27;
|
||||
if (yych != 'e')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::literal_true; }
|
||||
{
|
||||
return last_token = token_type::literal_true;
|
||||
}
|
||||
json_parser_31:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych != 'l') goto json_parser_27;
|
||||
if (yych != 'l')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
yych = *++buffer_re2c;
|
||||
if (yych != 'l') goto json_parser_27;
|
||||
if (yych != 'l')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::literal_null; }
|
||||
{
|
||||
return last_token = token_type::literal_null;
|
||||
}
|
||||
json_parser_35:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych != 'l') goto json_parser_27;
|
||||
if (yych != 'l')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
yych = *++buffer_re2c;
|
||||
if (yych != 's') goto json_parser_27;
|
||||
if (yych != 's')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
yych = *++buffer_re2c;
|
||||
if (yych != 'e') goto json_parser_27;
|
||||
if (yych != 'e')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::literal_false; }
|
||||
{
|
||||
return last_token = token_type::literal_false;
|
||||
}
|
||||
json_parser_40:
|
||||
yyaccept = 1;
|
||||
marker = ++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
json_parser_41:
|
||||
if (yybm[0+yych] & 32) {
|
||||
if (yybm[0 + yych] & 32)
|
||||
{
|
||||
goto json_parser_40;
|
||||
}
|
||||
if (yych <= 'D') {
|
||||
if (yych != '.') goto json_parser_11;
|
||||
} else {
|
||||
if (yych <= 'E') goto json_parser_43;
|
||||
if (yych == 'e') goto json_parser_43;
|
||||
if (yych <= 'D')
|
||||
{
|
||||
if (yych != '.')
|
||||
{
|
||||
goto json_parser_11;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'E')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
if (yych == 'e')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
goto json_parser_11;
|
||||
}
|
||||
json_parser_42:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych <= '/') goto json_parser_27;
|
||||
if (yych <= '9') goto json_parser_47;
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych <= '9')
|
||||
{
|
||||
goto json_parser_47;
|
||||
}
|
||||
goto json_parser_27;
|
||||
json_parser_43:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych <= ',') {
|
||||
if (yych != '+') goto json_parser_27;
|
||||
} else {
|
||||
if (yych <= '-') goto json_parser_44;
|
||||
if (yych <= '/') goto json_parser_27;
|
||||
if (yych <= '9') goto json_parser_45;
|
||||
if (yych <= ',')
|
||||
{
|
||||
if (yych != '+')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= '-')
|
||||
{
|
||||
goto json_parser_44;
|
||||
}
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych <= '9')
|
||||
{
|
||||
goto json_parser_45;
|
||||
}
|
||||
goto json_parser_27;
|
||||
}
|
||||
json_parser_44:
|
||||
yych = *++buffer_re2c;
|
||||
if (yych <= '/') goto json_parser_27;
|
||||
if (yych >= ':') goto json_parser_27;
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych >= ':')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
json_parser_45:
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= '/') goto json_parser_11;
|
||||
if (yych <= '9') goto json_parser_45;
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_11;
|
||||
}
|
||||
if (yych <= '9')
|
||||
{
|
||||
goto json_parser_45;
|
||||
}
|
||||
goto json_parser_11;
|
||||
json_parser_47:
|
||||
yyaccept = 1;
|
||||
marker = ++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= 'D') {
|
||||
if (yych <= '/') goto json_parser_11;
|
||||
if (yych <= '9') goto json_parser_47;
|
||||
if (yych <= 'D')
|
||||
{
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_11;
|
||||
} else {
|
||||
if (yych <= 'E') goto json_parser_43;
|
||||
if (yych == 'e') goto json_parser_43;
|
||||
}
|
||||
if (yych <= '9')
|
||||
{
|
||||
goto json_parser_47;
|
||||
}
|
||||
goto json_parser_11;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'E')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
if (yych == 'e')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
goto json_parser_11;
|
||||
}
|
||||
json_parser_49:
|
||||
yyaccept = 1;
|
||||
yych = *(marker = ++buffer_re2c);
|
||||
if (yych <= 'D') {
|
||||
if (yych == '.') goto json_parser_42;
|
||||
if (yych <= 'D')
|
||||
{
|
||||
if (yych == '.')
|
||||
{
|
||||
goto json_parser_42;
|
||||
}
|
||||
goto json_parser_11;
|
||||
} else {
|
||||
if (yych <= 'E') goto json_parser_43;
|
||||
if (yych == 'e') goto json_parser_43;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'E')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
if (yych == 'e')
|
||||
{
|
||||
goto json_parser_43;
|
||||
}
|
||||
goto json_parser_11;
|
||||
}
|
||||
json_parser_50:
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
json_parser_51:
|
||||
if (yybm[0+yych] & 64) {
|
||||
if (yybm[0 + yych] & 64)
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
if (yych <= '"') goto json_parser_53;
|
||||
if (yych <= '"')
|
||||
{
|
||||
goto json_parser_53;
|
||||
}
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= 'e') {
|
||||
if (yych <= '/') {
|
||||
if (yych == '"') goto json_parser_50;
|
||||
if (yych <= '.') goto json_parser_27;
|
||||
if (yych <= 'e')
|
||||
{
|
||||
if (yych <= '/')
|
||||
{
|
||||
if (yych == '"')
|
||||
{
|
||||
goto json_parser_50;
|
||||
} else {
|
||||
if (yych <= '\\') {
|
||||
if (yych <= '[') goto json_parser_27;
|
||||
}
|
||||
if (yych <= '.')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
goto json_parser_50;
|
||||
} else {
|
||||
if (yych == 'b') goto json_parser_50;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= '\\')
|
||||
{
|
||||
if (yych <= '[')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
goto json_parser_50;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych == 'b')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (yych <= 'q') {
|
||||
if (yych <= 'f') goto json_parser_50;
|
||||
if (yych == 'n') goto json_parser_50;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'q')
|
||||
{
|
||||
if (yych <= 'f')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
if (yych == 'n')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
goto json_parser_27;
|
||||
} else {
|
||||
if (yych <= 's') {
|
||||
if (yych <= 'r') goto json_parser_50;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 's')
|
||||
{
|
||||
if (yych <= 'r')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
goto json_parser_27;
|
||||
} else {
|
||||
if (yych <= 't') goto json_parser_50;
|
||||
if (yych <= 'u') goto json_parser_55;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 't')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
if (yych <= 'u')
|
||||
{
|
||||
goto json_parser_55;
|
||||
}
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
}
|
||||
json_parser_53:
|
||||
++buffer_re2c;
|
||||
{ return last_token = token_type::value_string; }
|
||||
{
|
||||
return last_token = token_type::value_string;
|
||||
}
|
||||
json_parser_55:
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= '@') {
|
||||
if (yych <= '/') goto json_parser_27;
|
||||
if (yych >= ':') goto json_parser_27;
|
||||
} else {
|
||||
if (yych <= 'F') goto json_parser_56;
|
||||
if (yych <= '`') goto json_parser_27;
|
||||
if (yych >= 'g') goto json_parser_27;
|
||||
if (yych <= '@')
|
||||
{
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych >= ':')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'F')
|
||||
{
|
||||
goto json_parser_56;
|
||||
}
|
||||
if (yych <= '`')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych >= 'g')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
json_parser_56:
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= '@') {
|
||||
if (yych <= '/') goto json_parser_27;
|
||||
if (yych >= ':') goto json_parser_27;
|
||||
} else {
|
||||
if (yych <= 'F') goto json_parser_57;
|
||||
if (yych <= '`') goto json_parser_27;
|
||||
if (yych >= 'g') goto json_parser_27;
|
||||
if (yych <= '@')
|
||||
{
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych >= ':')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'F')
|
||||
{
|
||||
goto json_parser_57;
|
||||
}
|
||||
if (yych <= '`')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych >= 'g')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
json_parser_57:
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= '@') {
|
||||
if (yych <= '/') goto json_parser_27;
|
||||
if (yych >= ':') goto json_parser_27;
|
||||
} else {
|
||||
if (yych <= 'F') goto json_parser_58;
|
||||
if (yych <= '`') goto json_parser_27;
|
||||
if (yych >= 'g') goto json_parser_27;
|
||||
if (yych <= '@')
|
||||
{
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych >= ':')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'F')
|
||||
{
|
||||
goto json_parser_58;
|
||||
}
|
||||
if (yych <= '`')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych >= 'g')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
}
|
||||
json_parser_58:
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
if (yych <= '@') {
|
||||
if (yych <= '/') goto json_parser_27;
|
||||
if (yych <= '9') goto json_parser_50;
|
||||
if (yych <= '@')
|
||||
{
|
||||
if (yych <= '/')
|
||||
{
|
||||
goto json_parser_27;
|
||||
} else {
|
||||
if (yych <= 'F') goto json_parser_50;
|
||||
if (yych <= '`') goto json_parser_27;
|
||||
if (yych <= 'f') goto json_parser_50;
|
||||
}
|
||||
if (yych <= '9')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
goto json_parser_27;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (yych <= 'F')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
if (yych <= '`')
|
||||
{
|
||||
goto json_parser_27;
|
||||
}
|
||||
if (yych <= 'f')
|
||||
{
|
||||
goto json_parser_50;
|
||||
}
|
||||
goto json_parser_27;
|
||||
}
|
||||
json_parser_59:
|
||||
++buffer_re2c;
|
||||
yych = *buffer_re2c;
|
||||
json_parser_60:
|
||||
if (yybm[0+yych] & 128) {
|
||||
if (yybm[0 + yych] & 128)
|
||||
{
|
||||
goto json_parser_59;
|
||||
}
|
||||
goto json_parser_2;
|
||||
|
|
647
test/unit.cpp
647
test/unit.cpp
|
@ -2492,14 +2492,182 @@ TEST_CASE("iterators")
|
|||
|
||||
SECTION("array")
|
||||
{
|
||||
json j = {1, 2, 3, 4};
|
||||
json j = {1, 2, 3};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("json + begin/end")
|
||||
{
|
||||
json::iterator it_begin = j.begin();
|
||||
json::iterator it_end = j.end();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
|
||||
SECTION("const json + begin/end")
|
||||
{
|
||||
json::iterator it_begin = j_const.begin();
|
||||
json::iterator it_end = j_const.end();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
|
||||
SECTION("json + cbegin/cend")
|
||||
{
|
||||
json::const_iterator it_begin = j.cbegin();
|
||||
json::const_iterator it_end = j.cend();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
|
||||
SECTION("const json + cbegin/cend")
|
||||
{
|
||||
json::const_iterator it_begin = j.cbegin();
|
||||
json::const_iterator it_end = j.cend();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("object")
|
||||
{
|
||||
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("json + begin/end")
|
||||
{
|
||||
json::iterator it_begin = j.begin();
|
||||
json::iterator it_end = j.end();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
|
||||
SECTION("const json + begin/end")
|
||||
{
|
||||
json::iterator it_begin = j_const.begin();
|
||||
json::iterator it_end = j_const.end();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
|
||||
SECTION("json + cbegin/cend")
|
||||
{
|
||||
json::const_iterator it_begin = j.cbegin();
|
||||
json::const_iterator it_end = j.cend();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
|
||||
SECTION("const json + cbegin/cend")
|
||||
{
|
||||
json::const_iterator it_begin = j.cbegin();
|
||||
json::const_iterator it_end = j.cend();
|
||||
|
||||
auto it = it_begin;
|
||||
CHECK(it != it_end);
|
||||
|
||||
it++;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it != it_end);
|
||||
|
||||
++it;
|
||||
CHECK(it != it_begin);
|
||||
CHECK(it == it_end);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number (integer)")
|
||||
|
@ -2727,20 +2895,485 @@ TEST_CASE("iterators")
|
|||
|
||||
SECTION("const json + begin/end")
|
||||
{
|
||||
json::const_iterator it = j_const.begin();
|
||||
CHECK(it == j_const.end());
|
||||
json::const_iterator it_begin = j_const.begin();
|
||||
json::const_iterator it_end = j_const.end();
|
||||
CHECK(it_begin == it_end);
|
||||
}
|
||||
|
||||
SECTION("json + cbegin/cend")
|
||||
{
|
||||
json::const_iterator it = j.cbegin();
|
||||
CHECK(it == j.cend());
|
||||
json::const_iterator it_begin = j.cbegin();
|
||||
json::const_iterator it_end = j.cend();
|
||||
CHECK(it_begin == it_end);
|
||||
}
|
||||
|
||||
SECTION("const json + cbegin/cend")
|
||||
{
|
||||
json::const_iterator it = j_const.cbegin();
|
||||
CHECK(it == j_const.cend());
|
||||
json::const_iterator it_begin = j_const.cbegin();
|
||||
json::const_iterator it_end = j_const.cend();
|
||||
CHECK(it_begin == it_end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("capacity")
|
||||
{
|
||||
SECTION("empty()")
|
||||
{
|
||||
SECTION("boolean")
|
||||
{
|
||||
json j = true;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == false);
|
||||
CHECK(j_const.empty() == false);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() != j.end());
|
||||
CHECK(j_const.begin() != j_const.end());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("string")
|
||||
{
|
||||
json j = "hello world";
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == false);
|
||||
CHECK(j_const.empty() == false);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() != j.end());
|
||||
CHECK(j_const.begin() != j_const.end());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("array")
|
||||
{
|
||||
SECTION("empty array")
|
||||
{
|
||||
json j = json::array();
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == true);
|
||||
CHECK(j_const.empty() == true);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() == j.end());
|
||||
CHECK(j_const.begin() == j_const.end());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("filled array")
|
||||
{
|
||||
json j = {1, 2, 3};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == false);
|
||||
CHECK(j_const.empty() == false);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() != j.end());
|
||||
CHECK(j_const.begin() != j_const.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("object")
|
||||
{
|
||||
SECTION("empty object")
|
||||
{
|
||||
json j = json::object();
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == true);
|
||||
CHECK(j_const.empty() == true);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() == j.end());
|
||||
CHECK(j_const.begin() == j_const.end());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("filled object")
|
||||
{
|
||||
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == false);
|
||||
CHECK(j_const.empty() == false);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() != j.end());
|
||||
CHECK(j_const.begin() != j_const.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number (integer)")
|
||||
{
|
||||
json j = 23;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == false);
|
||||
CHECK(j_const.empty() == false);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() != j.end());
|
||||
CHECK(j_const.begin() != j_const.end());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number (float)")
|
||||
{
|
||||
json j = 23.42;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == false);
|
||||
CHECK(j_const.empty() == false);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() != j.end());
|
||||
CHECK(j_const.begin() != j_const.end());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("null")
|
||||
{
|
||||
json j = nullptr;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of empty")
|
||||
{
|
||||
CHECK(j.empty() == true);
|
||||
CHECK(j_const.empty() == true);
|
||||
}
|
||||
|
||||
SECTION("definition of empty")
|
||||
{
|
||||
CHECK(j.begin() == j.end());
|
||||
CHECK(j_const.begin() == j_const.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("size()")
|
||||
{
|
||||
SECTION("boolean")
|
||||
{
|
||||
json j = true;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 1);
|
||||
CHECK(j_const.size() == 1);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("string")
|
||||
{
|
||||
json j = "hello world";
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 1);
|
||||
CHECK(j_const.size() == 1);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("array")
|
||||
{
|
||||
SECTION("empty array")
|
||||
{
|
||||
json j = json::array();
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 0);
|
||||
CHECK(j_const.size() == 0);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("filled array")
|
||||
{
|
||||
json j = {1, 2, 3};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 3);
|
||||
CHECK(j_const.size() == 3);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("object")
|
||||
{
|
||||
SECTION("empty object")
|
||||
{
|
||||
json j = json::object();
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 0);
|
||||
CHECK(j_const.size() == 0);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("filled object")
|
||||
{
|
||||
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 3);
|
||||
CHECK(j_const.size() == 3);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number (integer)")
|
||||
{
|
||||
json j = 23;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 1);
|
||||
CHECK(j_const.size() == 1);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number (float)")
|
||||
{
|
||||
json j = 23.42;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 1);
|
||||
CHECK(j_const.size() == 1);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("null")
|
||||
{
|
||||
json j = nullptr;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of size")
|
||||
{
|
||||
CHECK(j.size() == 0);
|
||||
CHECK(j_const.size() == 0);
|
||||
}
|
||||
|
||||
SECTION("definition of size")
|
||||
{
|
||||
CHECK(std::distance(j.begin(), j.end()) == j.size());
|
||||
CHECK(std::distance(j_const.begin(), j_const.end()) == j_const.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("max_size()")
|
||||
{
|
||||
SECTION("boolean")
|
||||
{
|
||||
json j = true;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() == 1);
|
||||
CHECK(j_const.max_size() == 1);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("string")
|
||||
{
|
||||
json j = "hello world";
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() == 1);
|
||||
CHECK(j_const.max_size() == 1);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("array")
|
||||
{
|
||||
SECTION("empty array")
|
||||
{
|
||||
json j = json::array();
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() >= j.size());
|
||||
CHECK(j_const.max_size() >= j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("filled array")
|
||||
{
|
||||
json j = {1, 2, 3};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() >= j.size());
|
||||
CHECK(j_const.max_size() >= j_const.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("object")
|
||||
{
|
||||
SECTION("empty object")
|
||||
{
|
||||
json j = json::object();
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() >= j.size());
|
||||
CHECK(j_const.max_size() >= j_const.size());
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("filled object")
|
||||
{
|
||||
json j = {{"one", 1}, {"two", 2}, {"three", 3}};
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() >= j.size());
|
||||
CHECK(j_const.max_size() >= j_const.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number (integer)")
|
||||
{
|
||||
json j = 23;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() == 1);
|
||||
CHECK(j_const.max_size() == 1);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("number (float)")
|
||||
{
|
||||
json j = 23.42;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() == 1);
|
||||
CHECK(j_const.max_size() == 1);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("null")
|
||||
{
|
||||
json j = nullptr;
|
||||
json j_const(j);
|
||||
|
||||
SECTION("result of max_size")
|
||||
{
|
||||
CHECK(j.max_size() == 0);
|
||||
CHECK(j_const.max_size() == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue