Subject: | [PATCH] Test failures with Perl built with 64bitint |
When testing YAML::Syck on a Perl built with -Duse64bitint, the
following test failures occur.
t/json-basic................NOK 9/126
# Failed test 'roundtrip 2.1 -> '2.10000000000000009' ->
2.10000000000000009'
# at t/json-basic.t line 71.
# got: '2.10000000000000009'
# expected: '2.1'
t/json-basic................NOK 15/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic................NOK 17/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic................NOK 51/126
# Failed test 'roundtrip 2.1 -> '2.10000000000000009' ->
2.10000000000000009'
# at t/json-basic.t line 71.
# got: '2.10000000000000009'
# expected: '2.1'
t/json-basic................NOK 57/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic................NOK 59/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic................NOK 89/126
# Failed test 'roundtrip 2.1 -> '2.10000000000000009' ->
2.10000000000000009'
# at t/json-basic.t line 71.
# got: '2.10000000000000009'
# expected: '2.1'
t/json-basic................NOK 92/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic................NOK 93/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic................NOK 110/126
# Failed test 'roundtrip 2.1 -> '2.10000000000000009' ->
2.10000000000000009'
# at t/json-basic.t line 71.
# got: '2.10000000000000009'
# expected: '2.1'
t/json-basic................NOK 113/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
t/json-basic................NOK 114/126
# Failed test 'roundtrip [1.1,2.2,3.3] ->
['1.10000000000000009','2.20000000000000018','3.29999999999999982'] ->
[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# at t/json-basic.t line 71.
# got:
'[1.10000000000000009,2.20000000000000018,3.29999999999999982]'
# expected: '[1.1,2.2,3.3]'
# Looks like you failed 12 tests of 126.
t/json-basic................dubious
Test returned status 12 (wstat 3072, 0xc00)
DIED. FAILED tests 9, 15, 17, 51, 57, 59, 89, 92-93, 110, 113-114
Failed 12/126 tests, 90.48% okay
Due to the increased digits, rounding errors creep into the the tests.
The obvious solution is to simply remove these tests to prevent the
rounding errors.
--- t/json-basic.t.old Wed Nov 21 09:45:34 2007
+++ t/json-basic.t Wed Nov 21 09:49:55 2007
@@ -24,11 +24,8 @@
'[1, 2, 3]',
'[1, 2, 3]',
'2',
- '2.1',
'"foo\'bar"',
'[1,2,3]',
- '[1.1, 2.2, 3.3]',
- '[1.1,2.2,3.3]',
'{"foo": "bar"}',
'{"foo":"bar"}',
'[{"foo": 2}, {"foo": "bar"}]',