[Cppunit-cvs] cppunit2/src/cpputtest valuetest.cpp, NONE, 1.1 valuetest.h, NONE, 1.1 SConscript, 1.
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2007-08-19 20:13:28
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1355/src/cpputtest Modified Files: SConscript main.cpp Added Files: valuetest.cpp valuetest.h Log Message: In progress of adding CppTL::Value to replace CppTL::Any in table fixture and input based fixture. Value allows optionaly comparison, conversion to other type, conversion to string... Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** main.cpp 5 Jun 2006 12:02:56 -0000 1.27 --- main.cpp 19 Aug 2007 20:13:24 -0000 1.28 *************** *** 9,12 **** --- 9,13 ---- #include "testfixturetest.h" #include "smallmaptest.h" + #include "valuetest.h" //#include "formattest.h" *************** *** 112,115 **** --- 113,117 ---- allSuite->add( ReflectionTest::suite() ); allSuite->add( SmallMapTest::suite() ); + allSuite->add( ValueTest::suite() ); // allSuite->add( FormatTest::suite() ); // allSuite->add( CommandLineOptionsTest::suite() ); --- NEW FILE: valuetest.cpp --- #include "valuetest.h" #include <cpptl/value.h> ValueTest::ValueTest() : maxInt_( 0x7ffffff ) , minInt_( ~(unsigned int(-1)/2) ) { } ValueTest::~ValueTest() { } void ValueTest::setUp() { } void ValueTest::tearDown() { } void ValueTest::testNone() { CppTL::Value value; CPPUT_CHECK_EXPR( value.isNone() ); CppTL::Value value2; CPPUT_CHECK_EXPR( value2.isNone() ); CPPUT_CHECK_EXPR( value == value2 ); CPPUT_CHECK_EXPR_FALSE( value < value2 ); CPPUT_CHECK_EXPR( value <= value2 ); CPPUT_CHECK_EXPR_FALSE( value != value2 ); CPPUT_CHECK_EXPR( value >= value2 ); CPPUT_CHECK_EXPR_FALSE( value > value2 ); } void ValueTest::testLifeCycle() { CppTL::Value value1 = CppTL::makeValue( maxInt_ ); CppTL::Value value1a = value1; CppTL::Value value2 = CppTL::makeValue( minInt_ ); CppTL::Value value2a = CppTL::makeValue( minInt_ ); CPPUT_CHECK_EXPR_FALSE( value1a.isNone() ); CPPUT_CHECK_EXPR( value2 < value1 ); CPPUT_CHECK_EXPR( value2 <= value1 ); CPPUT_CHECK_EXPR( value1 != value2 ); CPPUT_CHECK_EXPR_FALSE( value1 == value2 ); CPPUT_CHECK_EXPR_FALSE( value2 >= value1 ); CPPUT_CHECK_EXPR_FALSE( value2 > value1 ); CPPUT_CHECK_EXPR( value1 == value1a ); CPPUT_CHECK_EXPR( value2 == value2a ); } Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/SConscript,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SConscript 5 Jun 2006 12:02:56 -0000 1.16 --- SConscript 19 Aug 2007 20:13:24 -0000 1.17 *************** *** 16,19 **** --- 16,20 ---- testtestsuite.cpp reflectiontest.cpp + valuetest.cpp """ ), 'cpputtest', --- NEW FILE: valuetest.h --- #ifndef CPPUT_VALUETEST_H # define CPPUT_VALUETEST_H # include <cpput/assertcommon.h> # include <cpput/testfixture.h> # include <cpptl/value.h> class ValueTest : public CppUT::TestFixture { CPPUT_TESTSUITE_BEGIN( ValueTest ); CPPUT_TEST( testLifeCycle ); CPPUT_TEST( testNone ); CPPUT_TESTSUITE_END(); public: ValueTest(); virtual ~ValueTest(); void setUp(); void tearDown(); void testNone(); void testLifeCycle(); private: const int maxInt_; const int minInt_; }; #endif // CPPUT_VALUETEST_H |