1 #include <cppunit/TestAssert.h> 2 #include "CoreSuite.h" 3 #include "assertion_traitsTest.h" 4 5 6 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( assertion_traitsTest, 7 coreSuiteName() ); 8 assertion_traitsTest()9assertion_traitsTest::assertion_traitsTest() 10 { 11 } 12 13 14 void test_toString()15assertion_traitsTest::test_toString() 16 { 17 CPPUNIT_ASSERT_EQUAL( std::string( "abc" ), 18 CPPUNIT_NS::assertion_traits<const char*>::toString( "abc" ) ); 19 20 CPPUNIT_ASSERT_EQUAL( std::string( "33" ), 21 CPPUNIT_NS::assertion_traits<int>::toString( 33 ) ); 22 23 // Test that assertion_traits<double>::toString() produces 24 // more than the standard 6 digits of precision. 25 CPPUNIT_ASSERT_EQUAL( std::string( "33.1" ), 26 CPPUNIT_NS::assertion_traits<double>::toString( 33.1 ) ); 27 CPPUNIT_ASSERT_EQUAL( std::string( "33.001" ), 28 CPPUNIT_NS::assertion_traits<double>::toString( 33.001 ) ); 29 CPPUNIT_ASSERT_EQUAL( std::string( "33.00001" ), 30 CPPUNIT_NS::assertion_traits<double>::toString( 33.00001 ) ); 31 CPPUNIT_ASSERT_EQUAL( std::string( "33.0000001" ), 32 CPPUNIT_NS::assertion_traits<double>::toString( 33.0000001 ) ); 33 CPPUNIT_ASSERT_EQUAL( std::string( "33.0000000001" ), 34 CPPUNIT_NS::assertion_traits<double>::toString( 33.0000000001 ) ); 35 } 36