Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve testing coverage #685

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/compare_dec128_and_fast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ void test_mul()

if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
{
// LCOV_EXCL_START

std::cerr << std::setprecision(35)
<< "Val 1: " << val1
<< "\nVal 2: " << val2
Expand All @@ -214,6 +216,8 @@ void test_mul()
<< "\nDecfast 1: " << dec128_fast_1
<< "\nDecfast 2: " << dec128_fast_2
<< "\nDecfast res: " << dec128_fast_res << std::endl;

// LCOV_EXCL_STOP
}
}

Expand All @@ -234,6 +238,8 @@ void test_mul()

if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
{
// LCOV_EXCL_START

std::cerr << std::setprecision(35)
<< "Val 1: " << val1
<< "\nVal 2: " << val2
Expand All @@ -243,6 +249,8 @@ void test_mul()
<< "\nDecfast 1: " << dec128_fast_1
<< "\nDecfast 2: " << dec128_fast_2
<< "\nDecfast res: " << dec128_fast_res << std::endl;

// LCOV_EXCL_STOP
}
}
}
Expand All @@ -266,6 +274,8 @@ void test_div()

if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
{
// LCOV_EXCL_START

std::cerr << std::setprecision(35)
<< "Val 1: " << val1
<< "\nVal 2: " << val2
Expand All @@ -275,6 +285,8 @@ void test_div()
<< "\nDecfast 1: " << dec128_fast_1
<< "\nDecfast 2: " << dec128_fast_2
<< "\nDecfast res: " << dec128_fast_res << std::endl;

// LCOV_EXCL_STOP
}
}

Expand All @@ -295,6 +307,8 @@ void test_div()

if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
{
// LCOV_EXCL_START

std::cerr << std::setprecision(35)
<< "Val 1: " << val1
<< "\nVal 2: " << val2
Expand All @@ -304,6 +318,8 @@ void test_div()
<< "\nDecfast 1: " << dec128_fast_1
<< "\nDecfast 2: " << dec128_fast_2
<< "\nDecfast res: " << dec128_fast_res << std::endl;

// LCOV_EXCL_STOP
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/random_decimal128_fast_math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void random_multiplication(T lower, T upper)

if (val1 * val2 == 0)
{
continue;
continue; // LCOV_EXCL_LINE
}

if (!BOOST_TEST_EQ(res, res_int))
Expand Down
6 changes: 4 additions & 2 deletions test/test_cmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,8 @@ void test_lrint()
// Difference in rounding mode at 0.5
if (abs(ret_dec) == abs(ret_val) + 1)
{
// LCOV_EXCL_START

float iptr;
const auto frac = std::modf(val1, &iptr);
if (abs(abs(frac) - 0.5F) < 0.01F)
Expand All @@ -810,11 +812,11 @@ void test_lrint()
}
else
{
// LCOV_EXCL_START
std::cerr << "Frac: " << frac
<< "\nDist: " << std::fabs(frac - 0.5F) / std::numeric_limits<float>::epsilon() << std::endl;
// LCOV_EXCL_STOP
}

// LCOV_EXCL_STOP
}

if (!BOOST_TEST_EQ(ret_val, ret_dec))
Expand Down
Loading