Boost C++ Libraries: Ticket #4785: test_output fails on systems that don't zero-fill the exponent to three digits https://svn.boost.org/trac10/ticket/4785 <p> 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 </p> <pre class="wiki">"9.99999e-25 meter" != "9.99999e-025 meter" </pre><p> even though those two values are clearly the same. </p> <p> If controlling this is as difficult as it seems to be (see <a class="ext-link" href="http://stackoverflow.com/questions/268604/how-to-set-the-width-of-the-exponent-field-for-an-ostream"><span class="icon">​</span>here</a>), you could change the comparison to a regex_match with the regex </p> <pre class="wiki">"9\.99999e-0?25 meter" </pre><hr /> <pre class="wiki">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" </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4785 Trac 1.4.3 Steven Watanabe Sun, 02 Jan 2011 02:00:24 GMT owner, status changed https://svn.boost.org/trac10/ticket/4785#comment:1 https://svn.boost.org/trac10/ticket/4785#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Matthias Schabel</span> to <span class="trac-author">Steven Watanabe</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Working on this now. </p> Ticket Steven Watanabe Sun, 02 Jan 2011 02:33:19 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4785#comment:2 https://svn.boost.org/trac10/ticket/4785#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/67558" title="Don't require std::abs for printing quantities. Fix test_output on ...">[67558]</a>) Don't require std::abs for printing quantities. Fix test_output on Linux. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4785" title="#4785: Bugs: test_output fails on systems that don't zero-fill the exponent to ... (closed: fixed)">#4785</a>. </p> Ticket