add test for printInt() sign correctness
This commit is contained in:
parent
f553896e2d
commit
5bed7f292f
@ -58,8 +58,13 @@ BOOST_AUTO_TEST_CASE(print_int)
|
|||||||
char buffer[12];
|
char buffer[12];
|
||||||
buffer[11] = 0; // zero termination
|
buffer[11] = 0; // zero termination
|
||||||
std::string output = printInt<11, 8>(buffer, 314158976);
|
std::string output = printInt<11, 8>(buffer, 314158976);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(output, "3.14158976");
|
BOOST_CHECK_EQUAL(output, "3.14158976");
|
||||||
}
|
|
||||||
|
buffer[11] = 0;
|
||||||
|
output = printInt<11, 8>(buffer, 0);
|
||||||
|
BOOST_CHECK_EQUAL(output, "0.00000000");
|
||||||
|
|
||||||
|
output = printInt<11, 8>(buffer, -314158976);
|
||||||
|
BOOST_CHECK_EQUAL(output, "-3.14158976");}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user