[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] How did this unit test fail?
From: |
Greg Chicares |
Subject: |
[lmi] How did this unit test fail? |
Date: |
Mon, 19 Mar 2018 21:13:08 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
When I tested my last set of commits carefully before pushing, I was
really surprised to see that 'bourn_cast_test' failed (without the
change that I sneaked into 'bourn_cast_test.cpp' in commit 3d3e2b6).
Reverting those changes to that file only, which amount only to this:
- stifle_warning_for_unused_variable(z);
+ (void)&z;
in two places, reproduces the error, which is:
???? test failed:
???? test failed: 0
[invoked from file /opt/lmi/src/lmi/bourn_cast_test.cpp, line: 781]
[file /opt/lmi/src/lmi/bourn_cast_test.cpp, line 261]
The relevant lines are:
260 INVOKE_BOOST_TEST(!std::signbit(bourn_cast<To>( From(0))), file, line);
261 INVOKE_BOOST_TEST( std::signbit(bourn_cast<To>(-From(0))), file, line);
780 test_floating_conversions<double , long double>(__FILE__, __LINE__);
781 test_floating_conversions<long double, float >(__FILE__, __LINE__);
782 test_floating_conversions<long double, double >(__FILE__, __LINE__);
so apparently -0.0L no longer converts to -0.0F.
The only "explanation" I can come up with is the 'miscellany.hpp'
change in that commit somehow broke the test. The only change that
seems relevant is that I #included <limits> and used min() and max()
in an inline ctor for class minmax (which isn't used by bourn_cast<>
or its system test).
Accordingly, my first attempt at circumventing the test failure was to
(1) write stifle_warning_for_unused_variable() inline instead of using
it directly in 'bourn_cast_test.cpp' (as in 3d3e2b6); and
(2) remove "#include miscellany.hpp" from 'bourn_cast_test.cpp'.
That worked: the test no longer failed. Supposing that including the
<limits> header was the problem, I tried #including it in the unit-
test TU...and that didn't make the test fail. Then I tried including
"miscellany.hpp"--i.e., making change (1) but not change (2) above--
and even that didn't make the test fail.
Anyway, I committed it with (1) only, because that's the minimal
change that doesn't break the unit test. I suppose I could separate
class minmax out into its own header independent of "miscellany.hpp",
but I don't like voodoo workarounds for problems I don't understand.
Vadim--I can't guess what went wrong here. Can you see it?
- [lmi] How did this unit test fail?,
Greg Chicares <=
- Re: [lmi] How did this unit test fail?, Vadim Zeitlin, 2018/03/19
- Message not available
- Re: [lmi] Fwd: How did this unit test fail?, Vadim Zeitlin, 2018/03/22
- Re: [lmi] Fwd: How did this unit test fail?, Greg Chicares, 2018/03/22
- Re: [lmi] Fwd: How did this unit test fail?, Vadim Zeitlin, 2018/03/22
- Re: [lmi] Fwd: How did this unit test fail?, Vadim Zeitlin, 2018/03/27
- Re: [lmi] Fwd: How did this unit test fail?, Greg Chicares, 2018/03/27
- Re: [lmi] Fwd: How did this unit test fail?, Vadim Zeitlin, 2018/03/27