Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#11043 closed Bugs (wontfix)

test test_tools_test fails if char is unsigned

Reported by: Ed Vogel <edward.vogel@…> Owned by: Gennadiy Rozental
Milestone: To Be Determined Component: test
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

Greetings,

(I hope it's OK to report this kind of thing)

I believe there is a problem with the boost test library test test_tools_test.

Part of that test is:

char ch1 = -2; char ch2 = -3; BOOST_CHECK_EQUAL(ch1, ch2);

The line in the .pattern file that corresponds to this is:

376: error in "test_BOOST_CHECK_EQUAL": check ch1 == ch2 failed [0xfffffffe != 0 xfffffffd]

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:

......check ch1 == ch2 failed [0xfe != 0xfd]

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.

It's interesting I did not find any general boost configuration macros for systems that chose char to be unsigned.

Thank you for your time,

Ed Vogel

Change History (2)

comment:1 by Gennadiy Rozental, 7 years ago

Resolution: wontfix
Status: newclosed

What platform do you test this on? Until boost config has a macro for this, there isn't much I can do

comment:2 by Ed Vogel <edward.vogel@…>, 7 years ago

Thanks for the reply,

To answer your question, the test is running on HP NonStop.

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.

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).

As we've modified the pattern file for our use, fixing this is not important to us.

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.

Again, thanks for the reply.

Ed Vogel

Note: See TracTickets for help on using tickets.