[Cppunit-cvs] cppunit2/src/cpputtest formattest.cpp,NONE,1.1 formattest.h,NONE,1.1
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-09-06 07:43:02
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18344/src/cpputtest Added Files: formattest.cpp formattest.h Log Message: * experimental implementation of a type safe sprintf. --- NEW FILE: formattest.cpp --- #include "formattest.h" #include <cpput/assert.h> #include <cpptl/format.h> void FormatTest::setUp() { double x = 1, y = 1, z = 0; for ( int i = 1; i < 200; ++i ) { z += x + y; y *= 10; z /= 10; } } void FormatTest::tearDown() { } void FormatTest::testLengthNoFormat() { CPPUT_ASSERT_EQUAL( 9, CppTL::Formatter( "123456789", CppTL::FormatArgs() ).length() ); } void FormatTest::testLengthIntFormat() { CPPUT_ASSERT_EQUAL( 4+9, CppTL::Formatter( "ab%dcd", CppTL::args(123456789) ).length() ); } --- NEW FILE: formattest.h --- #ifndef CPPUT_FORMATTEST_H_INCLUDED # define CPPUT_FORMATTEST_H_INCLUDED # include <cpput/testfixture.h> class FormatTest : public CppUT::TestFixture { CPPUT_TESTSUITE_BEGIN( FormatTest ); CPPUT_TEST( testLengthNoFormat ); CPPUT_TEST( testLengthIntFormat ); CPPUT_TESTSUITE_END(); public: void setUp(); void tearDown(); void testLengthNoFormat(); void testLengthIntFormat(); private: }; #endif // CPPUT_FORMATTEST_H_INCLUDED |