On 2018-03-09 05:06 +0000, Wookey wrote: > > Changing the tests to this: > CHECK_THROWS( WallsSurveyParser("360.00001").azimuth(Angle::Degrees) > ); > CHECK_THROWS( WallsSurveyParser("-0.00001").azimuth(Angle::Degrees) ); > CHECK_THROWS( > WallsSurveyParser("400.00001g").azimuth(Angle::Gradians) ); > CHECK_THROWS( WallsSurveyParser("-0.00001g").azimuth(Angle::Gradians) > ); > CHECK_THROWS( WallsSurveyParser("N90.00001E").azimuth(Angle::Degrees) > ); > CHECK_THROWS( > WallsSurveyParser("N100.00001gE").azimuth(Angle::Gradians) ); > > makes them all pass. Which strongly suggsts that this really is a > rounding problem on i386. I could experiment further to try and > determine the size of the rounding error.
One more zero and we are back to failing: /home/wookey/dewalls-1.0.0+ds1/test/azimuthparsingtests.cpp:64: FAILED: CHECK_THROWS( WallsSurveyParser("360.000001").azimuth(Angle::Degrees) ) because no exception was thrown where one was expected: /home/wookey/dewalls-1.0.0+ds1/test/azimuthparsingtests.cpp:66: FAILED: CHECK_THROWS( WallsSurveyParser("400.000001g").azimuth(Angle::Gradians) ) because no exception was thrown where one was expected: /home/wookey/dewalls-1.0.0+ds1/test/azimuthparsingtests.cpp:68: FAILED: CHECK_THROWS( WallsSurveyParser("N90.000001E").azimuth(Angle::Degrees) ) because no exception was thrown where one was expected: /home/wookey/dewalls-1.0.0+ds1/test/azimuthparsingtests.cpp:69: FAILED: CHECK_THROWS( WallsSurveyParser("N100.000001gE").azimuth(Angle::Gradians) ) because no exception was thrown where one was expected: =============================================================================== test cases: 8 | 7 passed | 1 failed assertions: 2729 | 2725 passed | 4 failed I see that catch provides mechanisms for allowing for epsilon in floating-point comparisons: https://github.com/catchorg/Catch2/blob/master/docs/assertions.md#natural-expressions however it's not catch doing the comparison here so that doesn't help. dewalls needs to make the allowance. Strictly speaking this shouldn't be an f.p. test for 'value too high' - it should be a string test for 'inadmissible number' - i.e the cutoff is absolute and not subject to epsilon. I'm going to leave the test value adjusted so that the throw actually triggers for now, as a functioning workaround. Wookey -- Principal hats: Linaro, Debian, Wookware, ARM http://wookware.org/
signature.asc
Description: PGP signature