5
5
#include < sourcemeta/jsonbinpack/compiler.h>
6
6
7
7
TEST (JSONBinPack_Canonicalizer_Any_2020_12, if_without_then_else_1) {
8
- auto schema = sourcemeta::core::parse (R"JSON( {
8
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
9
9
"$schema": "https://json-schema.org/draft/2020-12/schema",
10
10
"type": "object",
11
11
"if": { "minProperties": 2 }
12
12
})JSON" );
13
13
14
- sourcemeta::jsonbinpack::canonicalize (schema,
15
- sourcemeta::core::default_schema_walker ,
16
- sourcemeta::core::official_resolver);
14
+ sourcemeta::jsonbinpack::canonicalize (
15
+ schema, sourcemeta::core::schema_official_walker ,
16
+ sourcemeta::core::official_resolver);
17
17
18
- const auto expected = sourcemeta::core::parse (R"JSON( {
18
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
19
19
"$schema": "https://json-schema.org/draft/2020-12/schema",
20
20
"type": "object",
21
21
"minProperties": 0,
@@ -26,18 +26,18 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, if_without_then_else_1) {
26
26
}
27
27
28
28
TEST (JSONBinPack_Canonicalizer_Any_2020_12, then_else_without_if_1) {
29
- auto schema = sourcemeta::core::parse (R"JSON( {
29
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
30
30
"$schema": "https://json-schema.org/draft/2020-12/schema",
31
31
"type": "object",
32
32
"then": { "minProperties": 2 },
33
33
"else": { "minProperties": 3 }
34
34
})JSON" );
35
35
36
- sourcemeta::jsonbinpack::canonicalize (schema,
37
- sourcemeta::core::default_schema_walker ,
38
- sourcemeta::core::official_resolver);
36
+ sourcemeta::jsonbinpack::canonicalize (
37
+ schema, sourcemeta::core::schema_official_walker ,
38
+ sourcemeta::core::official_resolver);
39
39
40
- const auto expected = sourcemeta::core::parse (R"JSON( {
40
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
41
41
"$schema": "https://json-schema.org/draft/2020-12/schema",
42
42
"type": "object",
43
43
"minProperties": 0,
@@ -48,7 +48,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, then_else_without_if_1) {
48
48
}
49
49
50
50
TEST (JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_1) {
51
- auto schema = sourcemeta::core::parse (R"JSON( {
51
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
52
52
"$schema": "https://json-schema.org/draft/2020-12/schema",
53
53
"allOf": [
54
54
{ "type": "number" },
@@ -57,11 +57,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_1) {
57
57
]
58
58
})JSON" );
59
59
60
- sourcemeta::jsonbinpack::canonicalize (schema,
61
- sourcemeta::core::default_schema_walker ,
62
- sourcemeta::core::official_resolver);
60
+ sourcemeta::jsonbinpack::canonicalize (
61
+ schema, sourcemeta::core::schema_official_walker ,
62
+ sourcemeta::core::official_resolver);
63
63
64
- const auto expected = sourcemeta::core::parse (R"JSON( {
64
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
65
65
"$schema": "https://json-schema.org/draft/2020-12/schema",
66
66
"allOf": [
67
67
{ "type": "number", "multipleOf": 1 },
@@ -73,7 +73,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_1) {
73
73
}
74
74
75
75
TEST (JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_2) {
76
- auto schema = sourcemeta::core::parse (R"JSON( {
76
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
77
77
"$schema": "https://json-schema.org/draft/2020-12/schema",
78
78
"allOf": [
79
79
{ "type": "number" },
@@ -82,11 +82,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_2) {
82
82
]
83
83
})JSON" );
84
84
85
- sourcemeta::jsonbinpack::canonicalize (schema,
86
- sourcemeta::core::default_schema_walker ,
87
- sourcemeta::core::official_resolver);
85
+ sourcemeta::jsonbinpack::canonicalize (
86
+ schema, sourcemeta::core::schema_official_walker ,
87
+ sourcemeta::core::official_resolver);
88
88
89
- const auto expected = sourcemeta::core::parse (R"JSON( {
89
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
90
90
"$schema": "https://json-schema.org/draft/2020-12/schema",
91
91
"allOf": [
92
92
{ "type": "number", "multipleOf": 1 },
@@ -98,7 +98,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_2) {
98
98
}
99
99
100
100
TEST (JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_3) {
101
- auto schema = sourcemeta::core::parse (R"JSON( {
101
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
102
102
"$schema": "https://json-schema.org/draft/2020-12/schema",
103
103
"allOf": [
104
104
{ "type": "number" },
@@ -114,11 +114,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_3) {
114
114
]
115
115
})JSON" );
116
116
117
- sourcemeta::jsonbinpack::canonicalize (schema,
118
- sourcemeta::core::default_schema_walker ,
119
- sourcemeta::core::official_resolver);
117
+ sourcemeta::jsonbinpack::canonicalize (
118
+ schema, sourcemeta::core::schema_official_walker ,
119
+ sourcemeta::core::official_resolver);
120
120
121
- const auto expected = sourcemeta::core::parse (R"JSON( {
121
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
122
122
"$schema": "https://json-schema.org/draft/2020-12/schema",
123
123
"allOf": [
124
124
{ "type": "number", "multipleOf": 1 },
@@ -130,7 +130,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_allof_branches_3) {
130
130
}
131
131
132
132
TEST (JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_1) {
133
- auto schema = sourcemeta::core::parse (R"JSON( {
133
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
134
134
"$schema": "https://json-schema.org/draft/2020-12/schema",
135
135
"anyOf": [
136
136
{ "type": "number" },
@@ -139,11 +139,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_1) {
139
139
]
140
140
})JSON" );
141
141
142
- sourcemeta::jsonbinpack::canonicalize (schema,
143
- sourcemeta::core::default_schema_walker ,
144
- sourcemeta::core::official_resolver);
142
+ sourcemeta::jsonbinpack::canonicalize (
143
+ schema, sourcemeta::core::schema_official_walker ,
144
+ sourcemeta::core::official_resolver);
145
145
146
- const auto expected = sourcemeta::core::parse (R"JSON( {
146
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
147
147
"$schema": "https://json-schema.org/draft/2020-12/schema",
148
148
"anyOf": [
149
149
{ "type": "number", "multipleOf": 1 },
@@ -155,7 +155,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_1) {
155
155
}
156
156
157
157
TEST (JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_2) {
158
- auto schema = sourcemeta::core::parse (R"JSON( {
158
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
159
159
"$schema": "https://json-schema.org/draft/2020-12/schema",
160
160
"anyOf": [
161
161
{ "type": "number" },
@@ -164,11 +164,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_2) {
164
164
]
165
165
})JSON" );
166
166
167
- sourcemeta::jsonbinpack::canonicalize (schema,
168
- sourcemeta::core::default_schema_walker ,
169
- sourcemeta::core::official_resolver);
167
+ sourcemeta::jsonbinpack::canonicalize (
168
+ schema, sourcemeta::core::schema_official_walker ,
169
+ sourcemeta::core::official_resolver);
170
170
171
- const auto expected = sourcemeta::core::parse (R"JSON( {
171
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
172
172
"$schema": "https://json-schema.org/draft/2020-12/schema",
173
173
"anyOf": [
174
174
{ "type": "number", "multipleOf": 1 },
@@ -180,7 +180,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_2) {
180
180
}
181
181
182
182
TEST (JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_3) {
183
- auto schema = sourcemeta::core::parse (R"JSON( {
183
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
184
184
"$schema": "https://json-schema.org/draft/2020-12/schema",
185
185
"anyOf": [
186
186
{ "type": "number" },
@@ -196,11 +196,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_3) {
196
196
]
197
197
})JSON" );
198
198
199
- sourcemeta::jsonbinpack::canonicalize (schema,
200
- sourcemeta::core::default_schema_walker ,
201
- sourcemeta::core::official_resolver);
199
+ sourcemeta::jsonbinpack::canonicalize (
200
+ schema, sourcemeta::core::schema_official_walker ,
201
+ sourcemeta::core::official_resolver);
202
202
203
- const auto expected = sourcemeta::core::parse (R"JSON( {
203
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
204
204
"$schema": "https://json-schema.org/draft/2020-12/schema",
205
205
"anyOf": [
206
206
{ "type": "number", "multipleOf": 1 },
@@ -212,16 +212,16 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_3) {
212
212
}
213
213
214
214
TEST (JSONBinPack_Canonicalizer_Any_2020_12, type_union_anyof_1) {
215
- auto schema = sourcemeta::core::parse (R"JSON( {
215
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
216
216
"$schema": "https://json-schema.org/draft/2020-12/schema",
217
217
"type": [ "object", "array" ]
218
218
})JSON" );
219
219
220
- sourcemeta::jsonbinpack::canonicalize (schema,
221
- sourcemeta::core::default_schema_walker ,
222
- sourcemeta::core::official_resolver);
220
+ sourcemeta::jsonbinpack::canonicalize (
221
+ schema, sourcemeta::core::schema_official_walker ,
222
+ sourcemeta::core::official_resolver);
223
223
224
- const auto expected = sourcemeta::core::parse (R"JSON( {
224
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
225
225
"$schema": "https://json-schema.org/draft/2020-12/schema",
226
226
"anyOf": [
227
227
{
@@ -240,17 +240,17 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, type_union_anyof_1) {
240
240
}
241
241
242
242
TEST (JSONBinPack_Canonicalizer_Any_2020_12, type_union_anyof_2) {
243
- auto schema = sourcemeta::core::parse (R"JSON( {
243
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
244
244
"$schema": "https://json-schema.org/draft/2020-12/schema",
245
245
"type": [ "object", "array" ],
246
246
"maxProperties": 3
247
247
})JSON" );
248
248
249
- sourcemeta::jsonbinpack::canonicalize (schema,
250
- sourcemeta::core::default_schema_walker ,
251
- sourcemeta::core::official_resolver);
249
+ sourcemeta::jsonbinpack::canonicalize (
250
+ schema, sourcemeta::core::schema_official_walker ,
251
+ sourcemeta::core::official_resolver);
252
252
253
- const auto expected = sourcemeta::core::parse (R"JSON( {
253
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
254
254
"$schema": "https://json-schema.org/draft/2020-12/schema",
255
255
"anyOf": [
256
256
{
@@ -270,7 +270,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, type_union_anyof_2) {
270
270
}
271
271
272
272
TEST (JSONBinPack_Canonicalizer_Any_2020_12, type_union_anyof_3) {
273
- auto schema = sourcemeta::core::parse (R"JSON( {
273
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
274
274
"$schema": "https://json-schema.org/draft/2020-12/schema",
275
275
"type": "object",
276
276
"properties": {
@@ -280,11 +280,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, type_union_anyof_3) {
280
280
}
281
281
})JSON" );
282
282
283
- sourcemeta::jsonbinpack::canonicalize (schema,
284
- sourcemeta::core::default_schema_walker ,
285
- sourcemeta::core::official_resolver);
283
+ sourcemeta::jsonbinpack::canonicalize (
284
+ schema, sourcemeta::core::schema_official_walker ,
285
+ sourcemeta::core::official_resolver);
286
286
287
- const auto expected = sourcemeta::core::parse (R"JSON( {
287
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
288
288
"$schema": "https://json-schema.org/draft/2020-12/schema",
289
289
"type": "object",
290
290
"minProperties": 0,
@@ -309,15 +309,15 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, type_union_anyof_3) {
309
309
}
310
310
311
311
TEST (JSONBinPack_Canonicalizer_Any_2020_12, implicit_type_union_1) {
312
- auto schema = sourcemeta::core::parse (R"JSON( {
312
+ auto schema = sourcemeta::core::parse_json (R"JSON( {
313
313
"$schema": "https://json-schema.org/draft/2020-12/schema"
314
314
})JSON" );
315
315
316
- sourcemeta::jsonbinpack::canonicalize (schema,
317
- sourcemeta::core::default_schema_walker ,
318
- sourcemeta::core::official_resolver);
316
+ sourcemeta::jsonbinpack::canonicalize (
317
+ schema, sourcemeta::core::schema_official_walker ,
318
+ sourcemeta::core::official_resolver);
319
319
320
- const auto expected = sourcemeta::core::parse (R"JSON( {
320
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
321
321
"$schema": "https://json-schema.org/draft/2020-12/schema",
322
322
"anyOf": [
323
323
{ "enum": [ null ] },
@@ -353,11 +353,11 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, boolean_schema_1) {
353
353
sourcemeta::core::JSON schema{true };
354
354
355
355
sourcemeta::jsonbinpack::canonicalize (
356
- schema, sourcemeta::core::default_schema_walker ,
356
+ schema, sourcemeta::core::schema_official_walker ,
357
357
sourcemeta::core::official_resolver,
358
358
" https://json-schema.org/draft/2020-12/schema" );
359
359
360
- const auto expected = sourcemeta::core::parse (R"JSON( {
360
+ const auto expected = sourcemeta::core::parse_json (R"JSON( {
361
361
"anyOf": [
362
362
{ "enum": [ null ] },
363
363
{ "enum": [ false, true ] },
@@ -392,7 +392,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, boolean_schema_2) {
392
392
sourcemeta::core::JSON schema{false };
393
393
394
394
sourcemeta::jsonbinpack::canonicalize (
395
- schema, sourcemeta::core::default_schema_walker ,
395
+ schema, sourcemeta::core::schema_official_walker ,
396
396
sourcemeta::core::official_resolver,
397
397
" https://json-schema.org/draft/2020-12/schema" );
398
398
0 commit comments