Test-More / test-more

Test2, Test::More, Test::Simple and Test::Builder Perl modules for writing tests
Other
140 stars 87 forks source link

0.000082: Failed test 'rounding' at t/modules/Compare/Float.t with long doubles #970

Open mhasch opened 6 years ago

mhasch commented 6 years ago

The test suite of Test2::Suite seems to expect larger rounding errors than there are if perl is configured with long double support. This makes tests fail on platforms with nvsize > 8. Tests for floating point comparisons should be more platform-independent.

$ perl -V:nvsize
nvsize='16';
$ perl -MTest2::Suite -le 'print Test2::Suite->VERSION'
0.000082
$ perl t/modules/Compare/Float.t
...
not ok 8 - rounding {
    ok 1 -       60.48 == 60.48 +/- 1e-08 - inside tolerance
    ok 2 -       60.48 == 60.48 +/- 1e-13 - inside tolerance
    ok 3 -       60.48 == 60.48 +/- 1e-14 - inside tolerance
    ok 4 - 125 - 64.52 == 60.48 +/- 1e-08 - inside tolerance
    ok 5 - 125 - 64.52 == 60.48 +/- 1e-13 - inside tolerance
    not ok 6 - 125 - 64.52 != 60.48 +/- 1e-14 - outside tolerance
    # Failed test '125 - 64.52 != 60.48 +/- 1e-14 - outside tolerance'
    # at t/modules/Compare/Float.t line 87.
    1..6
}
# Failed test 'rounding'
# at t/modules/Compare/Float.t line 88.
exodist commented 6 years ago

Releasing 0.000083 right now, which marks the test as TODO until @spazm can fix it (he added the feature)