Opened 12 years ago

Closed 12 years ago

#4785 closed Bugs (fixed)

test_output fails on systems that don't zero-fill the exponent to three digits

Reported by: Jim Bell <jim@…> Owned by: Steven Watanabe
Milestone: Boost 1.45.0 Component: units
Version: Boost Development Trunk Severity: Regression
Keywords: Cc: jim@…

Description

test_output fails to match strings exactly on systems that don't zero-fill the exponent in scientific notation to three digits, or boost::units::engineering_prefix doesn't set that explicitly as it should. So you get

"9.99999e-25 meter" != "9.99999e-025 meter"

even though those two values are clearly the same.

If controlling this is as difficult as it seems to be (see here), you could change the comparison to a regex_match with the regex

"9\.99999e-0?25 meter"

Run [2010-10-23 06:57:11 UTC]: fail

Running 14 test cases...
../libs/units/test/test_output.cpp(280): error in "test_output_autoprefixed_quantity_name": check ss.str() == "9.99999e-025 meter" failed [9.99999e-25 meter != 9.99999e-025 meter]
../libs/units/test/test_output.cpp(280): error in "test_output_autoprefixed_quantity_name": check ss.str() == L"9.99999e-025 meter" failed
../libs/units/test/test_output.cpp(281): error in "test_output_autoprefixed_quantity_name": check ss.str() == "1e+028 meter" failed [1e+28 meter != 1e+028 meter]
../libs/units/test/test_output.cpp(281): error in "test_output_autoprefixed_quantity_name": check ss.str() == L"1e+028 meter" failed
../libs/units/test/test_output.cpp(282): error in "test_output_autoprefixed_quantity_name": check ss.str() == "1.5e-025 meter" failed [1.5e-25 meter != 1.5e-025 meter]
../libs/units/test/test_output.cpp(282): error in "test_output_autoprefixed_quantity_name": check ss.str() == L"1.5e-025 meter" failed
../libs/units/test/test_output.cpp(283): error in "test_output_autoprefixed_quantity_name": check ss.str() == "1.5e+028 meter" failed [1.5e+28 meter != 1.5e+028 meter]
../libs/units/test/test_output.cpp(283): error in "test_output_autoprefixed_quantity_name": check ss.str() == L"1.5e+028 meter" failed
../libs/units/test/test_output.cpp(285): error in "test_output_autoprefixed_quantity_name": check ss.str() == "3.40282e+038 meter" failed [3.40282e+38 meter != 3.40282e+038 meter]
../libs/units/test/test_output.cpp(285): error in "test_output_autoprefixed_quantity_name": check ss.str() == L"3.40282e+038 meter" failed
../libs/units/test/test_output.cpp(286): error in "test_output_autoprefixed_quantity_name": check ss.str() == "1.17549e-038 meter" failed [1.17549e-38 meter != 1.17549e-038 meter]
../libs/units/test/test_output.cpp(286): error in "test_output_autoprefixed_quantity_name": check ss.str() == L"1.17549e-038 meter" failed
../libs/units/test/test_output.cpp(341): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == "9.99999e-025 m" failed [9.99999e-25 m != 9.99999e-025 m]
../libs/units/test/test_output.cpp(341): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == L"9.99999e-025 m" failed
../libs/units/test/test_output.cpp(342): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == "1e+028 m" failed [1e+28 m != 1e+028 m]
../libs/units/test/test_output.cpp(342): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == L"1e+028 m" failed
../libs/units/test/test_output.cpp(343): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == "1.5e-025 m" failed [1.5e-25 m != 1.5e-025 m]
../libs/units/test/test_output.cpp(343): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == L"1.5e-025 m" failed
../libs/units/test/test_output.cpp(344): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == "1.5e+028 m" failed [1.5e+28 m != 1.5e+028 m]
../libs/units/test/test_output.cpp(344): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == L"1.5e+028 m" failed
../libs/units/test/test_output.cpp(346): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == "3.40282e+038 m" failed [3.40282e+38 m != 3.40282e+038 m]
../libs/units/test/test_output.cpp(346): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == L"3.40282e+038 m" failed
../libs/units/test/test_output.cpp(347): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == "1.17549e-038 m" failed [1.17549e-38 m != 1.17549e-038 m]
../libs/units/test/test_output.cpp(347): error in "test_output_autoprefixed_quantity_symbol": check ss.str() == L"1.17549e-038 m" failed

*** 24 failures detected in test suite "Master Test Suite"

Change History (2)

comment:1 by Steven Watanabe, 12 years ago

Owner: changed from Matthias Schabel to Steven Watanabe
Status: newassigned

Working on this now.

comment:2 by Steven Watanabe, 12 years ago

Resolution: fixed
Status: assignedclosed

(In [67558]) Don't require std::abs for printing quantities. Fix test_output on Linux. Fixes #4785.

Note: See TracTickets for help on using tickets.