Skip to content

Commit a284cbb

Browse files
authored
Run every trace test in both fast and exhaustive modes (#684)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 9afc5f4 commit a284cbb

File tree

9 files changed

+7830
-3993
lines changed

9 files changed

+7830
-3993
lines changed

test/evaluator/evaluator_2019_09.json

Lines changed: 1689 additions & 890 deletions
Large diffs are not rendered by default.

test/evaluator/evaluator_2020_12.json

Lines changed: 197 additions & 231 deletions
Large diffs are not rendered by default.

test/evaluator/evaluator_draft4.json

Lines changed: 4152 additions & 2500 deletions
Large diffs are not rendered by default.

test/evaluator/evaluator_draft4_test.cc

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,3 +1065,239 @@ TEST(Evaluator_draft4, multipleOf_19) {
10651065
instance, 0,
10661066
"The number value 0.3 was expected to be divisible by the number 0.1");
10671067
}
1068+
1069+
TEST(Evaluator_draft4, minimum_18) {
1070+
auto schema{sourcemeta::core::JSON::make_object()};
1071+
schema.assign_assume_new(
1072+
"$schema",
1073+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1074+
schema.assign_assume_new("minimum",
1075+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1076+
"99999999999999999999999999999999999"}});
1077+
1078+
const sourcemeta::core::JSON instance{
1079+
sourcemeta::core::Decimal{"199999999999999999999999999999999998"}};
1080+
EVALUATE_WITH_TRACE_FAST_SUCCESS(schema, instance, 1, "");
1081+
1082+
EVALUATE_TRACE_PRE(0, AssertionGreaterEqual, "/minimum", "#/minimum", "");
1083+
EVALUATE_TRACE_POST_SUCCESS(0, AssertionGreaterEqual, "/minimum", "#/minimum",
1084+
"");
1085+
1086+
EVALUATE_TRACE_POST_DESCRIBE(
1087+
instance, 0,
1088+
"The integer value 199999999999999999999999999999999998 was expected to "
1089+
"be greater than or equal to the integer "
1090+
"99999999999999999999999999999999999");
1091+
}
1092+
1093+
TEST(Evaluator_draft4, minimum_19) {
1094+
auto schema{sourcemeta::core::JSON::make_object()};
1095+
schema.assign_assume_new(
1096+
"$schema",
1097+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1098+
schema.assign_assume_new("minimum",
1099+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1100+
"99999999999999999999999999999999999"}});
1101+
1102+
const sourcemeta::core::JSON instance{
1103+
sourcemeta::core::Decimal{"99999999999999999999999999999999998"}};
1104+
EVALUATE_WITH_TRACE_FAST_FAILURE(schema, instance, 1, "");
1105+
1106+
EVALUATE_TRACE_PRE(0, AssertionGreaterEqual, "/minimum", "#/minimum", "");
1107+
EVALUATE_TRACE_POST_FAILURE(0, AssertionGreaterEqual, "/minimum", "#/minimum",
1108+
"");
1109+
1110+
EVALUATE_TRACE_POST_DESCRIBE(
1111+
instance, 0,
1112+
"The integer value 99999999999999999999999999999999998 was expected to "
1113+
"be greater than or equal to the integer "
1114+
"99999999999999999999999999999999999");
1115+
}
1116+
1117+
TEST(Evaluator_draft4, maximum_17) {
1118+
auto schema{sourcemeta::core::JSON::make_object()};
1119+
schema.assign_assume_new(
1120+
"$schema",
1121+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1122+
schema.assign_assume_new("maximum",
1123+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1124+
"99999999999999999999999999999999999"}});
1125+
1126+
const sourcemeta::core::JSON instance{
1127+
sourcemeta::core::Decimal{"99999999999999999999999999999999998"}};
1128+
EVALUATE_WITH_TRACE_FAST_SUCCESS(schema, instance, 1, "");
1129+
1130+
EVALUATE_TRACE_PRE(0, AssertionLessEqual, "/maximum", "#/maximum", "");
1131+
EVALUATE_TRACE_POST_SUCCESS(0, AssertionLessEqual, "/maximum", "#/maximum",
1132+
"");
1133+
1134+
EVALUATE_TRACE_POST_DESCRIBE(
1135+
instance, 0,
1136+
"The integer value 99999999999999999999999999999999998 was expected to "
1137+
"be less than or equal to the integer "
1138+
"99999999999999999999999999999999999");
1139+
}
1140+
1141+
TEST(Evaluator_draft4, maximum_18) {
1142+
auto schema{sourcemeta::core::JSON::make_object()};
1143+
schema.assign_assume_new(
1144+
"$schema",
1145+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1146+
schema.assign_assume_new("maximum",
1147+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1148+
"99999999999999999999999999999999999"}});
1149+
1150+
const sourcemeta::core::JSON instance{
1151+
sourcemeta::core::Decimal{"199999999999999999999999999999999998"}};
1152+
EVALUATE_WITH_TRACE_FAST_FAILURE(schema, instance, 1, "");
1153+
1154+
EVALUATE_TRACE_PRE(0, AssertionLessEqual, "/maximum", "#/maximum", "");
1155+
EVALUATE_TRACE_POST_FAILURE(0, AssertionLessEqual, "/maximum", "#/maximum",
1156+
"");
1157+
1158+
EVALUATE_TRACE_POST_DESCRIBE(
1159+
instance, 0,
1160+
"The integer value 199999999999999999999999999999999998 was expected to "
1161+
"be less than or equal to the integer "
1162+
"99999999999999999999999999999999999");
1163+
}
1164+
1165+
TEST(Evaluator_draft4, exclusiveMinimum_14) {
1166+
auto schema{sourcemeta::core::JSON::make_object()};
1167+
schema.assign_assume_new(
1168+
"$schema",
1169+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1170+
schema.assign_assume_new("minimum",
1171+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1172+
"99999999999999999999999999999999999"}});
1173+
schema.assign_assume_new("exclusiveMinimum", sourcemeta::core::JSON{true});
1174+
1175+
const sourcemeta::core::JSON instance{
1176+
sourcemeta::core::Decimal{"199999999999999999999999999999999998"}};
1177+
EVALUATE_WITH_TRACE_FAST_SUCCESS(schema, instance, 1, "");
1178+
1179+
EVALUATE_TRACE_PRE(0, AssertionGreater, "/minimum", "#/minimum", "");
1180+
EVALUATE_TRACE_POST_SUCCESS(0, AssertionGreater, "/minimum", "#/minimum", "");
1181+
1182+
EVALUATE_TRACE_POST_DESCRIBE(
1183+
instance, 0,
1184+
"The integer value 199999999999999999999999999999999998 was expected to "
1185+
"be greater than the integer 99999999999999999999999999999999999");
1186+
}
1187+
1188+
TEST(Evaluator_draft4, exclusiveMinimum_15) {
1189+
auto schema{sourcemeta::core::JSON::make_object()};
1190+
schema.assign_assume_new(
1191+
"$schema",
1192+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1193+
schema.assign_assume_new("minimum",
1194+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1195+
"99999999999999999999999999999999999"}});
1196+
schema.assign_assume_new("exclusiveMinimum", sourcemeta::core::JSON{true});
1197+
1198+
const sourcemeta::core::JSON instance{
1199+
sourcemeta::core::Decimal{"99999999999999999999999999999999999"}};
1200+
EVALUATE_WITH_TRACE_FAST_FAILURE(schema, instance, 1, "");
1201+
1202+
EVALUATE_TRACE_PRE(0, AssertionGreater, "/minimum", "#/minimum", "");
1203+
EVALUATE_TRACE_POST_FAILURE(0, AssertionGreater, "/minimum", "#/minimum", "");
1204+
1205+
EVALUATE_TRACE_POST_DESCRIBE(
1206+
instance, 0,
1207+
"The integer value 99999999999999999999999999999999999 was expected to "
1208+
"be greater than the integer 99999999999999999999999999999999999, but "
1209+
"they were equal");
1210+
}
1211+
1212+
TEST(Evaluator_draft4, exclusiveMaximum_14) {
1213+
auto schema{sourcemeta::core::JSON::make_object()};
1214+
schema.assign_assume_new(
1215+
"$schema",
1216+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1217+
schema.assign_assume_new("maximum",
1218+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1219+
"99999999999999999999999999999999999"}});
1220+
schema.assign_assume_new("exclusiveMaximum", sourcemeta::core::JSON{true});
1221+
1222+
const sourcemeta::core::JSON instance{
1223+
sourcemeta::core::Decimal{"99999999999999999999999999999999998"}};
1224+
EVALUATE_WITH_TRACE_FAST_SUCCESS(schema, instance, 1, "");
1225+
1226+
EVALUATE_TRACE_PRE(0, AssertionLess, "/maximum", "#/maximum", "");
1227+
EVALUATE_TRACE_POST_SUCCESS(0, AssertionLess, "/maximum", "#/maximum", "");
1228+
1229+
EVALUATE_TRACE_POST_DESCRIBE(
1230+
instance, 0,
1231+
"The integer value 99999999999999999999999999999999998 was expected to "
1232+
"be less than the integer 99999999999999999999999999999999999");
1233+
}
1234+
1235+
TEST(Evaluator_draft4, exclusiveMaximum_15) {
1236+
auto schema{sourcemeta::core::JSON::make_object()};
1237+
schema.assign_assume_new(
1238+
"$schema",
1239+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1240+
schema.assign_assume_new("maximum",
1241+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1242+
"99999999999999999999999999999999999"}});
1243+
schema.assign_assume_new("exclusiveMaximum", sourcemeta::core::JSON{true});
1244+
1245+
const sourcemeta::core::JSON instance{
1246+
sourcemeta::core::Decimal{"99999999999999999999999999999999999"}};
1247+
EVALUATE_WITH_TRACE_FAST_FAILURE(schema, instance, 1, "");
1248+
1249+
EVALUATE_TRACE_PRE(0, AssertionLess, "/maximum", "#/maximum", "");
1250+
EVALUATE_TRACE_POST_FAILURE(0, AssertionLess, "/maximum", "#/maximum", "");
1251+
1252+
EVALUATE_TRACE_POST_DESCRIBE(
1253+
instance, 0,
1254+
"The integer value 99999999999999999999999999999999999 was expected to "
1255+
"be less than the integer 99999999999999999999999999999999999, but they "
1256+
"were equal");
1257+
}
1258+
1259+
TEST(Evaluator_draft4, multipleOf_17) {
1260+
auto schema{sourcemeta::core::JSON::make_object()};
1261+
schema.assign_assume_new(
1262+
"$schema",
1263+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1264+
schema.assign_assume_new("multipleOf",
1265+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1266+
"99999999999999999999999999999999999"}});
1267+
1268+
const sourcemeta::core::JSON instance{
1269+
sourcemeta::core::Decimal{"299999999999999999999999999999999997"}};
1270+
EVALUATE_WITH_TRACE_FAST_SUCCESS(schema, instance, 1, "");
1271+
1272+
EVALUATE_TRACE_PRE(0, AssertionDivisible, "/multipleOf", "#/multipleOf", "");
1273+
EVALUATE_TRACE_POST_SUCCESS(0, AssertionDivisible, "/multipleOf",
1274+
"#/multipleOf", "");
1275+
1276+
EVALUATE_TRACE_POST_DESCRIBE(
1277+
instance, 0,
1278+
"The integer value 299999999999999999999999999999999997 was expected to "
1279+
"be divisible by the integer 99999999999999999999999999999999999");
1280+
}
1281+
1282+
TEST(Evaluator_draft4, multipleOf_18) {
1283+
auto schema{sourcemeta::core::JSON::make_object()};
1284+
schema.assign_assume_new(
1285+
"$schema",
1286+
sourcemeta::core::JSON{"http://json-schema.org/draft-04/schema#"});
1287+
schema.assign_assume_new("multipleOf",
1288+
sourcemeta::core::JSON{sourcemeta::core::Decimal{
1289+
"99999999999999999999999999999999999"}});
1290+
1291+
const sourcemeta::core::JSON instance{
1292+
sourcemeta::core::Decimal{"299999999999999999999999999999999998"}};
1293+
EVALUATE_WITH_TRACE_FAST_FAILURE(schema, instance, 1, "");
1294+
1295+
EVALUATE_TRACE_PRE(0, AssertionDivisible, "/multipleOf", "#/multipleOf", "");
1296+
EVALUATE_TRACE_POST_FAILURE(0, AssertionDivisible, "/multipleOf",
1297+
"#/multipleOf", "");
1298+
1299+
EVALUATE_TRACE_POST_DESCRIBE(
1300+
instance, 0,
1301+
"The integer value 299999999999999999999999999999999998 was expected to "
1302+
"be divisible by the integer 99999999999999999999999999999999999");
1303+
}

0 commit comments

Comments
 (0)