Skip to content

Commit 52b80f3

Browse files
authored
Exercise precise doubles in the test suite as much as possible (#2034)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 8734a58 commit 52b80f3

13 files changed

+60
-61
lines changed

test/alterschema/alterschema_lint_2019_09_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ TEST(AlterSchema_lint_2019_09, maximum_real_for_integer_1) {
10611061
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
10621062
"$schema": "https://json-schema.org/draft/2019-09/schema",
10631063
"type": "integer",
1064-
"maximum": 3.2
1064+
"maximum": 3.5
10651065
})JSON");
10661066

10671067
LINT_AND_FIX_FOR_READABILITY(document);
@@ -1079,7 +1079,7 @@ TEST(AlterSchema_lint_2019_09, minimum_real_for_integer_1) {
10791079
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
10801080
"$schema": "https://json-schema.org/draft/2019-09/schema",
10811081
"type": "integer",
1082-
"minimum": 3.2
1082+
"minimum": 3.5
10831083
})JSON");
10841084

10851085
LINT_AND_FIX_FOR_READABILITY(document);

test/alterschema/alterschema_lint_2020_12_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ TEST(AlterSchema_lint_2020_12, maximum_real_for_integer_1) {
861861
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
862862
"$schema": "https://json-schema.org/draft/2020-12/schema",
863863
"type": "integer",
864-
"maximum": 3.2
864+
"maximum": 3.5
865865
})JSON");
866866

867867
LINT_AND_FIX_FOR_READABILITY(document);
@@ -879,7 +879,7 @@ TEST(AlterSchema_lint_2020_12, minimum_real_for_integer_1) {
879879
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
880880
"$schema": "https://json-schema.org/draft/2020-12/schema",
881881
"type": "integer",
882-
"minimum": 3.2
882+
"minimum": 3.5
883883
})JSON");
884884

885885
LINT_AND_FIX_FOR_READABILITY(document);

test/alterschema/alterschema_lint_draft1_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ TEST(AlterSchema_lint_draft1, maximum_real_for_integer_1) {
432432
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
433433
"$schema": "http://json-schema.org/draft-01/schema#",
434434
"type": "integer",
435-
"maximum": 3.2
435+
"maximum": 3.5
436436
})JSON");
437437

438438
LINT_AND_FIX_FOR_READABILITY(document);
@@ -450,7 +450,7 @@ TEST(AlterSchema_lint_draft1, minimum_real_for_integer_1) {
450450
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
451451
"$schema": "http://json-schema.org/draft-01/schema#",
452452
"type": "integer",
453-
"minimum": 3.2
453+
"minimum": 3.5
454454
})JSON");
455455

456456
LINT_AND_FIX_FOR_READABILITY(document);

test/alterschema/alterschema_lint_draft2_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ TEST(AlterSchema_lint_draft2, maximum_real_for_integer_1) {
432432
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
433433
"$schema": "http://json-schema.org/draft-02/schema#",
434434
"type": "integer",
435-
"maximum": 3.2
435+
"maximum": 3.5
436436
})JSON");
437437

438438
LINT_AND_FIX_FOR_READABILITY(document);
@@ -450,7 +450,7 @@ TEST(AlterSchema_lint_draft2, minimum_real_for_integer_1) {
450450
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
451451
"$schema": "http://json-schema.org/draft-02/schema#",
452452
"type": "integer",
453-
"minimum": 3.2
453+
"minimum": 3.5
454454
})JSON");
455455

456456
LINT_AND_FIX_FOR_READABILITY(document);

test/alterschema/alterschema_lint_draft3_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ TEST(AlterSchema_lint_draft3, maximum_real_for_integer_1) {
432432
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
433433
"$schema": "http://json-schema.org/draft-03/schema#",
434434
"type": "integer",
435-
"maximum": 3.2
435+
"maximum": 3.5
436436
})JSON");
437437

438438
LINT_AND_FIX_FOR_READABILITY(document);
@@ -450,7 +450,7 @@ TEST(AlterSchema_lint_draft3, minimum_real_for_integer_1) {
450450
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
451451
"$schema": "http://json-schema.org/draft-03/schema#",
452452
"type": "integer",
453-
"minimum": 3.2
453+
"minimum": 3.5
454454
})JSON");
455455

456456
LINT_AND_FIX_FOR_READABILITY(document);

test/alterschema/alterschema_lint_draft4_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ TEST(AlterSchema_lint_draft4, maximum_real_for_integer_1) {
540540
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
541541
"$schema": "http://json-schema.org/draft-04/schema#",
542542
"type": "integer",
543-
"maximum": 3.2
543+
"maximum": 3.5
544544
})JSON");
545545

546546
LINT_AND_FIX_FOR_READABILITY(document);
@@ -558,7 +558,7 @@ TEST(AlterSchema_lint_draft4, minimum_real_for_integer_1) {
558558
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
559559
"$schema": "http://json-schema.org/draft-04/schema#",
560560
"type": "integer",
561-
"minimum": 3.2
561+
"minimum": 3.5
562562
})JSON");
563563

564564
LINT_AND_FIX_FOR_READABILITY(document);

test/alterschema/alterschema_lint_draft6_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ TEST(AlterSchema_lint_draft6, maximum_real_for_integer_1) {
728728
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
729729
"$schema": "http://json-schema.org/draft-06/schema#",
730730
"type": "integer",
731-
"maximum": 3.2
731+
"maximum": 3.5
732732
})JSON");
733733

734734
LINT_AND_FIX_FOR_READABILITY(document);
@@ -746,7 +746,7 @@ TEST(AlterSchema_lint_draft6, minimum_real_for_integer_1) {
746746
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
747747
"$schema": "http://json-schema.org/draft-06/schema#",
748748
"type": "integer",
749-
"minimum": 3.2
749+
"minimum": 3.5
750750
})JSON");
751751

