Boost C++ Libraries: Ticket #11043: test test_tools_test fails if char is unsigned https://svn.boost.org/trac10/ticket/11043 <p> Greetings, </p> <p> (I hope it's OK to report this kind of thing) </p> <p> I believe there is a problem with the boost test library test test_tools_test. </p> <p> Part of that test is: </p> <blockquote> <p> char ch1 = -2; char ch2 = -3; BOOST_CHECK_EQUAL(ch1, ch2); </p> </blockquote> <p> The line in the .pattern file that corresponds to this is: </p> <p> 376: error in "test_BOOST_CHECK_EQUAL": check ch1 == ch2 failed [0xfffffffe != 0 xfffffffd] </p> <p> While this is fine if char is a signed type, I believe it is wrong if char is unsigned. In this case the output should be: </p> <p> ......check ch1 == ch2 failed [0xfe != 0xfd] </p> <p> Not a big deal, but the test could be updated to use a different pattern file (as the errors_handling_test does) in this case. </p> <p> It's interesting I did not find any general boost configuration macros for systems that chose char to be unsigned. </p> <p> Thank you for your time, </p> <p> Ed Vogel </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11043 Trac 1.4.3 Gennadiy Rozental Sun, 05 Jul 2015 22:27:38 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11043#comment:1 https://svn.boost.org/trac10/ticket/11043#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> What platform do you test this on? Until boost config has a macro for this, there isn't much I can do </p> Ticket Ed Vogel <edward.vogel@…> Mon, 06 Jul 2015 13:39:05 GMT <link>https://svn.boost.org/trac10/ticket/11043#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11043#comment:2</guid> <description> <p> Thanks for the reply, </p> <p> To answer your question, the test is running on HP <a class="missing wiki">NonStop</a>. </p> <p> With that said, I'm not sure why a configuration macro would be needed. It should be rather easy to put a bit of runtime code in the test to see if char is signed or unsigned and then use a different pattern file for the test based upon the result of the test. </p> <p> Or, you could simple follow the example boost/libs/test/test/errors_handling_test.cpp and have the user compile/set a local macro (in that case a macro called LIMITED_TEST). </p> <p> As we've modified the pattern file for our use, fixing this is not important to us. </p> <p> I just wanted to report this in case some other platform that has unsigned char as its default tries to port Boost - They will encounter this issue too. </p> <p> Again, thanks for the reply. </p> <p> Ed Vogel </p> </description> <category>Ticket</category> </item> </channel> </rss>