Skip to content

Commit 5719f40

Browse files
authored
Merge pull request #685 from cppalliance/test_coverage
Improve testing coverage
2 parents 84d31e4 + 4ed4b02 commit 5719f40

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

test/compare_dec128_and_fast.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ void test_mul()
205205

206206
if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
207207
{
208+
// LCOV_EXCL_START
209+
208210
std::cerr << std::setprecision(35)
209211
<< "Val 1: " << val1
210212
<< "\nVal 2: " << val2
@@ -214,6 +216,8 @@ void test_mul()
214216
<< "\nDecfast 1: " << dec128_fast_1
215217
<< "\nDecfast 2: " << dec128_fast_2
216218
<< "\nDecfast res: " << dec128_fast_res << std::endl;
219+
220+
// LCOV_EXCL_STOP
217221
}
218222
}
219223

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

235239
if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
236240
{
241+
// LCOV_EXCL_START
242+
237243
std::cerr << std::setprecision(35)
238244
<< "Val 1: " << val1
239245
<< "\nVal 2: " << val2
@@ -243,6 +249,8 @@ void test_mul()
243249
<< "\nDecfast 1: " << dec128_fast_1
244250
<< "\nDecfast 2: " << dec128_fast_2
245251
<< "\nDecfast res: " << dec128_fast_res << std::endl;
252+
253+
// LCOV_EXCL_STOP
246254
}
247255
}
248256
}
@@ -266,6 +274,8 @@ void test_div()
266274

267275
if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
268276
{
277+
// LCOV_EXCL_START
278+
269279
std::cerr << std::setprecision(35)
270280
<< "Val 1: " << val1
271281
<< "\nVal 2: " << val2
@@ -275,6 +285,8 @@ void test_div()
275285
<< "\nDecfast 1: " << dec128_fast_1
276286
<< "\nDecfast 2: " << dec128_fast_2
277287
<< "\nDecfast res: " << dec128_fast_res << std::endl;
288+
289+
// LCOV_EXCL_STOP
278290
}
279291
}
280292

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

296308
if (!BOOST_TEST_EQ(static_cast<double>(dec128_res), static_cast<double>(dec128_fast_res)))
297309
{
310+
// LCOV_EXCL_START
311+
298312
std::cerr << std::setprecision(35)
299313
<< "Val 1: " << val1
300314
<< "\nVal 2: " << val2
@@ -304,6 +318,8 @@ void test_div()
304318
<< "\nDecfast 1: " << dec128_fast_1
305319
<< "\nDecfast 2: " << dec128_fast_2
306320
<< "\nDecfast res: " << dec128_fast_res << std::endl;
321+
322+
// LCOV_EXCL_STOP
307323
}
308324
}
309325
}

test/random_decimal128_fast_math.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void random_multiplication(T lower, T upper)
241241

242242
if (val1 * val2 == 0)
243243
{
244-
continue;
244+
continue; // LCOV_EXCL_LINE
245245
}
246246

247247
if (!BOOST_TEST_EQ(res, res_int))

test/test_cmath.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,8 @@ void test_lrint()
802802
// Difference in rounding mode at 0.5
803803
if (abs(ret_dec) == abs(ret_val) + 1)
804804
{
805+
// LCOV_EXCL_START
806+
805807
float iptr;
806808
const auto frac = std::modf(val1, &iptr);
807809
if (abs(abs(frac) - 0.5F) < 0.01F)
@@ -810,11 +812,11 @@ void test_lrint()
810812
}
811813
else
812814
{
813-
// LCOV_EXCL_START
814815
std::cerr << "Frac: " << frac
815816
<< "\nDist: " << std::fabs(frac - 0.5F) / std::numeric_limits<float>::epsilon() << std::endl;
816-
// LCOV_EXCL_STOP
817817
}
818+
819+
// LCOV_EXCL_STOP
818820
}
819821

820822
if (!BOOST_TEST_EQ(ret_val, ret_dec))

0 commit comments

Comments
 (0)