752752
LINT_AND_FIX_FOR_READABILITY(document);

test/alterschema/alterschema_lint_draft7_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ TEST(AlterSchema_lint_draft7, maximum_real_for_integer_1) {
826826
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
827827
"$schema": "http://json-schema.org/draft-07/schema#",
828828
"type": "integer",
829-
"maximum": 3.2
829+
"maximum": 3.5
830830
})JSON");
831831

832832
LINT_AND_FIX_FOR_READABILITY(document);
@@ -844,7 +844,7 @@ TEST(AlterSchema_lint_draft7, minimum_real_for_integer_1) {
844844
sourcemeta::core::JSON document = sourcemeta::core::parse_json(R"JSON({
845845
"$schema": "http://json-schema.org/draft-07/schema#",
846846
"type": "integer",
847-
"minimum": 3.2
847+
"minimum": 3.5
848848
})JSON");
849849

850850
LINT_AND_FIX_FOR_READABILITY(document);

test/json/json_number_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,20 +220,20 @@ TEST(JSON_number, add_integer_real_within_object) {
220220

221221
TEST(JSON_number, add_real_integer_within_object) {
222222
sourcemeta::core::JSON document =
223-
sourcemeta::core::parse_json("{\"foo\": 3.2}");
223+
sourcemeta::core::parse_json("{\"foo\": 3.5}");
224224
const sourcemeta::core::JSON value{2};
225225
document.at("foo") += value;
226226
EXPECT_TRUE(document.at("foo").is_real());
227-
EXPECT_EQ(document.at("foo").to_real(), 5.2);
227+
EXPECT_EQ(document.at("foo").to_real(), 5.5);
228228
}
229229

230230
TEST(JSON_number, add_real_real_within_object) {
231231
sourcemeta::core::JSON document =
232-
sourcemeta::core::parse_json("{\"foo\": 3.2}");
232+
sourcemeta::core::parse_json("{\"foo\": 3.5}");
233233
const sourcemeta::core::JSON value{2.0};
234234
document.at("foo") += value;
235235
EXPECT_TRUE(document.at("foo").is_real());
236-
EXPECT_EQ(document.at("foo").to_real(), 5.2);
236+
EXPECT_EQ(document.at("foo").to_real(), 5.5);
237237
}
238238

239239
TEST(JSON_number, divisible_by_integer_integer_true) {

test/json/json_parse_callback_test.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ TEST(JSON_parse_callback, integer) {
9494
}
9595

9696
TEST(JSON_parse_callback, real) {
97-
const auto input{"3.14"};
97+
const auto input{"3.5"};
9898
PARSE_WITH_TRACES(document, input, 2);
9999
EXPECT_TRACE(0, Pre, Real, 1, 1, sourcemeta::core::JSON{nullptr});
100-
EXPECT_TRACE(1, Post, Real, 1, 4, sourcemeta::core::JSON{3.14});
100+
EXPECT_TRACE(1, Post, Real, 1, 3, sourcemeta::core::JSON{3.5});
101101
}
102102

103103
TEST(JSON_parse_callback, empty_array) {
@@ -153,13 +153,13 @@ TEST(JSON_parse_callback, array_integers) {
153153
}
154154

155155
TEST(JSON_parse_callback, array_reals) {
156-
const auto input{"[\n 1.0,\n 2.34\n]"};
156+
const auto input{"[\n 1.0,\n 2.5\n]"};
157157
PARSE_WITH_TRACES(document, input, 6);
158158
EXPECT_TRACE(0, Pre, Array, 1, 1, sourcemeta::core::JSON{nullptr});
159159
EXPECT_TRACE(1, Pre, Real, 2, 3, sourcemeta::core::JSON{0});
160160
EXPECT_TRACE(2, Post, Real, 2, 5, sourcemeta::core::JSON{1.0});
161161
EXPECT_TRACE(3, Pre, Real, 3, 3, sourcemeta::core::JSON{1});
162-
EXPECT_TRACE(4, Post, Real, 3, 6, sourcemeta::core::JSON{2.34});
162+
EXPECT_TRACE(4, Post, Real, 3, 5, sourcemeta::core::JSON{2.5});
163163
EXPECT_TRACE(5, Post, Array, 4, 1, sourcemeta::core::parse_json(input));
164164
}
165165

@@ -237,13 +237,13 @@ TEST(JSON_parse_callback, object_integers) {
237237
}
238238

239239
TEST(JSON_parse_callback, object_reals) {
240-
const auto input{"{\n \"foo\": 1.0,\n \"bar\": 2.34\n}"};
240+
const auto input{"{\n \"foo\": 1.0,\n \"bar\": 2.5\n}"};
241241
PARSE_WITH_TRACES(document, input, 6);
242242
EXPECT_TRACE(0, Pre, Object, 1, 1, sourcemeta::core::JSON{nullptr});
243243
EXPECT_TRACE(1, Pre, Real, 2, 3, sourcemeta::core::JSON{"foo"});
244244
EXPECT_TRACE(2, Post, Real, 2, 12, sourcemeta::core::JSON{1.0});
245245
EXPECT_TRACE(3, Pre, Real, 3, 3, sourcemeta::core::JSON{"bar"});
246-
EXPECT_TRACE(4, Post, Real, 3, 13, sourcemeta::core::JSON{2.34});
246+
EXPECT_TRACE(4, Post, Real, 3, 12, sourcemeta::core::JSON{2.5});
247247
EXPECT_TRACE(5, Post, Object, 4, 1, sourcemeta::core::parse_json(input));
248248
}
249249

0 commit comments

Comments
 (0)