diff options
author | Marco Biscaro <marcobiscaro2112@gmail.com> | 2021-04-18 01:05:04 -0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-04-18 21:41:17 +0200 |
commit | 7dc95721ee0087846d818fdc46b380ed888c1d0e (patch) | |
tree | 666789941bff4bc65238289a3a977977e315815f /AK/TestSuite.h | |
parent | 24dcd99e4b3a0538e12c9975b03c9cbfb7ff226e (diff) | |
download | serenity-7dc95721ee0087846d818fdc46b380ed888c1d0e.zip |
Tests: Fix test-math expected values
Some of the expected values in test-math were wrong, which caused some
tests to fail.
The updated values were generated by Python's math library, and rounded
to 6 decimals places:
>>> import math
>>> round(math.exp(20.99), 6)
1305693298.670892
Examples of failure outputs:
FAIL: ../Userland/Tests/LibM/test-math.cpp:98:
EXPECT_APPROXIMATE(exp(v.x), v.exp) failed with
lhs=1305693298.670892, rhs=1304956710.432034, (lhs-rhs)=736588.238857
FAIL: ../Userland/Tests/LibM/test-math.cpp:99:
EXPECT_APPROXIMATE(sinh(v.x), v.sinh) failed with
lhs=652846649.335446, rhs=652478355.216017, (lhs-rhs)=368294.119428
FAIL: ../Userland/Tests/LibM/test-math.cpp:100:
EXPECT_APPROXIMATE(cosh(v.x), v.cosh) failed with
lhs=652846649.335446, rhs=652478355.216017, (lhs-rhs)=368294.119429
Diffstat (limited to 'AK/TestSuite.h')
-rw-r--r-- | AK/TestSuite.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/AK/TestSuite.h b/AK/TestSuite.h index c2cac55543..7c56c61b4d 100644 --- a/AK/TestSuite.h +++ b/AK/TestSuite.h @@ -330,7 +330,7 @@ using AK::TestSuite; auto expect_close_lhs = a; \ auto expect_close_rhs = b; \ auto expect_close_diff = static_cast<double>(expect_close_lhs) - static_cast<double>(expect_close_rhs); \ - if (abs(expect_close_diff) >= 0.000001) { \ + if (fabs(expect_close_diff) > 0.0000005) { \ warnln("\033[31;1mFAIL\033[0m: {}:{}: EXPECT_APPROXIMATE({}, {})" \ " failed with lhs={}, rhs={}, (lhs-rhs)={}", \ __FILE__, __LINE__, #a, #b, expect_close_lhs, expect_close_rhs, expect_close_diff); \ |