[Cppunit-cvs] cppunit2/src/opentesttest main.cpp,1.1,1.2 serializertest.cpp,1.2,1.3 serializertest.h
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2005-07-02 20:27:49
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14915/src/opentesttest Modified Files: main.cpp serializertest.cpp serializertest.h Log Message: * Added a simple test runner that does not rely on the open test framework to run cppunit2 tests. * added CppTL::ConstCharView to wrapper const char *strings. * added CppTL::quoteMultiLineString() * string assertion output actual and expected using quoteMultiLineString(). * added serialize unit test for basic Properties * opentest tests now use the LightTestRunner. Index: serializertest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** serializertest.h 1 Jul 2005 20:32:04 -0000 1.2 --- serializertest.h 2 Jul 2005 20:27:37 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- CPPUT_TEST( testBool ); CPPUT_TEST( testBasicValue ); + CPPUT_TEST( testBasicProperty ); CPPUT_TESTSUITE_END(); *************** *** 30,33 **** --- 31,35 ---- void testBool(); void testBasicValue(); + void testBasicProperty(); private: Index: serializertest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** serializertest.cpp 1 Jul 2005 20:32:04 -0000 1.2 --- serializertest.cpp 2 Jul 2005 20:27:37 -0000 1.3 *************** *** 128,132 **** { OpenTest::Value vEmpty; ! OpenTest::Value vUInt( 123456789 ); OpenTest::Value vInt( -123456789 ); OpenTest::Value vDouble( 1.2345678 ); --- 128,132 ---- { OpenTest::Value vEmpty; ! OpenTest::Value vUInt( 323456789 ); OpenTest::Value vInt( -123456789 ); OpenTest::Value vDouble( 1.2345678 ); *************** *** 142,143 **** --- 142,173 ---- CPPUT_ASSERT_EQUAL( vString, v5 ); } + + + void + SerializerTest::testBasicProperty() + { + OpenTest::Properties emptyProperties; + OpenTest::Properties properties; + OpenTest::Value vEmpty; + OpenTest::Value vUInt( 323456789 ); + OpenTest::Value vInt( -123456789 ); + OpenTest::Value vDouble( 1.2345678 ); + OpenTest::Value vString( "abcdefghijklmnopqrstuvwxyz" ); + properties.append( vEmpty ); + properties.append( vUInt ); + properties.append( vInt ); + properties.append( vDouble ); + properties.append( vString ); + properties["v1"] = vEmpty; + properties["v2"] = vUInt; + properties["v3"] = vInt; + properties["v4"] = vDouble; + properties["v5"] = vString; + + streamOut_ << emptyProperties << properties; + prepareUnserialize(); + OpenTest::Properties p1, p2; + streamIn_ >> p1 >> p2; + CPPUT_ASSERT_EQUAL( emptyProperties, p1 ); + CPPUT_ASSERT_EQUAL( properties, p2 ); + } Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.cpp 1 Jul 2005 08:19:37 -0000 1.1 --- main.cpp 2 Jul 2005 20:27:37 -0000 1.2 *************** *** 1,10 **** #include <cpput/test.h> #include <cpput/testsuite.h> #include <stdio.h> #include "serializertest.h" - #include <cpput/testrunner.h> // cppunit2 testrunner for opentest - #include <opentest/texttestdriver.h> - static void displayConfiguration() --- 1,8 ---- #include <cpput/test.h> #include <cpput/testsuite.h> + #include <cpput/lighttestrunner.h> #include <stdio.h> #include "serializertest.h" static void displayConfiguration() *************** *** 69,79 **** allSuite->add( SerializerTest::suite() ); ! CppUT::TestRunner runner; ! CppUT::AbstractTestSuitePtr rootSuite = ! CppTL::staticPointerCast<CppUT::AbstractTestSuite>( allSuite ); ! runner.setRootSuite( rootSuite ); ! ! OpenTest::TextTestDriver driver( runner ); ! bool sucessful = driver.run(); return sucessful ? 0 : 1; } --- 67,75 ---- allSuite->add( SerializerTest::suite() ); ! CppUT::LightTestRunner runner; ! CppUT::TestPtr rootSuite = ! CppTL::staticPointerCast<CppUT::Test>( allSuite ); ! runner.addTest( rootSuite ); ! bool sucessful = runner.runAllTests(); return sucessful ? 0 : 1; } |