cppunit-cvs Mailing List for CppUnit - C++ port of JUnit (Page 14)
Brought to you by:
blep
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(94) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(114) |
Mar
(80) |
Apr
|
May
|
Jun
(36) |
Jul
(67) |
Aug
(37) |
Sep
(33) |
Oct
(28) |
Nov
(91) |
Dec
(16) |
2006 |
Jan
(1) |
Feb
(7) |
Mar
(45) |
Apr
|
May
|
Jun
(36) |
Jul
(7) |
Aug
|
Sep
(32) |
Oct
(3) |
Nov
|
Dec
|
2007 |
Jan
(29) |
Feb
(11) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(35) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
(14) |
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(13) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(15) |
From: Baptiste L. <bl...@us...> - 2005-11-08 23:25:44
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31558/src/cpputtest Modified Files: main.cpp registrytest.cpp registrytest.h testfixturetest.cpp testfixturetest.h Log Message: - fixed static registration macro for Registry - static registration macros must no longer be followed by a semi-colon (therefore we get compiler error if registry.h was not included) - allow registration macros to work with class implenting suite() or suite( const std::string &). Index: testfixturetest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testfixturetest.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testfixturetest.h 6 Aug 2005 22:24:54 -0000 1.6 --- testfixturetest.h 8 Nov 2005 23:25:31 -0000 1.7 *************** *** 16,20 **** void testExtendAbstractTestSuite(); void testDefaultIsNoSharedFixture(); - void testSharedFixture(); void testFixtureWithSpecifics(); --- 16,19 ---- Index: testfixturetest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testfixturetest.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testfixturetest.cpp 6 Sep 2005 07:31:42 -0000 1.7 --- testfixturetest.cpp 8 Nov 2005 23:25:31 -0000 1.8 *************** *** 102,117 **** }; - - class SharedFixtureTest : public SharedFixtureTestBase - { - public: - CPPUT_TESTSUITE_BEGIN( SharedFixtureTest ); - CPPUT_TESTSUITE_SHARE_FIXTURE(); - CPPUT_TEST( test1 ); - CPPUT_TEST( test2 ); - CPPUT_TEST( test3 ); - CPPUT_TESTSUITE_END(); - }; - class TestFixtureWithSpecific : public CppUT::TestFixture { --- 102,105 ---- *************** *** 149,154 **** addTest( fixture, &TestFixtureTest::testDefaultIsNoSharedFixture, "testDefaultIsNoSharedFixture", suite ); - addTest( fixture, &TestFixtureTest::testSharedFixture, - "testSharedFixture", suite ); addTest( fixture, &TestFixtureTest::testFixtureWithSpecifics, "testFixtureWithSpecifics", suite ); --- 137,140 ---- *************** *** 226,242 **** void - TestFixtureTest::testSharedFixture() - { - CppUT::TestPtr suite = SharedFixtureTest::suite(); - MiniTestRunner runner; - SharedFixtureTestBase::instances_.clear(); - runner.run( suite ); - CPPUT_ASSERT_EQUAL( 3, runner.tested_ ); - CPPUT_ASSERT_EQUAL( 0, runner.failed_ ); - CPPUT_ASSERT_EQUAL( 1, int(SharedFixtureTestBase::instances_.size() ) ); - } - - - void TestFixtureTest::testFixtureWithSpecifics() { --- 212,215 ---- Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** main.cpp 8 Nov 2005 19:54:38 -0000 1.24 --- main.cpp 8 Nov 2005 23:25:31 -0000 1.25 *************** *** 98,101 **** --- 98,104 ---- printf( "All bootstrap tests passed successfuly...\n" ); + // Notes: the Registry must not be used. Some tests are + // registered statically in the Registry to unit test the registration + // macros (see RegistryTest). CppUT::TestSuitePtr allSuite = CppUT::makeTestSuite( "All tests" ); allSuite->add( RegistryTest::suite() ); Index: registrytest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/registrytest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** registrytest.cpp 27 Feb 2005 15:47:38 -0000 1.4 --- registrytest.cpp 8 Nov 2005 23:25:31 -0000 1.5 *************** *** 2,5 **** --- 2,38 ---- #include "minitestrunner.h" + namespace { + class MockFixture + { + public: + static CppUT::TestPtr suite() + { + return CppUT::makeFailingTestCase( "MockFixture", + "MockFixture::suite" ); + } + }; + + class MockNamableFixture + { + public: + static CppUT::TestPtr suite( const std::string &name = "" ) + { + std::string testName = name; + if ( testName.empty() ) + testName = "MockNamableFixture"; + return CppUT::makeFailingTestCase( testName, + "MockFixture::suite" ); + } + }; + + CPPUT_REGISTER_SUITE_TO_DEFAULT( MockFixture ) + CPPUT_REGISTER_SUITE_TO_DEFAULT( MockNamableFixture ) + CPPUT_REGISTER_NAMED_SUITE_TO_DEFAULT( MockNamableFixture, "NamedMockNamableFixture" ) + CPPUT_REGISTER_SUITE_IN( MockFixture, "DummyParentSuite" ) + CPPUT_REGISTER_SUITE_IN( MockNamableFixture, "DummyParentSuite" ) + CPPUT_REGISTER_NAMED_SUITE_IN( MockNamableFixture, "DummyParentSuite", + "NamedMockNamableFixture" ) + } // end anonymous namespace + void *************** *** 81,84 **** --- 114,145 ---- + void + RegistryTest::testStaticRegistration() + { + CppUT::TestSuitePtr defaultSuite = CppUT::Registry::instance().createDefaultTests(); + CPPUT_CHECK_EXPR( containsTestNamed( defaultSuite, "MockFixture" ) ); + CPPUT_CHECK_EXPR( containsTestNamed( defaultSuite, "MockNamableFixture" ) ); + CPPUT_CHECK_EXPR( containsTestNamed( defaultSuite, "NamedMockNamableFixture" ) ); + + CppUT::TestSuitePtr parentSuite = CppUT::Registry::instance().createTests("DummyParentSuite"); + CPPUT_CHECK_EXPR( containsTestNamed( parentSuite, "MockFixture" ) ); + CPPUT_CHECK_EXPR( containsTestNamed( parentSuite, "MockNamableFixture" ) ); + CPPUT_CHECK_EXPR( containsTestNamed( parentSuite, "NamedMockNamableFixture" ) ); + } + + + bool + RegistryTest::containsTestNamed( const CppUT::TestSuitePtr &suite, + const std::string &name ) + { + for ( int index = 0; index < suite->testCount(); ++index ) + { + if ( suite->testAt(index)->name() == name ) + return true; + } + return false; + } + + CppUT::TestPtr RegistryTest::makeTest( const std::string &testName ) Index: registrytest.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/registrytest.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** registrytest.h 27 Feb 2005 15:27:09 -0000 1.4 --- registrytest.h 8 Nov 2005 23:25:31 -0000 1.5 *************** *** 17,20 **** --- 17,21 ---- CPPUT_TEST( testAddTestToNamed ); CPPUT_TEST( testAddChild ); + CPPUT_TEST( testStaticRegistration ); CPPUT_TESTSUITE_END(); *************** *** 31,34 **** --- 32,37 ---- void testAddChild(); + void testStaticRegistration(); + private: CppUT::TestPtr makeTest( const std::string &testName ); *************** *** 40,43 **** --- 43,49 ---- CppUT::TestFactory makeTestFactory( const std::string &testName ); + static bool containsTestNamed( const CppUT::TestSuitePtr &suite, + const std::string &name ); + std::set<std::string> testNames_; |
From: Baptiste L. <bl...@us...> - 2005-11-08 23:25:44
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31558/include/cpput Modified Files: registry.h testfixture.h Log Message: - fixed static registration macro for Registry - static registration macros must no longer be followed by a semi-colon (therefore we get compiler error if registry.h was not included) - allow registration macros to work with class implenting suite() or suite( const std::string &). Index: registry.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/registry.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** registry.h 8 Nov 2005 21:44:54 -0000 1.5 --- registry.h 8 Nov 2005 23:25:31 -0000 1.6 *************** *** 33,38 **** --- 33,46 ---- TestFactoryId add( const std::string &parentSuiteName, const TestFactory &testFactory ); + TestFactoryId add( const std::string &parentSuiteName, + TestPtr (*factory)() ); + TestFactoryId add( const std::string &parentSuiteName, + TestPtr (*factory)( const std::string &suiteName ), + const std::string &suiteName = std::string("") ); TestFactoryId addToDefault( const TestFactory &testFactory ); + TestFactoryId addToDefault( TestPtr (*factory)() ); + TestFactoryId addToDefault( TestPtr (*factory)( const std::string &suiteName ), + const std::string &suiteName = std::string("") ); bool remove( TestFactoryId testFactoryId ); *************** *** 81,94 **** { public: ! SuiteRegisterer( const std::string &suiteName = "" ) { ! registerSuite( suiteName, "" ); } SuiteRegisterer( Impl::RegisterToNamedSuiteTag, const std::string &parentSuiteName, ! const std::string &suiteName = std::string( "" ) ) { ! registerSuite( suiteName, parentSuiteName ); } --- 89,117 ---- { public: ! SuiteRegisterer() { ! testFactoryId_ = Registry::instance().addToDefault( &SuiteType::suite ); ! } ! ! SuiteRegisterer( const std::string &suiteName ) ! { ! testFactoryId_ = Registry::instance().addToDefault( &SuiteType::suite, ! suiteName ); ! } ! ! SuiteRegisterer( Impl::RegisterToNamedSuiteTag, ! const std::string &parentSuiteName ) ! { ! testFactoryId_ = Registry::instance().add( parentSuiteName, ! &SuiteType::suite ); } SuiteRegisterer( Impl::RegisterToNamedSuiteTag, const std::string &parentSuiteName, ! const std::string &suiteName ) { ! testFactoryId_ = Registry::instance().add( parentSuiteName, ! &SuiteType::suite, ! suiteName ); } *************** *** 99,109 **** protected: ! void registerSuite( const std::string &suiteName, ! const std::string &parentSuiteName ) { - CppTL::ConstString suiteNameByValue( suiteName ); - TestFactory factory = CppTL::bind_cfnr<TestPtr>( &SuiteType::suite, - suiteNameByValue ); - testFactoryId_ = Registry::instance().add( parentSuiteName, factory ); } --- 122,128 ---- protected: ! SuiteRegisterer( TestFactoryId testFactoryId ): ! testFactoryId_( testFactoryId ) { } *************** *** 116,131 **** #define CPPUT_REGISTER_NAMED_SUITE_TO_DEFAULT( TestFixtureType, suiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )(suiteName) #define CPPUT_REGISTER_SUITE_TO_DEFAULT( TestFixtureType ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )(#TestFixtureType) #define CPPUT_REGISTER_SUITE_IN( TestFixtureType, parentSuiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )(parentSuiteName,\ ! Impl::RegisterToNamedSuiteTag() ) --- 135,151 ---- #define CPPUT_REGISTER_NAMED_SUITE_TO_DEFAULT( TestFixtureType, suiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )(suiteName); #define CPPUT_REGISTER_SUITE_TO_DEFAULT( TestFixtureType ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer ); #define CPPUT_REGISTER_SUITE_IN( TestFixtureType, parentSuiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )( \ ! CppUT::Impl::RegisterToNamedSuiteTag(), \ ! parentSuiteName ); *************** *** 134,140 **** suiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )(parentSuiteName,\ ! suiteName, \ ! Impl::RegisterToNamedSuiteTag() ) class SuiteRelationshipRegisterer --- 154,161 ---- suiteName ) \ static CppUT::SuiteRegisterer< TestFixtureType > \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRegisterer )( \ ! CppUT::Impl::RegisterToNamedSuiteTag(), \ ! parentSuiteName, \ ! suiteName ); class SuiteRelationshipRegisterer *************** *** 163,167 **** #define CPPUT_REGISTER_SUITE_RELATIONSHIP( parentSuiteName, childSuiteName ) \ static CppUT::SuiteRelationshipRegisterer \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRelationShipRegisterer )( \ parentSuiteName, \ childSuiteName ) --- 184,188 ---- #define CPPUT_REGISTER_SUITE_RELATIONSHIP( parentSuiteName, childSuiteName ) \ static CppUT::SuiteRelationshipRegisterer \ ! CPPTL_MAKE_UNIQUE_NAME(cpputSuiteRelationShipRegisterer )( \ parentSuiteName, \ childSuiteName ) Index: testfixture.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfixture.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** testfixture.h 8 Nov 2005 21:44:54 -0000 1.11 --- testfixture.h 8 Nov 2005 23:25:31 -0000 1.12 *************** *** 48,83 **** { public: - FixtureFactory() - : shouldShareFixture_( false ) - { - } - virtual ~FixtureFactory() { } - void setShareFixturePolicy( bool shouldShareFixture ) - { - shouldShareFixture_ = shouldShareFixture; - } - - void useNewFixture() - { - lastFixture_.reset(); - } - TestFixturePtr operator()() { ! if ( !shouldShareFixture_ || !lastFixture_ ) ! lastFixture_ = createNewFixture(); ! return lastFixture_; } private: virtual TestFixturePtr createNewFixture() =0; - - private: - TestFixturePtr lastFixture_; - bool shouldShareFixture_; }; --- 48,62 ---- { public: virtual ~FixtureFactory() { } TestFixturePtr operator()() { ! return createNewFixture(); } private: virtual TestFixturePtr createNewFixture() =0; }; *************** *** 102,116 **** } ! void setShareFixturePolicy( bool shouldShareFixture ) ! { ! factory_.setShareFixturePolicy( shouldShareFixture ); ! } ! ! void useNewFixture() ! { ! factory_.useNewFixture(); ! } ! ! CPPUT_DEDUCED_TYPENAME CppTL::IntrusivePtr<FixtureType> operator()() { return ::CppTL::staticPointerCast<FixtureType>( factory_() ); --- 81,85 ---- } ! CppTL::IntrusivePtr<FixtureType> operator()() { return ::CppTL::staticPointerCast<FixtureType>( factory_() ); *************** *** 197,211 **** ParentFixtureType::addTests_( suite, factory_ ) ! # define CPPUT_TESTSUITE_END() \ ! } \ ! \ ! static ::CppUT::TestPtr suite( CppTL::ConstString suiteName = std::string("") ) \ ! { \ ! if ( suiteName.empty() ) \ ! suiteName = defaultSuiteName(); \ ! ::CppUT::TestSuitePtr testSuite = ::CppUT::makeTestSuite( suiteName.str() ); \ ! ::CppUT::Impl::FixtureFactoryImpl<CppUT_ThisType> factory; \ ! addTests_( testSuite, factory ); \ ! return ::CppTL::staticPointerCast< ::CppUT::Test >( testSuite ); \ } --- 166,181 ---- ParentFixtureType::addTests_( suite, factory_ ) ! # define CPPUT_TESTSUITE_END() \ ! } \ ! \ ! static ::CppUT::TestPtr suite( const std::string &name = std::string("") ) \ ! { \ ! std::string suiteName = name; \ ! if ( suiteName.empty() ) \ ! suiteName = defaultSuiteName(); \ ! ::CppUT::TestSuitePtr testSuite = ::CppUT::makeTestSuite( suiteName ); \ ! ::CppUT::Impl::FixtureFactoryImpl<CppUT_ThisType> factory; \ ! addTests_( testSuite, factory ); \ ! return ::CppTL::staticPointerCast< ::CppUT::Test >( testSuite ); \ } *************** *** 229,255 **** specifics ) - - /* - // still need to find a way to have setUp()/tearDown() called only once - // for all tests. - // TODO: use translate for suite name ? - # define CPPUT_TESTSUITE_SHARE_FIXTURE_BEGIN() \ - { \ - ::CppUT::TestSuitePtr &parentSuite = suite; \ - std::string suiteName = CppUT::translate( "SharedSetUp" ); \ - ::CppUT::TestSuitePtr suite = ::CppUT::makeTestSuite( suiteName ); \ - fixtureFactory.useNewFixture(); \ - fixtureFactory.setShareFixturePolicy( true ) - - # define CPPUT_TESTSUITE_SHARE_FIXTURE_END() \ - parentSuite->add( suite ); \ - fixtureFactory.setShareFixturePolicy( false ); \ - } - */ - - # define CPPUT_TESTSUITE_SHARE_FIXTURE() \ - fixtureFactory.setShareFixturePolicy( true ) - - } // namespace CppUT --- 199,202 ---- |
From: Baptiste L. <bl...@us...> - 2005-11-08 23:25:44
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31558/src/opentesttest Modified Files: packetstest.cpp remoteinterfacestest.cpp serializertest.cpp Log Message: - fixed static registration macro for Registry - static registration macros must no longer be followed by a semi-colon (therefore we get compiler error if registry.h was not included) - allow registration macros to work with class implenting suite() or suite( const std::string &). Index: packetstest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/packetstest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** packetstest.cpp 6 Sep 2005 07:31:42 -0000 1.4 --- packetstest.cpp 8 Nov 2005 23:25:31 -0000 1.5 *************** *** 41,45 **** ! CPPUT_REGISTER_SUITE_TO_DEFAULT( PacketsTest ); PacketsTest::PacketsTest() --- 41,45 ---- ! CPPUT_REGISTER_SUITE_TO_DEFAULT( PacketsTest ) PacketsTest::PacketsTest() Index: serializertest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** serializertest.cpp 7 Nov 2005 22:43:08 -0000 1.5 --- serializertest.cpp 8 Nov 2005 23:25:31 -0000 1.6 *************** *** 14,18 **** ! CPPUT_REGISTER_SUITE_TO_DEFAULT( SerializerTest ); --- 14,18 ---- ! CPPUT_REGISTER_SUITE_TO_DEFAULT( SerializerTest ) Index: remoteinterfacestest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/remoteinterfacestest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** remoteinterfacestest.cpp 7 Nov 2005 22:43:08 -0000 1.2 --- remoteinterfacestest.cpp 8 Nov 2005 23:25:31 -0000 1.3 *************** *** 71,75 **** ! CPPUT_REGISTER_SUITE_TO_DEFAULT( RemoteInterfacesTest ); --- 71,75 ---- ! CPPUT_REGISTER_SUITE_TO_DEFAULT( RemoteInterfacesTest ) |
From: Baptiste L. <bl...@us...> - 2005-11-08 23:25:44
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31558/src/cpput Modified Files: registry.cpp Log Message: - fixed static registration macro for Registry - static registration macros must no longer be followed by a semi-colon (therefore we get compiler error if registry.h was not included) - allow registration macros to work with class implenting suite() or suite( const std::string &). Index: registry.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/registry.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** registry.cpp 8 Nov 2005 21:44:55 -0000 1.3 --- registry.cpp 8 Nov 2005 23:25:31 -0000 1.4 *************** *** 6,9 **** --- 6,32 ---- namespace CppUT { + namespace Impl { + struct ThreadSafeSuiteFactory + { + typedef TestPtr result_type; + + typedef TestPtr (*SuiteFactoryFn)( const std::string &suiteName); + ThreadSafeSuiteFactory( SuiteFactoryFn factory, + const std::string &suiteName ) + : factory_( factory ) + , suiteName_( suiteName ) + { + } + + TestPtr operator()() const + { + return factory_( suiteName_ ); + } + + std::string suiteName_; + SuiteFactoryFn factory_; + }; + } // namespace Impl + std::string *************** *** 70,73 **** --- 93,114 ---- + TestFactoryId + Registry::add( const std::string &parentSuiteName, + TestPtr (*factory)() ) + { + return add( parentSuiteName, CppTL::cfn0r( factory ) ); + } + + + TestFactoryId + Registry::add( const std::string &parentSuiteName, + TestPtr (*factory)( const std::string &suiteName ), + const std::string &suiteName ) + { + return add( parentSuiteName, + CppTL::fn0r( Impl::ThreadSafeSuiteFactory( factory, suiteName ) ) ); + } + + TestFactoryId Registry::addToDefault( const TestFactory &testFactory ) *************** *** 76,79 **** --- 117,134 ---- } + TestFactoryId + Registry::addToDefault( TestPtr (*factory)() ) + { + return addToDefault( CppTL::cfn0r( factory ) ); + } + + TestFactoryId + Registry::addToDefault( TestPtr (*factory)( const std::string &suiteName ), + const std::string &suiteName) + { + return addToDefault( CppTL::fn0r( Impl::ThreadSafeSuiteFactory( factory, + suiteName ) ) ); + } + bool |
From: Baptiste L. <bl...@us...> - 2005-11-08 21:50:40
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8310/include/cpput Modified Files: exceptionguard.h forwards.h Log Message: Now using InstrusivePtr. Index: exceptionguard.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/exceptionguard.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** exceptionguard.h 27 Feb 2005 14:38:26 -0000 1.2 --- exceptionguard.h 8 Nov 2005 21:50:33 -0000 1.3 *************** *** 3,7 **** # include <cpput/forwards.h> ! # include <cpptl/sharedptr.h> # include <deque> --- 3,7 ---- # include <cpput/forwards.h> ! # include <cpptl/intrusiveptr.h> # include <deque> *************** *** 18,22 **** namespace CppUT { ! class CPPUT_API ExceptionGuardElement { public: --- 18,22 ---- namespace CppUT { ! class CPPUT_API ExceptionGuardElement : public CppTL::IntrusiveCount { public: Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/forwards.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** forwards.h 8 Nov 2005 21:44:54 -0000 1.19 --- forwards.h 8 Nov 2005 21:50:33 -0000 1.20 *************** *** 25,29 **** typedef CppTL::IntrusivePtr<AbstractTestCase> AbstractTestCasePtr; typedef CppTL::IntrusivePtr<AbstractTestSuite> AbstractTestSuitePtr; ! typedef CppTL::SharedPtr<ExceptionGuardElement> ExceptionGuardElementPtr; typedef CppTL::IntrusivePtr<Test> TestPtr; typedef CppTL::IntrusivePtr<TestInfo> TestInfoPtr; --- 25,29 ---- typedef CppTL::IntrusivePtr<AbstractTestCase> AbstractTestCasePtr; typedef CppTL::IntrusivePtr<AbstractTestSuite> AbstractTestSuitePtr; ! typedef CppTL::IntrusivePtr<ExceptionGuardElement> ExceptionGuardElementPtr; typedef CppTL::IntrusivePtr<Test> TestPtr; typedef CppTL::IntrusivePtr<TestInfo> TestInfoPtr; |
From: Baptiste L. <bl...@us...> - 2005-11-08 21:45:30
|
Update of /cvsroot/cppunit/cppunit2/makefiles/vs71 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7095/makefiles/vs71 Modified Files: opentest_lib.vcproj Log Message: Removed include/opentest/properties.h Index: opentest_lib.vcproj =================================================================== RCS file: /cvsroot/cppunit/cppunit2/makefiles/vs71/opentest_lib.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opentest_lib.vcproj 7 Nov 2005 22:43:07 -0000 1.2 --- opentest_lib.vcproj 8 Nov 2005 21:45:22 -0000 1.3 *************** *** 121,127 **** </File> <File - RelativePath="..\..\include\opentest\properties.h"> - </File> - <File RelativePath="..\..\src\opentest\remoteinterfaces.cpp"> </File> --- 121,124 ---- |
From: Baptiste L. <bl...@us...> - 2005-11-08 21:45:05
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6802 Modified Files: sconstruct Log Message: - changed most interface to use std::string instead of CppTL::ConstString - CppTL::ConstString is now an implementation detail and is used to store string in objects as it is thread-safe. Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** sconstruct 8 Nov 2005 19:11:38 -0000 1.18 --- sconstruct 8 Nov 2005 21:44:54 -0000 1.19 *************** *** 77,81 **** env.Exit(1) ! env.Append( CPPPATH = ['#include', '#dependencies/jsoncpp/include'], LIBPATH = lib_dir ) --- 77,81 ---- env.Exit(1) ! env.Append( CPPPATH = ['#include'], LIBPATH = lib_dir ) |
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6802/include/cpput Modified Files: assert.h forwards.h message.h registry.h test.h testcase.h testfixture.h testinfo.h testsuite.h translate.h Log Message: - changed most interface to use std::string instead of CppTL::ConstString - CppTL::ConstString is now an implementation detail and is used to store string in objects as it is thread-safe. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** testinfo.h 8 Nov 2005 20:25:49 -0000 1.15 --- testinfo.h 8 Nov 2005 21:44:54 -0000 1.16 *************** *** 70,83 **** const Message &messages() const; ! void setTestDataType( const CppTL::ConstString &type ); ! const CppTL::ConstString &testDataType() const; ! void setTestData( const CppTL::ConstString &name, const Json::Value &value, ! const CppTL::ConstString &type = "basic" ); const Json::Value &testData() const; ! CppTL::ConstString toString() const; private: --- 70,83 ---- const Message &messages() const; ! void setTestDataType( const std::string &type ); ! std::string testDataType() const; ! void setTestData( const std::string &name, const Json::Value &value, ! const std::string &type = "basic" ); const Json::Value &testData() const; ! std::string toString() const; private: *************** *** 109,117 **** bool hasFailed() const; ! void setStatistics( const CppTL::ConstString &name, const Json::Value &value ); ! //Json::Value getStatistics( const CppTL::ConstString &name ); ! void addSpecific( const CppTL::ConstString &type, const Json::Value &value ); private: --- 109,117 ---- bool hasFailed() const; ! void setStatistics( const std::string &name, const Json::Value &value ); ! //Json::Value getStatistics( const std::string &name ); ! void addSpecific( const std::string &type, const Json::Value &value ); private: *************** *** 213,216 **** --- 213,218 ---- void CPPUT_API log( const Json::Value &log ); + void CPPUT_API log( const std::string &log ); + // This overload allows usage of StringConcatenator... void CPPUT_API log( const CppTL::ConstString &log ); Index: testsuite.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testsuite.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testsuite.h 20 Jul 2005 21:06:49 -0000 1.5 --- testsuite.h 8 Nov 2005 21:44:54 -0000 1.6 *************** *** 13,17 **** AbstractTestSuite(); ! AbstractTestSuite( const CppTL::ConstString &name ); virtual int testCount() const = 0; --- 13,17 ---- AbstractTestSuite(); ! AbstractTestSuite( const std::string &name ); virtual int testCount() const = 0; *************** *** 31,35 **** { public: ! TestSuite( const CppTL::ConstString &name ); void add( const TestPtr &test ); --- 31,35 ---- { public: ! TestSuite( const std::string &name ); void add( const TestPtr &test ); *************** *** 48,52 **** ! TestSuitePtr CPPUT_API makeTestSuite( const CppTL::ConstString &name ); } // namespace CppUT --- 48,52 ---- ! TestSuitePtr CPPUT_API makeTestSuite( const std::string &name ); } // namespace CppUT Index: assert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assert.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** assert.h 6 Sep 2005 07:17:36 -0000 1.13 --- assert.h 8 Nov 2005 21:44:54 -0000 1.14 *************** *** 25,30 **** const Message &message = Message() ); ! Message CPPUT_API buildEqualityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message = Message() ); --- 25,30 ---- const Message &message = Message() ); ! Message CPPUT_API buildEqualityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message = Message() ); *************** *** 67,72 **** } ! Message CPPUT_API buildUnequalityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message = Message() ); --- 67,72 ---- } ! Message CPPUT_API buildUnequalityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message = Message() ); *************** *** 221,225 **** message.add( "Type: " + \ ::CppTL::getObjectTypeName( e, "std::exception" ) ); \ ! message.add( CppTL::ConstString("What: ") + e.what() ); \ ::CppUT::fail( message ); \ } catch ( ... ) { \ --- 221,225 ---- message.add( "Type: " + \ ::CppTL::getObjectTypeName( e, "std::exception" ) ); \ ! message.add( std::string("What: ") + e.what() ); \ ::CppUT::fail( message ); \ } catch ( ... ) { \ Index: registry.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/registry.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** registry.h 3 Mar 2005 20:57:14 -0000 1.4 --- registry.h 8 Nov 2005 21:44:54 -0000 1.5 *************** *** 19,23 **** { public: ! static CppTL::ConstString defaultParentSuiteName(); static Registry &instance(); --- 19,23 ---- { public: ! static std::string defaultParentSuiteName(); static Registry &instance(); *************** *** 25,35 **** Registry(); ! void addChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ); ! bool removeChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ); ! TestFactoryId add( const CppTL::ConstString &parentSuiteName, const TestFactory &testFactory ); --- 25,35 ---- Registry(); ! void addChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ); ! bool removeChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ); ! TestFactoryId add( const std::string &parentSuiteName, const TestFactory &testFactory ); *************** *** 38,53 **** bool remove( TestFactoryId testFactoryId ); ! TestSuitePtr createTests( const CppTL::ConstString &suiteName ) const; TestSuitePtr createDefaultTests() const; ! void addCreatedTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const; private: ! void addChildSuite( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const; ! void addSuiteRegisteredTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const; --- 38,53 ---- bool remove( TestFactoryId testFactoryId ); ! TestSuitePtr createTests( const std::string &suiteName ) const; TestSuitePtr createDefaultTests() const; ! void addCreatedTests( const std::string &suiteName, const TestSuitePtr &suite ) const; private: ! void addChildSuite( const std::string &suiteName, const TestSuitePtr &suite ) const; ! void addSuiteRegisteredTests( const std::string &suiteName, const TestSuitePtr &suite ) const; *************** *** 81,85 **** { public: ! SuiteRegisterer( const CppTL::ConstString &suiteName = "" ) { registerSuite( suiteName, "" ); --- 81,85 ---- { public: ! SuiteRegisterer( const std::string &suiteName = "" ) { registerSuite( suiteName, "" ); *************** *** 87,92 **** SuiteRegisterer( Impl::RegisterToNamedSuiteTag, ! const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &suiteName = CppTL::ConstString( "" ) ) { registerSuite( suiteName, parentSuiteName ); --- 87,92 ---- SuiteRegisterer( Impl::RegisterToNamedSuiteTag, ! const std::string &parentSuiteName, ! const std::string &suiteName = std::string( "" ) ) { registerSuite( suiteName, parentSuiteName ); *************** *** 99,110 **** protected: ! void registerSuite( const CppTL::ConstString &suiteName, ! const CppTL::ConstString &parentSuiteName ) { CppTL::ConstString suiteNameByValue( suiteName ); TestFactory factory = CppTL::bind_cfnr<TestPtr>( &SuiteType::suite, suiteNameByValue ); - if ( parentSuiteName == "" ) - parentSuiteName == Registry::defaultParentSuiteName(); testFactoryId_ = Registry::instance().add( parentSuiteName, factory ); } --- 99,108 ---- protected: ! void registerSuite( const std::string &suiteName, ! const std::string &parentSuiteName ) { CppTL::ConstString suiteNameByValue( suiteName ); TestFactory factory = CppTL::bind_cfnr<TestPtr>( &SuiteType::suite, suiteNameByValue ); testFactoryId_ = Registry::instance().add( parentSuiteName, factory ); } *************** *** 143,148 **** { public: ! SuiteRelationshipRegisterer( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ) : parentSuiteName_( parentSuiteName ) , childSuiteName_( childSuiteName ) --- 141,146 ---- { public: ! SuiteRelationshipRegisterer( const std::string &parentSuiteName, ! const std::string &childSuiteName ) : parentSuiteName_( parentSuiteName ) , childSuiteName_( childSuiteName ) *************** *** 153,157 **** ~SuiteRelationshipRegisterer() { ! Registry::instance().removeChild( parentSuiteName_, childSuiteName_ ); } --- 151,156 ---- ~SuiteRelationshipRegisterer() { ! Registry::instance().removeChild( parentSuiteName_.str(), ! childSuiteName_.str() ); } Index: message.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/message.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** message.h 8 Nov 2005 20:25:49 -0000 1.10 --- message.h 8 Nov 2005 21:44:54 -0000 1.11 *************** *** 32,35 **** --- 32,40 ---- } + Message( const std::string &shortDescription ) + { + add( shortDescription ); + } + Message( const char *shortDescription ) { *************** *** 45,53 **** const char *detail ) { ! insertAt( index, CppTL::ConstString(detail) ); } void insertAt( int index, ! const CppTL::ConstString &detail ) { details_.insert( details_.begin() + index, detail ); --- 50,58 ---- const char *detail ) { ! insertAt( index, std::string(detail) ); } void insertAt( int index, ! const std::string &detail ) { details_.insert( details_.begin() + index, detail ); *************** *** 67,70 **** --- 72,80 ---- } + void add( const std::string &detail ) + { + details_.push_back( detail ); + } + void add( const CppTL::ConstString &detail ) { *************** *** 82,91 **** } ! CppTL::ConstString at( int index ) const { ! return CPPTL_AT( details_, index ); } ! CppTL::ConstString toString() const { CppTL::StringBuffer message; --- 92,101 ---- } ! std::string at( int index ) const { ! return CPPTL_AT( details_, index ).str(); } ! std::string toString() const { CppTL::StringBuffer message; *************** *** 102,116 **** } ! return message; ! } ! /* ! OpenTest::Properties asProperties() const ! { ! OpenTest::Properties messages; ! for ( int index =0; index < details_.size(); ++index ) ! messages.append( details_[index] ); ! return messages; } ! */ private: typedef std::vector<CppTL::ConstString> Details; --- 112,118 ---- } ! return message.c_str(); } ! private: typedef std::vector<CppTL::ConstString> Details; Index: translate.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/translate.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** translate.h 27 Feb 2005 10:15:41 -0000 1.2 --- translate.h 8 Nov 2005 21:44:54 -0000 1.3 *************** *** 9,13 **** /// Translate the specified message ! inline CppTL::ConstString CPPUT_API translate( const char *message ) { return message; --- 9,13 ---- /// Translate the specified message ! inline std::string CPPUT_API translate( const char *message ) { return message; Index: test.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/test.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test.h 8 Nov 2005 20:25:49 -0000 1.9 --- test.h 8 Nov 2005 21:44:54 -0000 1.10 *************** *** 24,40 **** } ! void setDescription( const CppTL::ConstString &description ) { info_["configuration/description"] = description; } ! CppTL::ConstString description() const { ! return info_.get("configuration/description", "" ).asConstString(); } ! CppTL::ConstString name() const { ! return info_.get( "configuration/name", "" ).asConstString(); } --- 24,40 ---- } ! void setDescription( const std::string &description ) { info_["configuration/description"] = description; } ! std::string description() const { ! return info_.get("configuration/description", "" ).asString(); } ! std::string name() const { ! return info_.get( "configuration/name", "" ).asString(); } *************** *** 51,55 **** /// @warning You must never change the name of the test after /// registering the test or scheduling it for running. ! void setName( const CppTL::ConstString &name ) { info_["configuration/name"] = name; --- 51,55 ---- /// @warning You must never change the name of the test after /// registering the test or scheduling it for running. ! void setName( const std::string &name ) { info_["configuration/name"] = name; *************** *** 85,89 **** } ! Test( const CppTL::ConstString &name ) { setName( name ); --- 85,89 ---- } ! Test( const std::string &name ) { setName( name ); Index: forwards.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/forwards.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** forwards.h 10 Aug 2005 21:34:29 -0000 1.18 --- forwards.h 8 Nov 2005 21:44:54 -0000 1.19 *************** *** 32,38 **** - TestSuitePtr CPPUT_API makeTestSuite( const CppTL::ConstString &name ); - - } // namespace CppUT --- 32,35 ---- Index: testcase.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testcase.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** testcase.h 6 Sep 2005 07:14:49 -0000 1.11 --- testcase.h 8 Nov 2005 21:44:54 -0000 1.12 *************** *** 14,18 **** { public: ! AbstractTestCase( const CppTL::ConstString &name ); bool runTest(); --- 14,18 ---- { public: ! AbstractTestCase( const std::string &name ); bool runTest(); *************** *** 45,54 **** public: TestCase( const CppTL::Functor0 &run, ! const CppTL::ConstString &name ); TestCase( const CppTL::Functor0 &setUp, const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const CppTL::ConstString &name ); public: // overridden from AbstractTestCase --- 45,54 ---- public: TestCase( const CppTL::Functor0 &run, ! const std::string &name ); TestCase( const CppTL::Functor0 &setUp, const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const std::string &name ); public: // overridden from AbstractTestCase *************** *** 67,71 **** TestPtr CPPUT_API makeTestCase( const CppTL::Functor0 &run, ! const CppTL::ConstString &name ); --- 67,71 ---- TestPtr CPPUT_API makeTestCase( const CppTL::Functor0 &run, ! const std::string &name ); *************** *** 73,79 **** const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const CppTL::ConstString &name ); ! TestPtr CPPUT_API makeFailingTestCase( const CppTL::ConstString &name, const Message &message ); --- 73,79 ---- const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const std::string &name ); ! TestPtr CPPUT_API makeFailingTestCase( const std::string &name, const Message &message ); *************** *** 82,86 **** TestPtr makeFixtureTestCase( const CppTL::IntrusivePtr<FixtureType> &fixture, const CppTL::Functor0 &run, ! const CppTL::ConstString &name ) { return makeTestCase( CppTL::memfn0( fixture, &FixtureType::setUp ), --- 82,86 ---- TestPtr makeFixtureTestCase( const CppTL::IntrusivePtr<FixtureType> &fixture, const CppTL::Functor0 &run, ! const std::string &name ) { return makeTestCase( CppTL::memfn0( fixture, &FixtureType::setUp ), Index: testfixture.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testfixture.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** testfixture.h 6 Aug 2005 22:24:53 -0000 1.10 --- testfixture.h 8 Nov 2005 21:44:54 -0000 1.11 *************** *** 130,134 **** typedef FixtureType CppUT_ThisType; ! static CppTL::ConstString defaultSuiteName() { return ::CppTL::getTypeName<CppUT_ThisType>( #FixtureType ); --- 130,134 ---- typedef FixtureType CppUT_ThisType; ! static std::string defaultSuiteName() { return ::CppTL::getTypeName<CppUT_ThisType>( #FixtureType ); *************** *** 172,176 **** # else // if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ ! CppTL::ConstString( #FixtureType ) # endif // if CPPUT_USE_RTTI_TO_NAME_SUITE --- 172,176 ---- # else // if CPPUT_USE_RTTI_TO_NAME_SUITE # define CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ) \ ! std::string( #FixtureType ) # endif // if CPPUT_USE_RTTI_TO_NAME_SUITE *************** *** 181,185 **** typedef FixtureType CppUT_ThisType; \ \ ! static CppTL::ConstString defaultSuiteName() \ { \ return CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ); \ --- 181,185 ---- typedef FixtureType CppUT_ThisType; \ \ ! static std::string defaultSuiteName() \ { \ return CPPUT_TESTSUITE_NAME_FROM_TYPE( FixtureType ); \ *************** *** 200,208 **** } \ \ ! static ::CppUT::TestPtr suite( CppTL::ConstString suiteName = CppTL::ConstString("") ) \ { \ if ( suiteName.empty() ) \ suiteName = defaultSuiteName(); \ ! ::CppUT::TestSuitePtr testSuite = ::CppUT::makeTestSuite( suiteName ); \ ::CppUT::Impl::FixtureFactoryImpl<CppUT_ThisType> factory; \ addTests_( testSuite, factory ); \ --- 200,208 ---- } \ \ ! static ::CppUT::TestPtr suite( CppTL::ConstString suiteName = std::string("") ) \ { \ if ( suiteName.empty() ) \ suiteName = defaultSuiteName(); \ ! ::CppUT::TestSuitePtr testSuite = ::CppUT::makeTestSuite( suiteName.str() ); \ ::CppUT::Impl::FixtureFactoryImpl<CppUT_ThisType> factory; \ addTests_( testSuite, factory ); \ *************** *** 237,241 **** { \ ::CppUT::TestSuitePtr &parentSuite = suite; \ ! CppTL::ConstString suiteName = CppUT::translate( "SharedSetUp" ); \ ::CppUT::TestSuitePtr suite = ::CppUT::makeTestSuite( suiteName ); \ fixtureFactory.useNewFixture(); \ --- 237,241 ---- { \ ::CppUT::TestSuitePtr &parentSuite = suite; \ ! std::string suiteName = CppUT::translate( "SharedSetUp" ); \ ::CppUT::TestSuitePtr suite = ::CppUT::makeTestSuite( suiteName ); \ fixtureFactory.useNewFixture(); \ |
From: Baptiste L. <bl...@us...> - 2005-11-08 21:45:03
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6802/src/cpput Modified Files: assert.cpp registry.cpp testcase.cpp testinfo.cpp testsuite.cpp Log Message: - changed most interface to use std::string instead of CppTL::ConstString - CppTL::ConstString is now an implementation detail and is used to store string in objects as it is thread-safe. Index: registry.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/registry.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** registry.cpp 27 Feb 2005 10:17:05 -0000 1.2 --- registry.cpp 8 Nov 2005 21:44:55 -0000 1.3 *************** *** 7,11 **** ! CppTL::ConstString Registry::defaultParentSuiteName() { --- 7,11 ---- ! std::string Registry::defaultParentSuiteName() { *************** *** 29,34 **** void ! Registry::addChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ) { // ParentChildRelationShips::iterator it = relations_.find( childSuiteName ); --- 29,34 ---- void ! Registry::addChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ) { // ParentChildRelationShips::iterator it = relations_.find( childSuiteName ); *************** *** 40,45 **** bool ! Registry::removeChild( const CppTL::ConstString &parentSuiteName, ! const CppTL::ConstString &childSuiteName ) { ParentChildRelationShips::iterator it = relations_.find( parentSuiteName ); --- 40,45 ---- bool ! Registry::removeChild( const std::string &parentSuiteName, ! const std::string &childSuiteName ) { ParentChildRelationShips::iterator it = relations_.find( parentSuiteName ); *************** *** 57,66 **** TestFactoryId ! Registry::add( const CppTL::ConstString &parentSuiteName, const TestFactory &testFactory ) { TestFactoryId id = nextFactoryId(); ! registry_[ parentSuiteName ].push_back( TestFactoryWithId( testFactory, id ) ); ! parentSuiteById_[ id ] = parentSuiteName; return id; } --- 57,69 ---- TestFactoryId ! Registry::add( const std::string &parentSuiteName, const TestFactory &testFactory ) { + CppTL::ConstString actualParentSuiteName = parentSuiteName; + if ( parentSuiteName.empty() ) + actualParentSuiteName = defaultParentSuiteName(); TestFactoryId id = nextFactoryId(); ! registry_[ actualParentSuiteName ].push_back( TestFactoryWithId( testFactory, id ) ); ! parentSuiteById_[ id ] = actualParentSuiteName; return id; } *************** *** 123,127 **** TestSuitePtr ! Registry::createTests( const CppTL::ConstString &suiteName ) const { if ( suiteName == defaultParentSuiteName() ) --- 126,130 ---- TestSuitePtr ! Registry::createTests( const std::string &suiteName ) const { if ( suiteName == defaultParentSuiteName() ) *************** *** 144,148 **** void ! Registry::addCreatedTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const { --- 147,151 ---- void ! Registry::addCreatedTests( const std::string &suiteName, const TestSuitePtr &suite ) const { *************** *** 153,157 **** void ! Registry::addChildSuite( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const { --- 156,160 ---- void ! Registry::addChildSuite( const std::string &suiteName, const TestSuitePtr &suite ) const { *************** *** 161,165 **** { const CppTL::ConstString &childSuiteName = itChild->second; ! suite->add( createTests( childSuiteName ) ); ++itChild; } --- 164,168 ---- { const CppTL::ConstString &childSuiteName = itChild->second; ! suite->add( createTests( childSuiteName.str() ) ); ++itChild; } *************** *** 168,172 **** void ! Registry::addSuiteRegisteredTests( const CppTL::ConstString &suiteName, const TestSuitePtr &suite ) const { --- 171,175 ---- void ! Registry::addSuiteRegisteredTests( const std::string &suiteName, const TestSuitePtr &suite ) const { Index: assert.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/assert.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** assert.cpp 6 Sep 2005 07:21:05 -0000 1.14 --- assert.cpp 8 Nov 2005 21:44:54 -0000 1.15 *************** *** 70,75 **** Message ! buildEqualityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message ) { --- 70,75 ---- Message ! buildEqualityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message ) { *************** *** 83,88 **** Message ! buildUnequalityFailedMessage( const CppTL::ConstString &expected, ! const CppTL::ConstString &actual, const Message &message ) { --- 83,88 ---- Message ! buildUnequalityFailedMessage( const std::string &expected, ! const std::string &actual, const Message &message ) { Index: testsuite.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testsuite.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testsuite.cpp 20 Jul 2005 21:06:51 -0000 1.9 --- testsuite.cpp 8 Nov 2005 21:44:55 -0000 1.10 *************** *** 13,17 **** ! AbstractTestSuite::AbstractTestSuite( const CppTL::ConstString &name ) : Test( name ) { --- 13,17 ---- ! AbstractTestSuite::AbstractTestSuite( const std::string &name ) : Test( name ) { *************** *** 36,40 **** // //////////////////////////////////////////////////////////////////// ! TestSuite::TestSuite( const CppTL::ConstString &name ) : AbstractTestSuite( name ) { --- 36,40 ---- // //////////////////////////////////////////////////////////////////// ! TestSuite::TestSuite( const std::string &name ) : AbstractTestSuite( name ) { *************** *** 71,75 **** ! TestSuitePtr makeTestSuite( const CppTL::ConstString &name ) { return TestSuitePtr( new TestSuite( name ) ); --- 71,75 ---- ! TestSuitePtr makeTestSuite( const std::string &name ) { return TestSuitePtr( new TestSuite( name ) ); Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** testinfo.cpp 8 Nov 2005 20:25:49 -0000 1.17 --- testinfo.cpp 8 Nov 2005 21:44:55 -0000 1.18 *************** *** 62,66 **** void ! Assertion::setTestDataType( const CppTL::ConstString &type ) { testDataType_ = type; --- 62,66 ---- void ! Assertion::setTestDataType( const std::string &type ) { testDataType_ = type; *************** *** 68,82 **** ! const CppTL::ConstString & Assertion::testDataType() const { ! return testDataType_; } void ! Assertion::setTestData( const CppTL::ConstString &name, const Json::Value &value, ! const CppTL::ConstString &type ) { testData_["name"]["type"] = type; --- 68,82 ---- ! std::string Assertion::testDataType() const { ! return testDataType_.str(); } void ! Assertion::setTestData( const std::string &name, const Json::Value &value, ! const std::string &type ) { testData_["name"]["type"] = type; *************** *** 92,96 **** ! CppTL::ConstString Assertion::toString() const { --- 92,96 ---- ! std::string Assertion::toString() const { *************** *** 115,119 **** buffer += testData_.toStyledString() + "\n"; } ! return buffer; } --- 115,119 ---- buffer += testData_.toStyledString() + "\n"; } ! return buffer.c_str(); } *************** *** 149,153 **** void ! TestStatus::setStatistics( const CppTL::ConstString &name, const Json::Value &value ) { --- 149,153 ---- void ! TestStatus::setStatistics( const std::string &name, const Json::Value &value ) { *************** *** 162,166 **** void ! TestStatus::addSpecific( const CppTL::ConstString &type, const Json::Value &value ) { --- 162,166 ---- void ! TestStatus::addSpecific( const std::string &type, const Json::Value &value ) { *************** *** 337,340 **** --- 337,345 ---- } + void log( const std::string &log ) + { + TestInfo::threadInstance().log( log ); + } + void log( const CppTL::ConstString &log ) { Index: testcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testcase.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** testcase.cpp 10 Aug 2005 21:34:29 -0000 1.12 --- testcase.cpp 8 Nov 2005 21:44:55 -0000 1.13 *************** *** 15,19 **** ! AbstractTestCase::AbstractTestCase( const CppTL::ConstString &name ) : Test( name ) { --- 15,19 ---- ! AbstractTestCase::AbstractTestCase( const std::string &name ) : Test( name ) { *************** *** 76,80 **** TestCase::TestCase( const CppTL::Functor0 &run, ! const CppTL::ConstString &name ) : AbstractTestCase( name ) , run_( run ) --- 76,80 ---- TestCase::TestCase( const CppTL::Functor0 &run, ! const std::string &name ) : AbstractTestCase( name ) , run_( run ) *************** *** 86,90 **** const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const CppTL::ConstString &name ) : AbstractTestCase( name ) , setUp_( setUp ) --- 86,90 ---- const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const std::string &name ) : AbstractTestCase( name ) , setUp_( setUp ) *************** *** 121,125 **** TestPtr makeTestCase( const CppTL::Functor0 &run, ! const CppTL::ConstString &name ) { return TestPtr( new TestCase( run, name ) ); --- 121,125 ---- TestPtr makeTestCase( const CppTL::Functor0 &run, ! const std::string &name ) { return TestPtr( new TestCase( run, name ) ); *************** *** 130,134 **** const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const CppTL::ConstString &name ) { return TestPtr( new TestCase( setUp, run, tearDown, name ) ); --- 130,134 ---- const CppTL::Functor0 &run, const CppTL::Functor0 &tearDown, ! const std::string &name ) { return TestPtr( new TestCase( setUp, run, tearDown, name ) ); *************** *** 141,145 **** { public: ! FailingTestCase( const CppTL::ConstString &name, const CppUT::Message &message ) : CppUT::AbstractTestCase( name ) --- 141,145 ---- { public: ! FailingTestCase( const std::string &name, const CppUT::Message &message ) : CppUT::AbstractTestCase( name ) *************** *** 158,162 **** ! TestPtr CPPUT_API makeFailingTestCase( const CppTL::ConstString &name, const Message &message ) { --- 158,162 ---- ! TestPtr CPPUT_API makeFailingTestCase( const std::string &name, const Message &message ) { |
From: Baptiste L. <bl...@us...> - 2005-11-08 21:45:02
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6802/src/cpputtest Modified Files: testtestcase.cpp Log Message: - changed most interface to use std::string instead of CppTL::ConstString - CppTL::ConstString is now an implementation detail and is used to store string in objects as it is thread-safe. Index: testtestcase.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/testtestcase.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** testtestcase.cpp 10 Aug 2005 21:34:29 -0000 1.17 --- testtestcase.cpp 8 Nov 2005 21:44:55 -0000 1.18 *************** *** 111,115 **** void (*tearDownCallback)( int *), int *testTearDownCall, ! const CppTL::ConstString &name ) { return CppUT::makeTestCase( --- 111,115 ---- void (*tearDownCallback)( int *), int *testTearDownCall, ! const std::string &name ) { return CppUT::makeTestCase( |
From: Baptiste L. <bl...@us...> - 2005-11-08 21:45:02
|
Update of /cvsroot/cppunit/cppunit2/include/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6802/include/cpptl Modified Files: conststring.h typename.h Log Message: - changed most interface to use std::string instead of CppTL::ConstString - CppTL::ConstString is now an implementation detail and is used to store string in objects as it is thread-safe. Index: typename.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/typename.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** typename.h 6 Mar 2005 18:36:46 -0000 1.2 --- typename.h 8 Nov 2005 21:44:54 -0000 1.3 *************** *** 15,19 **** # ifndef CPPTL_NO_RTTI ! inline CppTL::ConstString CPPUT_API demangleTypeInfoName( const std::type_info &type ) { --- 15,19 ---- # ifndef CPPTL_NO_RTTI ! inline std::string CPPUT_API demangleTypeInfoName( const std::type_info &type ) { *************** *** 25,35 **** while ( startIndex < typeName.length() && isDigit( typeName[startIndex] ) ) ++startIndex; ! return typeName.substr(startIndex); } #endif template<class AType> ! CppTL::ConstString getTypeName( CppTL::Type<AType>, ! const char *hint ) { # ifndef CPPTL_NO_RTTI --- 25,35 ---- while ( startIndex < typeName.length() && isDigit( typeName[startIndex] ) ) ++startIndex; ! return typeName.substr(startIndex).str(); } #endif template<class AType> ! std::string getTypeName( CppTL::Type<AType>, ! const char *hint ) { # ifndef CPPTL_NO_RTTI *************** *** 42,47 **** template<typename Object> ! CppTL::ConstString getObjectTypeName( const Object &object, ! const char *hint ) { # ifndef CPPTL_NO_RTTI --- 42,47 ---- template<typename Object> ! std::string getObjectTypeName( const Object &object, ! const char *hint ) { # ifndef CPPTL_NO_RTTI Index: conststring.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/conststring.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** conststring.h 4 Jul 2005 08:09:30 -0000 1.7 --- conststring.h 8 Nov 2005 21:44:54 -0000 1.8 *************** *** 916,920 **** ConstString::str() const { ! return std::string( c_str(), end_c_str() ); } # endif --- 916,921 ---- ConstString::str() const { ! return buffer_ ? std::string( c_str(), end_c_str() ) ! : std::string(); } # endif |
From: Baptiste L. <bl...@us...> - 2005-11-08 20:25:59
|
Update of /cvsroot/cppunit/cppunit2/include/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22788/include/opentest Modified Files: interfaces.h serializer.h Removed Files: properties.h Log Message: * replaced include/opentest/properties.h with include/json/value.h * replaced all occurrences of OpenTest::Value and OpenTest::Properties with Json::Value. Index: serializer.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/serializer.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** serializer.h 7 Nov 2005 22:43:07 -0000 1.8 --- serializer.h 8 Nov 2005 20:25:49 -0000 1.9 *************** *** 3,7 **** # include <opentest/forwards.h> ! # include <opentest/properties.h> # include <map> # include <deque> --- 3,8 ---- # include <opentest/forwards.h> ! # include <json/value.h> ! # include <cpptl/conststring.h> # include <map> # include <deque> *************** *** 193,197 **** Stream &operator <<( double value ); Stream &operator <<( const String &str ); ! Stream &operator <<( const Properties &properties ); Stream &operator >>( bool &value ); --- 194,198 ---- Stream &operator <<( double value ); Stream &operator <<( const String &str ); ! Stream &operator <<( const Json::Value &properties ); Stream &operator >>( bool &value ); *************** *** 204,208 **** Stream &operator >>( double &value ); Stream &operator >>( String &str ); ! Stream &operator >>( Properties &properties ); bool inError() const; --- 205,209 ---- Stream &operator >>( double &value ); Stream &operator >>( String &str ); ! Stream &operator >>( Json::Value &properties ); bool inError() const; --- properties.h DELETED --- Index: interfaces.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/opentest/interfaces.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** interfaces.h 7 Nov 2005 22:43:07 -0000 1.4 --- interfaces.h 8 Nov 2005 20:25:49 -0000 1.5 *************** *** 3,7 **** # include <opentest/forwards.h> ! # include <opentest/properties.h> # include <map> # include <deque> --- 3,8 ---- # include <opentest/forwards.h> ! # include <json/value.h> ! # include <cpptl/conststring.h> # include <map> # include <deque> *************** *** 60,64 **** String name_; String description_; ! Properties descriptionSpecific_; Stream &serialize( Stream &stream ) const; --- 61,65 ---- String name_; String description_; ! Json::Value descriptionSpecific_; Stream &serialize( Stream &stream ) const; *************** *** 71,77 **** public: String inputFormatName_; ! Properties inputFormat_; String outputFormatName_; ! Properties outputFormat_; Stream &serialize( Stream &stream ) const; --- 72,78 ---- public: String inputFormatName_; ! Json::Value inputFormat_; String outputFormatName_; ! Json::Value outputFormat_; Stream &serialize( Stream &stream ) const; *************** *** 105,110 **** public: TestId testCase_; ! Properties input_; ! Properties expectedOutput_; Stream &serialize( Stream &stream ) const; --- 106,111 ---- public: TestId testCase_; ! Json::Value input_; ! Json::Value expectedOutput_; Stream &serialize( Stream &stream ) const; *************** *** 127,131 **** public: String log_; ! Properties logSpecific_; Stream &serialize( Stream &stream ) const; --- 128,132 ---- public: String log_; ! Json::Value logSpecific_; Stream &serialize( Stream &stream ) const; *************** *** 139,144 **** String assertionFormat_; String message_; ! Properties expectedSpecific_; ! Properties actualSpecific_; Stream &serialize( Stream &stream ) const; --- 140,145 ---- String assertionFormat_; String message_; ! Json::Value expectedSpecific_; ! Json::Value actualSpecific_; Stream &serialize( Stream &stream ) const; *************** *** 151,157 **** String inputFormat_; String outputFormat_; ! Properties input_; ! Properties expected_; ! Properties actual_; Stream &serialize( Stream &stream ) const; --- 152,158 ---- String inputFormat_; String outputFormat_; ! Json::Value input_; ! Json::Value expected_; ! Json::Value actual_; Stream &serialize( Stream &stream ) const; *************** *** 164,169 **** String status_; String subStatus_; ! Properties statusSpecific_; ! Properties statistics_; Stream &serialize( Stream &stream ) const; --- 165,170 ---- String status_; String subStatus_; ! Json::Value statusSpecific_; ! Json::Value statistics_; Stream &serialize( Stream &stream ) const; |
From: Baptiste L. <bl...@us...> - 2005-11-08 20:25:59
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22788/src/opentesttest Modified Files: mockhelper.h Log Message: * replaced include/opentest/properties.h with include/json/value.h * replaced all occurrences of OpenTest::Value and OpenTest::Properties with Json::Value. Index: mockhelper.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/mockhelper.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mockhelper.h 7 Nov 2005 22:43:08 -0000 1.2 --- mockhelper.h 8 Nov 2005 20:25:50 -0000 1.3 *************** *** 2,6 **** # define OPENTTEST_MOCKHELPER_H_INCLUDED ! # include <opentest/properties.h> # include <cpput/assertenum.h> --- 2,6 ---- # define OPENTTEST_MOCKHELPER_H_INCLUDED ! # include <json/value.h> # include <cpput/assertenum.h> *************** *** 32,43 **** void verify( const CppUT::Message &message = CppUT::Message( "Actual events do not match expected events." ) ); ! void logEvent( const OpenTest::Value &value ); ! const OpenTest::Value &expectedEvents() const; ! const OpenTest::Value &actualEvents() const; private: ! OpenTest::Value expectations_; ! OpenTest::Value actuals_; bool recordExpectations_; }; --- 32,43 ---- void verify( const CppUT::Message &message = CppUT::Message( "Actual events do not match expected events." ) ); ! void logEvent( const Json::Value &value ); ! const Json::Value &expectedEvents() const; ! const Json::Value &actualEvents() const; private: ! Json::Value expectations_; ! Json::Value actuals_; bool recordExpectations_; }; *************** *** 65,70 **** MockHelper::MockHelper() : recordExpectations_( true ) ! , expectations_( OpenTest::Properties() ) ! , actuals_( OpenTest::Properties() ) { } --- 65,70 ---- MockHelper::MockHelper() : recordExpectations_( true ) ! , expectations_( Json::Value() ) ! , actuals_( Json::Value() ) { } *************** *** 74,79 **** MockHelper::clearEvents() { ! expectations_ = OpenTest::Value(); ! actuals_ = OpenTest::Value(); } --- 74,79 ---- MockHelper::clearEvents() { ! expectations_ = Json::Value(); ! actuals_ = Json::Value(); } *************** *** 101,107 **** MockHelper::verify( const CppUT::Message &message ) { ! CppUT::RefComparator<const OpenTest::Value &, ! const OpenTest::Value &> comparator; ! CppUT::RefStringizer<const OpenTest::Value &> stringizer; CppUT::checkCustomHeterogeneousSequenceEqual( expectations_.enumValues(), actuals_.enumValues(), --- 101,107 ---- MockHelper::verify( const CppUT::Message &message ) { ! CppUT::RefComparator<const Json::Value &, ! const Json::Value &> comparator; ! CppUT::RefStringizer<const Json::Value &> stringizer; CppUT::checkCustomHeterogeneousSequenceEqual( expectations_.enumValues(), actuals_.enumValues(), *************** *** 115,119 **** inline void ! MockHelper::logEvent( const OpenTest::Value &value ) { if ( recordExpectations_ ) --- 115,119 ---- inline void ! MockHelper::logEvent( const Json::Value &value ) { if ( recordExpectations_ ) *************** *** 124,128 **** ! inline const OpenTest::Value & MockHelper::expectedEvents() const { --- 124,128 ---- ! inline const Json::Value & MockHelper::expectedEvents() const { *************** *** 131,135 **** ! inline const OpenTest::Value & MockHelper::actualEvents() const { --- 131,135 ---- ! inline const Json::Value & MockHelper::actualEvents() const { |
From: Baptiste L. <bl...@us...> - 2005-11-08 20:25:59
|
Update of /cvsroot/cppunit/cppunit2/src/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22788/src/cpput Modified Files: lighttestrunner.cpp testinfo.cpp Log Message: * replaced include/opentest/properties.h with include/json/value.h * replaced all occurrences of OpenTest::Value and OpenTest::Properties with Json::Value. Index: lighttestrunner.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/lighttestrunner.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** lighttestrunner.cpp 7 Nov 2005 22:43:08 -0000 1.9 --- lighttestrunner.cpp 8 Nov 2005 20:25:49 -0000 1.10 *************** *** 104,108 **** void ! LightTestRunner::addResultLog( const OpenTest::Value &log ) { ResultElement element; --- 104,108 ---- void ! LightTestRunner::addResultLog( const Json::Value &log ) { ResultElement element; *************** *** 153,157 **** if ( !failure.testDataType().empty() ) { ! const OpenTest::Properties &testData = failure.testData(); report_ += "Test data type: " + failure.testDataType() + "\n"; report_ += testData.toStyledString() + "\n"; --- 153,157 ---- if ( !failure.testDataType().empty() ) { ! const Json::Value &testData = failure.testData(); report_ += "Test data type: " + failure.testDataType() + "\n"; report_ += testData.toStyledString() + "\n"; *************** *** 162,166 **** void ! LightTestRunner::reportLog( const OpenTest::Value &log ) { report_ += "Log:\n"; --- 162,166 ---- void ! LightTestRunner::reportLog( const Json::Value &log ) { report_ += "Log:\n"; Index: testinfo.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpput/testinfo.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** testinfo.cpp 7 Nov 2005 22:43:08 -0000 1.16 --- testinfo.cpp 8 Nov 2005 20:25:49 -0000 1.17 *************** *** 77,81 **** void Assertion::setTestData( const CppTL::ConstString &name, ! const OpenTest::Value &value, const CppTL::ConstString &type ) { --- 77,81 ---- void Assertion::setTestData( const CppTL::ConstString &name, ! const Json::Value &value, const CppTL::ConstString &type ) { *************** *** 85,89 **** ! const OpenTest::Properties & Assertion::testData() const { --- 85,89 ---- ! const Json::Value & Assertion::testData() const { *************** *** 150,154 **** void TestStatus::setStatistics( const CppTL::ConstString &name, ! const OpenTest::Value &value ) { statistics_[name] = value; --- 150,154 ---- void TestStatus::setStatistics( const CppTL::ConstString &name, ! const Json::Value &value ) { statistics_[name] = value; *************** *** 156,160 **** ! //OpenTest::Value //TestStatus::getStatistics( const CppTL::ConstString &name ) //{ --- 156,160 ---- ! //Json::Value //TestStatus::getStatistics( const CppTL::ConstString &name ) //{ *************** *** 163,167 **** void TestStatus::addSpecific( const CppTL::ConstString &type, ! const OpenTest::Value &value ) { specifics_[type] = value; --- 163,167 ---- void TestStatus::addSpecific( const CppTL::ConstString &type, ! const Json::Value &value ) { specifics_[type] = value; *************** *** 278,282 **** void ! TestInfo::log( const OpenTest::Value &log ) { if ( updater_ ) --- 278,282 ---- void ! TestInfo::log( const Json::Value &log ) { if ( updater_ ) *************** *** 332,336 **** ! void log( const OpenTest::Value &log ) { TestInfo::threadInstance().log( log ); --- 332,336 ---- ! void log( const Json::Value &log ) { TestInfo::threadInstance().log( log ); |
From: Baptiste L. <bl...@us...> - 2005-11-08 20:25:59
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22788/src/opentest Modified Files: serializer.cpp Log Message: * replaced include/opentest/properties.h with include/json/value.h * replaced all occurrences of OpenTest::Value and OpenTest::Properties with Json::Value. Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** serializer.cpp 7 Nov 2005 22:43:08 -0000 1.10 --- serializer.cpp 8 Nov 2005 20:25:49 -0000 1.11 *************** *** 1,4 **** #include <opentest/serializer.h> ! #include <float.h> // For struct assertion_traits<double> #include <stdio.h> --- 1,4 ---- #include <opentest/serializer.h> ! #include <float.h> #include <stdio.h> |
From: Baptiste L. <bl...@us...> - 2005-11-08 20:25:57
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22788/include/cpput Modified Files: lighttestrunner.h message.h test.h testinfo.h Log Message: * replaced include/opentest/properties.h with include/json/value.h * replaced all occurrences of OpenTest::Value and OpenTest::Properties with Json::Value. Index: testinfo.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/testinfo.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** testinfo.h 11 Aug 2005 07:18:24 -0000 1.14 --- testinfo.h 8 Nov 2005 20:25:49 -0000 1.15 *************** *** 5,9 **** # include <cpput/message.h> # include <cpptl/intrusiveptr.h> ! # include <opentest/properties.h> /// @todo find a away to integrate context with multiple thread. --- 5,9 ---- # include <cpput/message.h> # include <cpptl/intrusiveptr.h> ! # include <json/value.h> /// @todo find a away to integrate context with multiple thread. *************** *** 74,81 **** void setTestData( const CppTL::ConstString &name, ! const OpenTest::Value &value, const CppTL::ConstString &type = "basic" ); ! const OpenTest::Properties &testData() const; CppTL::ConstString toString() const; --- 74,81 ---- void setTestData( const CppTL::ConstString &name, ! const Json::Value &value, const CppTL::ConstString &type = "basic" ); ! const Json::Value &testData() const; CppTL::ConstString toString() const; *************** *** 83,87 **** private: Message messages_; ! OpenTest::Properties testData_; CppTL::ConstString testDataType_; SourceLocation location_; --- 83,87 ---- private: Message messages_; ! Json::Value testData_; CppTL::ConstString testDataType_; SourceLocation location_; *************** *** 110,121 **** void setStatistics( const CppTL::ConstString &name, ! const OpenTest::Value &value ); ! //OpenTest::Value getStatistics( const CppTL::ConstString &name ); void addSpecific( const CppTL::ConstString &type, ! const OpenTest::Value &value ); private: ! OpenTest::Properties statistics_; ! OpenTest::Properties specifics_; Status status_; }; --- 110,121 ---- void setStatistics( const CppTL::ConstString &name, ! const Json::Value &value ); ! //Json::Value getStatistics( const CppTL::ConstString &name ); void addSpecific( const CppTL::ConstString &type, ! const Json::Value &value ); private: ! Json::Value statistics_; ! Json::Value specifics_; Status status_; }; *************** *** 130,134 **** } ! virtual void addResultLog( const OpenTest::Value &log ) = 0; virtual void addResultAssertion( const Assertion &assertion ) = 0; --- 130,134 ---- } ! virtual void addResultLog( const Json::Value &log ) = 0; virtual void addResultAssertion( const Assertion &assertion ) = 0; *************** *** 185,189 **** void setAbortingAssertionMode( AbortingAssertionMode mode ); ! void log( const OpenTest::Value &log ); private: --- 185,189 ---- void setAbortingAssertionMode( AbortingAssertionMode mode ); ! void log( const Json::Value &log ); private: *************** *** 211,215 **** void CPPUT_API realizeAssertion(); ! void CPPUT_API log( const OpenTest::Value &log ); // This overload allows usage of StringConcatenator... --- 211,215 ---- void CPPUT_API realizeAssertion(); ! void CPPUT_API log( const Json::Value &log ); // This overload allows usage of StringConcatenator... Index: test.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/test.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test.h 7 Nov 2005 22:43:07 -0000 1.8 --- test.h 8 Nov 2005 20:25:49 -0000 1.9 *************** *** 3,7 **** # include <cpput/forwards.h> ! # include <opentest/properties.h> # include <cpptl/intrusiveptr.h> # include <string> --- 3,8 ---- # include <cpput/forwards.h> ! # include <json/value.h> ! # include <cpptl/conststring.h> # include <cpptl/intrusiveptr.h> # include <string> *************** *** 62,66 **** /// @warning You must never change the name of the test after /// registering the test or scheduling it for running. ! //OpenTest::Properties &info() //{ // return info_; --- 63,67 ---- /// @warning You must never change the name of the test after /// registering the test or scheduling it for running. ! //Json::Value &info() //{ // return info_; *************** *** 90,94 **** private: ! OpenTest::Properties info_; }; --- 91,95 ---- private: ! Json::Value info_; }; Index: message.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/message.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** message.h 8 Aug 2005 22:10:20 -0000 1.9 --- message.h 8 Nov 2005 20:25:49 -0000 1.10 *************** *** 4,8 **** # include <cpput/config.h> # include <cpptl/conststring.h> ! # include <opentest/properties.h> # include <vector> --- 4,8 ---- # include <cpput/config.h> # include <cpptl/conststring.h> ! //# include <opentest/properties.h> # include <vector> *************** *** 104,108 **** return message; } ! OpenTest::Properties asProperties() const { --- 104,108 ---- return message; } ! /* OpenTest::Properties asProperties() const { *************** *** 112,116 **** return messages; } ! private: typedef std::vector<CppTL::ConstString> Details; --- 112,116 ---- return messages; } ! */ private: typedef std::vector<CppTL::ConstString> Details; Index: lighttestrunner.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/lighttestrunner.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lighttestrunner.h 11 Aug 2005 07:18:24 -0000 1.4 --- lighttestrunner.h 8 Nov 2005 20:25:49 -0000 1.5 *************** *** 24,28 **** private: // overridden from TestResultUpdater ! virtual void addResultLog( const OpenTest::Value &log ); virtual void addResultAssertion( const Assertion &assertion ); --- 24,28 ---- private: // overridden from TestResultUpdater ! virtual void addResultLog( const Json::Value &log ); virtual void addResultAssertion( const Assertion &assertion ); *************** *** 34,38 **** CppTL::ConstString getTestPath() const; void reportFailure( const Assertion &failure ); ! void reportLog( const OpenTest::Value &log ); struct ResultElement --- 34,38 ---- CppTL::ConstString getTestPath() const; void reportFailure( const Assertion &failure ); ! void reportLog( const Json::Value &log ); struct ResultElement *************** *** 47,51 **** TestPath testPath_; CppTL::StringBuffer report_; ! typedef std::deque<OpenTest::Value> Logs; Logs logs_; typedef std::deque<Assertion> Assertions; --- 47,51 ---- TestPath testPath_; CppTL::StringBuffer report_; ! typedef std::deque<Json::Value> Logs; Logs logs_; typedef std::deque<Assertion> Assertions; |
From: Baptiste L. <bl...@us...> - 2005-11-08 20:25:57
|
Update of /cvsroot/cppunit/cppunit2/examples/stringize_demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22788/examples/stringize_demo Modified Files: main.cpp Log Message: * replaced include/opentest/properties.h with include/json/value.h * replaced all occurrences of OpenTest::Value and OpenTest::Properties with Json::Value. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/examples/stringize_demo/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.cpp 7 Nov 2005 22:43:07 -0000 1.2 --- main.cpp 8 Nov 2005 20:25:49 -0000 1.3 *************** *** 1,8 **** #include <examples/common/examplecommon.h> #include <cpput/testcase.h> - #include <opentest/properties.h> #include <cpptl/stringtools.h> - #include <deque> #include <cpput/assertenum.h> namespace ExampleNamespace { --- 1,7 ---- #include <examples/common/examplecommon.h> #include <cpput/testcase.h> #include <cpptl/stringtools.h> #include <cpput/assertenum.h> + #include <deque> namespace ExampleNamespace { |
From: Baptiste L. <bl...@us...> - 2005-11-08 20:25:57
|
Update of /cvsroot/cppunit/cppunit2/examples/log_demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22788/examples/log_demo Modified Files: main.cpp Log Message: * replaced include/opentest/properties.h with include/json/value.h * replaced all occurrences of OpenTest::Value and OpenTest::Properties with Json::Value. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/examples/log_demo/main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cpp 7 Nov 2005 22:43:07 -0000 1.3 --- main.cpp 8 Nov 2005 20:25:49 -0000 1.4 *************** *** 1,5 **** #include <examples/common/examplecommon.h> #include <cpput/testcase.h> - #include <opentest/properties.h> #include <cpptl/stringtools.h> --- 1,4 ---- |
From: Baptiste L. <bl...@us...> - 2005-11-08 19:54:45
|
Update of /cvsroot/cppunit/cppunit2/src/cpputtest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15348/src/cpputtest Modified Files: SConscript main.cpp Log Message: * removed formattest as it is experimental stuff. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/main.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** main.cpp 6 Sep 2005 07:31:42 -0000 1.23 --- main.cpp 8 Nov 2005 19:54:38 -0000 1.24 *************** *** 8,16 **** #include "testfixturetest.h" #include "reflectiontest.h" ! #include "formattest.h" #include <cpput/lighttestrunner.h> - //#include <cpput/testrunner.h> // cppunit2 testrunner for opentest - //#include <opentest/texttestdriver.h> --- 8,14 ---- #include "testfixturetest.h" #include "reflectiontest.h" ! //#include "formattest.h" #include <cpput/lighttestrunner.h> *************** *** 107,111 **** allSuite->add( AssertEnumTest::suite() ); allSuite->add( ReflectionTest::suite() ); ! allSuite->add( FormatTest::suite() ); // allSuite->add( CommandLineOptionsTest::suite() ); --- 105,109 ---- allSuite->add( AssertEnumTest::suite() ); allSuite->add( ReflectionTest::suite() ); ! // allSuite->add( FormatTest::suite() ); // allSuite->add( CommandLineOptionsTest::suite() ); Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpputtest/SConscript,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SConscript 29 Sep 2005 20:32:48 -0000 1.12 --- SConscript 8 Nov 2005 19:54:38 -0000 1.13 *************** *** 5,9 **** assertstringtest.cpp enumeratortest.cpp - formattest.cpp main.cpp registrytest.cpp --- 5,8 ---- |
From: Baptiste L. <bl...@us...> - 2005-11-08 19:11:48
|
Update of /cvsroot/cppunit/cppunit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4558 Modified Files: sconstruct Log Message: * fixed compilation on AIX Index: sconstruct =================================================================== RCS file: /cvsroot/cppunit/cppunit2/sconstruct,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** sconstruct 7 Nov 2005 22:43:06 -0000 1.17 --- sconstruct 8 Nov 2005 19:11:38 -0000 1.18 *************** *** 40,52 **** if platform == 'suncc': ! env.Tools( 'suncc' ) env.Append( LIBS = ['pthreads'] ) elif platform == 'vacpp': ! env.Tool( 'default', 'aixcc' ) ! env.Append( CCFLAGS = '-qrtti=all', ! CXX ='xlC_r', #scons does not pick-up the correct one ! ! LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning # using xlC_r ensure multi-threading is enabled: # http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm elif platform == 'msvc6': env['MSVS_VERSION']='6.0' --- 40,55 ---- if platform == 'suncc': ! env.Tool( 'sunc++' ) ! env.Tool( 'sunlink' ) ! env.Tool( 'sunar' ) env.Append( LIBS = ['pthreads'] ) elif platform == 'vacpp': ! env.Tool( 'default' ) ! env.Tool( 'aixcc' ) ! env['CXX'] = 'xlC_r' #scons does not pick-up the correct one ! # using xlC_r ensure multi-threading is enabled: # http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm + env.Append( CCFLAGS = '-qrtti=all', + LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning elif platform == 'msvc6': env['MSVS_VERSION']='6.0' |
From: Baptiste L. <bl...@us...> - 2005-11-08 09:05:13
|
Update of /cvsroot/cppunit/cppunit2/include/cpput In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31104/include/cpput Modified Files: assertenum.h Log Message: * fixed compilation issue on linux with gcc Index: assertenum.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/include/cpput/assertenum.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** assertenum.h 7 Nov 2005 22:43:07 -0000 1.9 --- assertenum.h 8 Nov 2005 09:05:05 -0000 1.10 *************** *** 5,8 **** --- 5,9 ---- # include <cpptl/enumerator.h> # include <functional> + # include <deque> //todo: for sequence, list 'common' sequence part before expected & actual divergence |
From: Baptiste L. <bl...@us...> - 2005-11-07 22:43:25
|
Update of /cvsroot/cppunit/cppunit2/src/opentest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30871/src/opentest Modified Files: SConscript serializer.cpp Log Message: - replaced usage of OpenTest::Properties with Json::Value. Json::Value provides a simpler interface and a standard *simple* serialization format. - jsoncpp has been inlined in CppTL to make deploy easier and remove an external dependency. Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/SConscript,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SConscript 8 Aug 2005 22:10:21 -0000 1.6 --- SConscript 7 Nov 2005 22:43:08 -0000 1.7 *************** *** 4,11 **** interfaces.cpp serializer.cpp - texttestdriver.cpp """ ), 'opentest' ) # remoteinterfaces.cpp # sharedmemorytransport.cpp --- 4,11 ---- interfaces.cpp serializer.cpp """ ), 'opentest' ) + # texttestdriver.cpp # remoteinterfaces.cpp # sharedmemorytransport.cpp Index: serializer.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentest/serializer.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** serializer.cpp 6 Sep 2005 07:31:42 -0000 1.9 --- serializer.cpp 7 Nov 2005 22:43:08 -0000 1.10 *************** *** 33,41 **** ccNoneValue = 0x26, // '&' ccNewDictionnaryEntry = 0x27, // "'" ! ccPropertyList = 0x28, // '(' ! ccNamedPropertiesEnd = 0x29, // ')' ccPositiveReal = 0x2a, // '*' ccPositiveInteger = 0x2b, // '+' ! ccEmptyProperties = 0x2c, // ',' ccNegativeInteger = 0x2d, // '-' ccRealDot = 0x2e, // '.' --- 33,41 ---- ccNoneValue = 0x26, // '&' ccNewDictionnaryEntry = 0x27, // "'" ! ccArrayValue = 0x28, // '(' ! ccObjectValueEnd = 0x29, // ')' ccPositiveReal = 0x2a, // '*' ccPositiveInteger = 0x2b, // '+' ! ccEmptyObjectValue = 0x2c, // ',' ccNegativeInteger = 0x2d, // '-' ccRealDot = 0x2e, // '.' *************** *** 667,700 **** - Stream & - Stream::operator <<( const Properties &properties ) - { - Properties::PropertyEnum enumProperties = properties.properties(); - if ( properties.hasList() ) - { - doSerializeInteger( ccPropertyList, properties.listSize() ); - for ( unsigned int valueIndex =0; valueIndex < properties.listSize(); ++valueIndex ) - *this << properties.at( valueIndex ); - } - else if ( !enumProperties.hasNext() ) - { - write( ccEmptyProperties ); - } - - if ( enumProperties.hasNext() ) - { - do - { - const Property &property = enumProperties.next(); - saveDictionnaryEntry( property.name() ); - *this << property.value(); - } - while ( enumProperties.hasNext() ); - write( ccNamedPropertiesEnd ); - } - return *this; - } - - bool Stream::isNamedPropertyControl( Byte control ) --- 667,670 ---- *************** *** 705,749 **** ! Stream & ! Stream::operator >>( Properties &properties ) { ! Byte control = readNextByte(); ! if ( control == ccEmptyProperties ) ! return *this; ! if ( control == ccPropertyList ) { ! LargestUnsignedInt length; ! doUnserializeInteger( length ); ! while ( length-- ) { ! Value value; ! *this >> value; ! properties.append( value ); } ! control = readNextByte(); } - if ( !isNamedPropertyControl(control) ) - { - if ( !properties.hasList() ) - setError( "Expected Properties." ); - else - ungetLastByte(); - return *this; - } do { String name; readDictionnaryEntry( control, name ); ! Value value; ! *this >> value; ! properties.set( name, value ); control = readNextByte(); } while ( isNamedPropertyControl(control) ); ! if ( control != ccNamedPropertiesEnd ) setError( "Unexpected end of named property list." ); - return *this; } --- 675,735 ---- ! void ! Stream::serializeArrayValue( const Value &value ) { ! LargestUnsignedInt length = value.size(); ! doSerializeInteger( ccArrayValue, length ); ! for ( LargestUnsignedInt index = 0; index < length; ++index ) ! *this << value[index]; ! } ! ! void ! Stream::serializeObjectValue( const Value &value ) ! { ! Value::Members names = value.getMemberNames(); // @todo implements a more efficient iteration over members ! if ( names.empty() ) { ! write( ccEmptyObjectValue ); ! } ! else ! { ! Value::Members::const_iterator it = names.begin(); ! Value::Members::const_iterator itEnd = names.end(); ! for ( ; it != itEnd; ++it ) { ! saveDictionnaryEntry( *it ); ! *this << value[*it]; } ! write( ccObjectValueEnd ); } + } + + + void + Stream::unserializeArrayValue( Value &value ) + { + value = Value( Json::arrayValue ); + LargestUnsignedInt length; + doUnserializeInteger( length ); + for ( LargestUnsignedInt index = 0; index < length; ++index ) + *this >> value[index]; + } + void + Stream::unserializeObjectValue( Byte control, + Value &value ) + { + value = Value( Json::objectValue ); do { String name; readDictionnaryEntry( control, name ); ! *this >> value[ name.c_str() ]; control = readNextByte(); } while ( isNamedPropertyControl(control) ); ! if ( control != ccObjectValueEnd ) setError( "Unexpected end of named property list." ); } *************** *** 754,786 **** switch ( value.type() ) { ! case Value::vtNone: write( ccNoneValue ); break; ! case Value::vtBoolean: *this << value.asBool(); break; #ifndef CPPTL_NO_INT64 ! case Value::vtSignedInteger: ! *this << value.asInt64(); break; ! case Value::vtUnsignedInteger: ! *this << value.asUInt64(); break; #else ! case Value::vtSignedInteger: *this << value.asInt(); break; ! case Value::vtUnsignedInteger: *this << value.asUInt(); break; #endif ! case Value::vtReal: ! *this << value.asReal(); break; ! case Value::vtString: ! *this << value.asString(); break; ! case Value::vtProperties: ! *this << value.asProperties(); break; default: --- 740,775 ---- switch ( value.type() ) { ! case Json::nullValue: write( ccNoneValue ); break; ! case Json::booleanValue: *this << value.asBool(); break; #ifndef CPPTL_NO_INT64 ! case Json::intValue: ! *this << value.asInt(); break; ! case Json::uintValue: ! *this << value.asUInt(); break; #else ! case Json::intValue: *this << value.asInt(); break; ! case Json::uintValue: *this << value.asUInt(); break; #endif ! case Json::realValue: ! *this << value.asDouble(); break; ! case Json::stringValue: ! *this << String( value.asString().c_str() ); break; ! case Json::arrayValue: ! serializeArrayValue( value ); ! break; ! case Json::objectValue: ! serializeObjectValue( value ); break; default: *************** *** 807,821 **** String str; readString( str ); ! value = Value( str ); } break; case ccLookUpDictionnaryEntry: case ccNewDictionnaryEntry: ! case ccPropertyList: ! { ! ungetLastByte(); ! value = Value( Properties() ); ! *this >> value.asProperties(); ! } break; case ccNoneValue: --- 796,811 ---- String str; readString( str ); ! value = Value( str.c_str() ); } break; case ccLookUpDictionnaryEntry: case ccNewDictionnaryEntry: ! unserializeObjectValue( control, value ); ! break; ! case ccEmptyObjectValue: ! value = Value( Json::objectValue ); ! break; ! case ccArrayValue: ! unserializeArrayValue( value ); break; case ccNoneValue: *************** *** 836,840 **** ungetLastByte(); *this >> integer; ! value = Value( integer ); } break; --- 826,830 ---- ungetLastByte(); *this >> integer; ! value = Value( Value::UInt(integer) ); } break; *************** *** 844,848 **** ungetLastByte(); *this >> integer; ! value = Value( integer ); } break; --- 834,838 ---- ungetLastByte(); *this >> integer; ! value = Value( Value::Int(integer) ); } break; |
From: Baptiste L. <bl...@us...> - 2005-11-07 22:43:25
|
Update of /cvsroot/cppunit/cppunit2/src/cpptl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30871/src/cpptl Modified Files: SConscript Added Files: json_reader.cpp json_value.cpp json_writer.cpp Log Message: - replaced usage of OpenTest::Properties with Json::Value. Json::Value provides a simpler interface and a standard *simple* serialization format. - jsoncpp has been inlined in CppTL to make deploy easier and remove an external dependency. Index: SConscript =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/cpptl/SConscript,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SConscript 6 Mar 2005 18:48:24 -0000 1.1 --- SConscript 7 Nov 2005 22:43:07 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- buildLibary( env, Split( """ + json_reader.cpp + json_value.cpp + json_writer.cpp thread.cpp """ ), --- NEW FILE: json_value.cpp --- #include <json/value.h> #include <json/writer.h> #include <utility> #include "assert.h" #ifdef JSON_USE_CPPTL # include <cpptl/conststring.h> # include <cpptl/enumerator.h> #endif #define JSON_ASSERT_UNREACHABLE assert( false ) #define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw namespace Json { const Value Value::null; const Value::Int Value::minInt = Value::Int( ~(Value::UInt(-1)/2) ); const Value::Int Value::maxInt = Value::Int( Value::UInt(-1)/2 ); const Value::UInt Value::maxUInt = Value::UInt(-1); [...1153 lines suppressed...] if ( !node->isArray() ) { // Error: node is not an array at position ... } node = &((*node)[arg.index_]); } else if ( arg.kind_ == PathArgument::kindKey ) { if ( !node->isObject() ) { // Error: node is not an object at position... } node = &((*node)[arg.key_]); } } return *node; } } // namespace Json --- NEW FILE: json_reader.cpp --- #include <json/reader.h> #include <json/value.h> #include <utility> #include <stdio.h> #include <assert.h> namespace Json { static inline bool in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 ) { return c == c1 || c == c2 || c == c3 || c == c4; } static inline bool in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 ) { return c == c1 || c == c2 || c == c3 || c == c4 || c == c5; } static bool containsNewLine( Reader::Location begin, Reader::Location end ) { for ( ;begin < end; ++begin ) if ( *begin == '\n' || *begin == '\r' ) return true; return false; } // Class Reader // ////////////////////////////////////////////////////////////////// Reader::Reader() { } bool Reader::parse( const std::string &document, Value &root, bool collectComments ) { collectComments_ = collectComments; document_ = document; begin_ = document_.c_str(); end_ = begin_ + document_.length(); current_ = begin_; lastValueEnd_ = 0; lastValue_ = 0; commentsBefore_ = ""; errors_.clear(); while ( !nodes_.empty() ) nodes_.pop(); nodes_.push( &root ); bool successful = readValue(); Token token; skipCommentTokens( token ); if ( collectComments_ && !commentsBefore_.empty() ) root.setComment( commentsBefore_, commentAfter ); return successful; } bool Reader::readValue() { Token token; skipCommentTokens( token ); bool successful = true; if ( collectComments_ && !commentsBefore_.empty() ) { currentValue().setComment( commentsBefore_, commentBefore ); commentsBefore_ = ""; } switch ( token.type_ ) { case tokenObjectBegin: successful = readObject( token ); break; case tokenArrayBegin: successful = readArray( token ); break; case tokenNumber: successful = decodeNumber( token ); break; case tokenString: successful = decodeString( token ); break; case tokenTrue: currentValue() = true; break; case tokenFalse: currentValue() = false; break; case tokenNull: currentValue() = Value(); break; default: return addError( "Syntax error: value, object or array expected.", token ); } if ( collectComments_ ) { lastValueEnd_ = current_; lastValue_ = ¤tValue(); } return successful; } void Reader::skipCommentTokens( Token &token ) { do { readToken( token ); } while ( token.type_ == tokenComment ); } bool Reader::expectToken( TokenType type, Token &token, const char *message ) { readToken( token ); if ( token.type_ != type ) return addError( message, token ); return true; } bool Reader::readToken( Token &token ) { skipSpaces(); token.start_ = current_; Char c = getNextChar(); bool ok = true; switch ( c ) { case '{': token.type_ = tokenObjectBegin; break; case '}': token.type_ = tokenObjectEnd; break; case '[': token.type_ = tokenArrayBegin; break; case ']': token.type_ = tokenArrayEnd; break; case '"': token.type_ = tokenString; ok = readString(); break; case '/': token.type_ = tokenComment; ok = readComment(); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '-': token.type_ = tokenNumber; readNumber(); break; case 't': token.type_ = tokenTrue; ok = match( "rue", 3 ); break; case 'f': token.type_ = tokenFalse; ok = match( "alse", 4 ); break; case 'n': token.type_ = tokenNull; ok = match( "ull", 3 ); break; case ',': token.type_ = tokenArraySeparator; break; case ':': token.type_ = tokenMemberSeparator; break; case 0: token.type_ = tokenEndOfStream; break; default: ok = false; break; } if ( !ok ) token.type_ = tokenError; token.end_ = current_; return true; } void Reader::skipSpaces() { while ( current_ != end_ ) { Char c = *current_; if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' ) ++current_; else break; } } bool Reader::match( Location pattern, int patternLength ) { if ( end_ - current_ < patternLength ) return false; int index = patternLength; while ( index-- ) if ( current_[index] != pattern[index] ) return false; current_ += patternLength; return true; } bool Reader::readComment() { Location commentBegin = current_ - 1; Char c = getNextChar(); bool successful = false; if ( c == '*' ) successful = readCStyleComment(); else if ( c == '/' ) successful = readCppStyleComment(); if ( !successful ) return false; if ( collectComments_ ) { CommentPlacement placement = commentBefore; if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) ) { if ( c != '*' || !containsNewLine( commentBegin, current_ ) ) placement = commentAfterOnSameLine; } addComment( commentBegin, current_, placement ); } return true; } void Reader::addComment( Location begin, Location end, CommentPlacement placement ) { assert( collectComments_ ); if ( placement == commentAfterOnSameLine ) { assert( lastValue_ != 0 ); lastValue_->setComment( std::string( begin, end ), placement ); } else { if ( !commentsBefore_.empty() ) commentsBefore_ += "\n"; commentsBefore_ += std::string( begin, end ); } } bool Reader::readCStyleComment() { while ( current_ != end_ ) { Char c = getNextChar(); if ( c == '*' && *current_ == '/' ) break; } return getNextChar() == '/'; } bool Reader::readCppStyleComment() { while ( current_ != end_ ) { Char c = getNextChar(); if ( c == '\r' || c == '\n' ) break; } return true; } void Reader::readNumber() { while ( current_ != end_ ) { if ( !(*current_ >= '0' && *current_ <= '9') && !in( *current_, '.', 'e', 'E', '+', '-' ) ) break; ++current_; } } bool Reader::readString() { Char c = 0; while ( current_ != end_ ) { c = getNextChar(); if ( c == '\\' ) getNextChar(); else if ( c == '"' ) break; } return c == '"'; } bool Reader::readObject( Token &tokenStart ) { Token tokenName; std::string name; currentValue() = Value( objectValue ); while ( readToken( tokenName ) ) { bool initialTokenOk = true; while ( tokenName.type_ == tokenComment && initialTokenOk ) initialTokenOk = readToken( tokenName ); if ( !initialTokenOk ) break; if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object return true; if ( tokenName.type_ != tokenString ) break; name = ""; if ( !decodeString( tokenName, name ) ) return recoverFromError( tokenObjectEnd ); Token colon; if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator ) { return addErrorAndRecover( "Missing ':' after object member name", colon, tokenObjectEnd ); } Value &value = currentValue()[ name ]; nodes_.push( &value ); bool ok = readValue(); nodes_.pop(); if ( !ok ) // error already set return recoverFromError( tokenObjectEnd ); Token comma; if ( !readToken( comma ) || ( comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator ) ) { return addErrorAndRecover( "Missing ',' or '}' in object declaration", comma, tokenObjectEnd ); } if ( comma.type_ == tokenObjectEnd ) return true; } return addErrorAndRecover( "Missing '}' or object member name", tokenName, tokenObjectEnd ); } bool Reader::readArray( Token &tokenStart ) { currentValue() = Value( arrayValue ); skipSpaces(); if ( *current_ == ']' ) // empty array { Token endArray; readToken( endArray ); return true; } int index = 0; while ( true ) { Value &value = currentValue()[ index++ ]; nodes_.push( &value ); bool ok = readValue(); nodes_.pop(); if ( !ok ) // error already set return recoverFromError( tokenArrayEnd ); Token token; if ( !readToken( token ) || ( token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd ) ) { return addErrorAndRecover( "Missing ',' or ']' in array declaration", token, tokenArrayEnd ); } if ( token.type_ == tokenArrayEnd ) break; } return true; } bool Reader::decodeNumber( Token &token ) { bool isDouble = false; for ( Location inspect = token.start_; inspect != token.end_; ++inspect ) { isDouble = isDouble || in( *inspect, '.', 'e', 'E', '+' ) || ( *inspect == '-' && inspect != token.start_ ); } if ( isDouble ) return decodeDouble( token ); Location current = token.start_; bool isNegative = *current == '-'; if ( isNegative ) ++current; Value::UInt threshold = (isNegative ? Value::UInt(-Value::minInt) : Value::maxUInt) / 10; Value::UInt value = 0; while ( current < token.end_ ) { Char c = *current++; if ( c < '0' || c > '9' ) return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); if ( value >= threshold ) return decodeDouble( token ); value = value * 10 + Value::UInt(c - '0'); } if ( isNegative ) currentValue() = -Value::Int( value ); else if ( value <= Value::UInt(Value::maxInt) ) currentValue() = Value::Int( value ); else currentValue() = value; return true; } bool Reader::decodeDouble( Token &token ) { double value = 0; const int bufferSize = 32; int count; int length = int(token.end_ - token.start_); if ( length <= bufferSize ) { Char buffer[bufferSize]; memcpy( buffer, token.start_, length ); buffer[length] = 0; count = sscanf( buffer, "%lf", &value ); } else { std::string buffer( token.start_, token.end_ ); count = sscanf( buffer.c_str(), "%lf", &value ); } if ( count != 1 ) return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); currentValue() = value; return true; } bool Reader::decodeString( Token &token ) { std::string decoded; if ( !decodeString( token, decoded ) ) return false; currentValue() = decoded; return true; } bool Reader::decodeString( Token &token, std::string &decoded ) { decoded.reserve( token.end_ - token.start_ - 2 ); Location current = token.start_ + 1; // skip '"' Location end = token.end_ - 1; // do not include '"' while ( current != end ) { Char c = *current++; if ( c == '"' ) break; else if ( c == '\\' ) { if ( current == end ) return addError( "Empty escape sequence in string", token, current ); Char escape = *current++; switch ( escape ) { case '"': decoded += '"'; break; case '/': decoded += '/'; break; case '\\': decoded += '\\'; break; case 'b': decoded += '\b'; break; case 'f': decoded += '\f'; break; case 'n': decoded += '\n'; break; case 'r': decoded += '\r'; break; case 't': decoded += '\t'; break; case 'u': { unsigned int unicode; if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) ) return false; // @todo encode unicode as utf8. } break; default: return addError( "Bad escape sequence in string", token, current ); } } else { decoded += c; } } return true; } bool Reader::decodeUnicodeEscapeSequence( Token &token, Location ¤t, Location end, unsigned int &unicode ) { if ( end - current < 4 ) return addError( "Bad unicode escape sequence in string: four digits expected.", token, current ); unicode = 0; for ( int index =0; index < 4; ++index ) { Char c = *current++; unicode *= 16; if ( c >=0 && c <= 9 ) unicode += c - '0'; else if ( c >= 'a' && c <= 'f' ) unicode += c - 'a' + 10; else if ( c >= 'A' && c <= 'F' ) unicode += c - 'A' + 10; else return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current ); } return true; } bool Reader::addError( const std::string &message, Token &token, Location extra ) { ErrorInfo info; info.token_ = token; info.message_ = message; info.extra_ = extra; errors_.push_back( info ); return false; } bool Reader::recoverFromError( TokenType skipUntilToken ) { int errorCount = int(errors_.size()); Token skip; while ( true ) { if ( !readToken(skip) ) errors_.resize( errorCount ); // discard errors caused by recovery if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream ) break; } errors_.resize( errorCount ); return false; } bool Reader::addErrorAndRecover( const std::string &message, Token &token, TokenType skipUntilToken ) { addError( message, token ); return recoverFromError( skipUntilToken ); } Value & Reader::currentValue() { return *(nodes_.top()); } Reader::Char Reader::getNextChar() { if ( current_ == end_ ) return 0; return *current_++; } void Reader::getLocationLineAndColumn( Location location, int &line, int &column ) const { Location current = begin_; Location lastLineStart = current; line = 0; while ( current < location && current != end_ ) { Char c = *current++; if ( c == '\r' ) { if ( *current == '\n' ) ++current; lastLineStart = current; ++line; } else if ( c == '\n' ) { lastLineStart = current; ++line; } } // column & line start at 1 column = int(location - lastLineStart) + 1; ++line; } std::string Reader::getLocationLineAndColumn( Location location ) const { int line, column; getLocationLineAndColumn( location, line, column ); char buffer[18+16+16+1]; sprintf( buffer, "Line %d, Column %d", line, column ); return buffer; } std::string Reader::getFormatedErrorMessages() const { std::string formattedMessage; for ( Errors::const_iterator itError = errors_.begin(); itError != errors_.end(); ++itError ) { const ErrorInfo &error = *itError; formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n"; formattedMessage += " " + error.message_ + "\n"; if ( error.extra_ ) formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n"; } return formattedMessage; } } // namespace Json --- NEW FILE: json_writer.cpp --- #include <json/writer.h> #include <utility> #include <assert.h> #include <stdio.h> namespace Json { static void uintToString( unsigned int value, char *¤t ) { *--current = 0; char *end = current; do { *--current = (value % 10) + '0'; value /= 10; } while ( value != 0 ); } std::string valueToString( Value::Int value ) { char buffer[32]; char *current = buffer + sizeof(buffer); bool isNegative = value < 0; if ( isNegative ) value = -value; uintToString( Value::UInt(value), current ); if ( isNegative ) *--current = '-'; assert( current >= buffer ); return current; } std::string valueToString( Value::UInt value ) { char buffer[32]; char *current = buffer + sizeof(buffer); uintToString( value, current ); assert( current >= buffer ); return current; } std::string valueToString( double value ) { char buffer[32]; sprintf( buffer, "%.16g", value ); return buffer; } std::string valueToString( bool value ) { return value ? "true" : "false"; } std::string valueToQuotedString( const char *value ) { return std::string("\"") + value + "\""; } // Class FastWriter // ////////////////////////////////////////////////////////////////// std::string FastWriter::write( const Value &root ) { document_ = ""; writeValue( root ); document_ += "\n"; return document_; } void FastWriter::writeValue( const Value &value ) { switch ( value.type() ) { case nullValue: document_ += "null"; break; case intValue: document_ += valueToString( value.asInt() ); break; case uintValue: document_ += valueToString( value.asUInt() ); break; case realValue: document_ += valueToString( value.asDouble() ); break; case stringValue: document_ += valueToQuotedString( value.asCString() ); break; case booleanValue: document_ += valueToString( value.asBool() ); break; case arrayValue: { document_ += "[ "; int size = value.size(); for ( int index =0; index < size; ++index ) { if ( index > 0 ) document_ += ", "; writeValue( value[index] ); } document_ += " ]"; } break; case objectValue: { Value::Members members( value.getMemberNames() ); document_ += "{ "; for ( Value::Members::iterator it = members.begin(); it != members.end(); ++it ) { const std::string &name = *it; if ( it != members.begin() ) document_ += ", "; document_ += valueToQuotedString( name.c_str() ); document_ += " : "; writeValue( value[name] ); } document_ += " }"; } break; } } // Class StyledWriter // ////////////////////////////////////////////////////////////////// StyledWriter::StyledWriter() : rightMargin_( 74 ) , indentSize_( 3 ) { } std::string StyledWriter::write( const Value &root ) { document_ = ""; addChildValues_ = false; indentString_ = ""; writeCommentBeforeValue( root ); writeValue( root ); writeCommentAfterValueOnSameLine( root ); document_ += "\n"; return document_; } void StyledWriter::writeValue( const Value &value ) { switch ( value.type() ) { case nullValue: pushValue( "null" ); break; case intValue: pushValue( valueToString( value.asInt() ) ); break; case uintValue: pushValue( valueToString( value.asUInt() ) ); break; case realValue: pushValue( valueToString( value.asDouble() ) ); break; case stringValue: pushValue( valueToQuotedString( value.asCString() ) ); break; case booleanValue: pushValue( valueToString( value.asBool() ) ); break; case arrayValue: writeArrayValue( value); break; case objectValue: { Value::Members members( value.getMemberNames() ); if ( members.empty() ) pushValue( "{}" ); else { writeWithIndent( "{" ); indent(); Value::Members::iterator it = members.begin(); while ( true ) { const std::string &name = *it; const Value &childValue = value[name]; writeCommentBeforeValue( childValue ); writeWithIndent( valueToQuotedString( name.c_str() ) ); document_ += " : "; writeValue( childValue ); if ( ++it == members.end() ) { writeCommentAfterValueOnSameLine( childValue ); break; } document_ += ","; writeCommentAfterValueOnSameLine( childValue ); } unindent(); writeWithIndent( "}" ); } } break; } } void StyledWriter::writeArrayValue( const Value &value ) { int size = value.size(); if ( size == 0 ) pushValue( "[]" ); else { bool isArrayMultiLine = isMultineArray( value ); if ( isArrayMultiLine ) { writeWithIndent( "[" ); indent(); bool hasChildValue = !childValues_.empty(); int index =0; while ( true ) { const Value &childValue = value[index]; writeCommentBeforeValue( childValue ); if ( hasChildValue ) writeWithIndent( childValues_[index] ); else { writeIndent(); writeValue( childValue ); } if ( ++index == size ) { writeCommentAfterValueOnSameLine( childValue ); break; } document_ += ","; writeCommentAfterValueOnSameLine( childValue ); } unindent(); writeWithIndent( "]" ); } else // output on a single line { assert( childValues_.size() == size ); document_ += "[ "; for ( int index =0; index < size; ++index ) { if ( index > 0 ) document_ += ", "; document_ += childValues_[index]; } document_ += " ]"; } } } bool StyledWriter::isMultineArray( const Value &value ) { int size = value.size(); bool isMultiLine = size*3 >= rightMargin_ ; childValues_.clear(); for ( int index =0; index < size && !isMultiLine; ++index ) { const Value &childValue = value[index]; isMultiLine = isMultiLine || ( (childValue.isArray() || childValue.isObject()) && childValue.size() > 0 ); } if ( !isMultiLine ) // check if line length > max line length { childValues_.reserve( size ); addChildValues_ = true; int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' for ( int index =0; index < size && !isMultiLine; ++index ) { writeValue( value[index] ); lineLength += int( childValues_[index].length() ); isMultiLine = isMultiLine && hasCommentForValue( value[index] ); } addChildValues_ = false; isMultiLine = isMultiLine || lineLength >= rightMargin_; } return isMultiLine; } void StyledWriter::pushValue( const std::string &value ) { if ( addChildValues_ ) childValues_.push_back( value ); else document_ += value; } void StyledWriter::writeIndent() { if ( !document_.empty() ) { char last = document_[document_.length()-1]; if ( last == ' ' ) // already indented return; if ( last != '\n' ) // Comments may add new-line document_ += '\n'; } document_ += indentString_; } void StyledWriter::writeWithIndent( const std::string &value ) { writeIndent(); document_ += value; } void StyledWriter::indent() { indentString_ += std::string( indentSize_, ' ' ); } void StyledWriter::unindent() { assert( int(indentString_.size()) >= indentSize_ ); indentString_.resize( indentString_.size() - indentSize_ ); } void StyledWriter::writeCommentBeforeValue( const Value &root ) { if ( !root.hasComment( commentBefore ) ) return; document_ += normalizeEOL( root.getComment( commentBefore ) ); document_ += "\n"; } void StyledWriter::writeCommentAfterValueOnSameLine( const Value &root ) { if ( root.hasComment( commentAfterOnSameLine ) ) document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); if ( root.hasComment( commentAfter ) ) { document_ += "\n"; document_ += normalizeEOL( root.getComment( commentAfter ) ); document_ += "\n"; } } bool StyledWriter::hasCommentForValue( const Value &value ) { return value.hasComment( commentBefore ) || value.hasComment( commentAfterOnSameLine ) || value.hasComment( commentAfter ); } std::string StyledWriter::normalizeEOL( const std::string &text ) { std::string normalized; normalized.reserve( text.length() ); const char *begin = text.c_str(); const char *end = begin + text.length(); const char *current = begin; while ( current != end ) { char c = *current++; if ( c == '\r' ) // mac or dos EOL { if ( *current == '\n' ) // convert dos EOL ++current; normalized += '\n'; } else // handle unix EOL & other char normalized += c; } return normalized; } } // namespace Json |
From: Baptiste L. <bl...@us...> - 2005-11-07 22:43:25
|
Update of /cvsroot/cppunit/cppunit2/examples/checking_assertions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30871/examples/checking_assertions Modified Files: main.cpp Log Message: - replaced usage of OpenTest::Properties with Json::Value. Json::Value provides a simpler interface and a standard *simple* serialization format. - jsoncpp has been inlined in CppTL to make deploy easier and remove an external dependency. Index: main.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/examples/checking_assertions/main.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.cpp 8 Aug 2005 22:07:57 -0000 1.2 --- main.cpp 7 Nov 2005 22:43:06 -0000 1.3 *************** *** 1,6 **** #include <examples/common/examplecommon.h> #include <cpput/testcase.h> - #include <opentest/texttestdriver.h> - #include <opentest/properties.h> --- 1,4 ---- |
From: Baptiste L. <bl...@us...> - 2005-11-07 22:43:25
|
Update of /cvsroot/cppunit/cppunit2/src/opentesttest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30871/src/opentesttest Modified Files: mockhelper.h remoteinterfacestest.cpp serializertest.cpp Log Message: - replaced usage of OpenTest::Properties with Json::Value. Json::Value provides a simpler interface and a standard *simple* serialization format. - jsoncpp has been inlined in CppTL to make deploy easier and remove an external dependency. Index: mockhelper.h =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/mockhelper.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mockhelper.h 6 Sep 2005 07:43:48 -0000 1.1 --- mockhelper.h 7 Nov 2005 22:43:08 -0000 1.2 *************** *** 101,107 **** MockHelper::verify( const CppUT::Message &message ) { ! CppUT::checkSequenceEqual( expectations_.asProperties().listValues(), ! actuals_.asProperties().listValues(), ! message ); clearEvents(); recordExpectedEvents(); --- 101,113 ---- MockHelper::verify( const CppUT::Message &message ) { ! CppUT::RefComparator<const OpenTest::Value &, ! const OpenTest::Value &> comparator; ! CppUT::RefStringizer<const OpenTest::Value &> stringizer; ! CppUT::checkCustomHeterogeneousSequenceEqual( expectations_.enumValues(), ! actuals_.enumValues(), ! stringizer, ! stringizer, ! comparator, ! message ); clearEvents(); recordExpectedEvents(); Index: serializertest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/serializertest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** serializertest.cpp 6 Sep 2005 07:31:42 -0000 1.4 --- serializertest.cpp 7 Nov 2005 22:43:08 -0000 1.5 *************** *** 6,17 **** namespace CppUT { // converter for assert equal - inline std::string toString( const OpenTest::Properties &value ) - { - return value.toString().c_str(); - } - inline std::string toString( const OpenTest::Value &value ) { ! return value.toString().c_str(); } --- 6,12 ---- namespace CppUT { // converter for assert equal inline std::string toString( const OpenTest::Value &value ) { ! return value.toStyledString(); } *************** *** 140,151 **** { OpenTest::Value vEmpty; ! OpenTest::Value vUInt( 323456789 ); OpenTest::Value vInt( -123456789 ); OpenTest::Value vDouble( 1.2345678 ); OpenTest::Value vString( "abcdefghijklmnopqrstuvwxyz" ); ! streamOut_ << vEmpty << vUInt << vInt << vDouble << vString; prepareUnserialize(); OpenTest::Value v1, v2, v3, v4, v5; ! streamIn_ >> v1 >> v2 >> v3 >> v4 >> v5; CPPUT_ASSERT_EQUAL( vEmpty, v1 ); CPPUT_ASSERT_EQUAL( vUInt, v2 ); --- 135,148 ---- { OpenTest::Value vEmpty; ! OpenTest::Value vUInt( (unsigned int)323456789 ); OpenTest::Value vInt( -123456789 ); OpenTest::Value vDouble( 1.2345678 ); OpenTest::Value vString( "abcdefghijklmnopqrstuvwxyz" ); ! streamOut_ << vEmpty << vUInt << vInt << vDouble; ! streamOut_ << vString; prepareUnserialize(); OpenTest::Value v1, v2, v3, v4, v5; ! streamIn_ >> v1 >> v2 >> v3 >> v4; ! streamIn_ >> v5; CPPUT_ASSERT_EQUAL( vEmpty, v1 ); CPPUT_ASSERT_EQUAL( vUInt, v2 ); *************** *** 159,185 **** 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 ); } --- 156,184 ---- SerializerTest::testBasicProperty() { ! OpenTest::Properties emptyValue; ! OpenTest::Properties arrayValue; ! OpenTest::Properties objectValue; OpenTest::Value vEmpty; ! OpenTest::Value vUInt( (unsigned int)323456789 ); OpenTest::Value vInt( -123456789 ); OpenTest::Value vDouble( 1.2345678 ); OpenTest::Value vString( "abcdefghijklmnopqrstuvwxyz" ); ! arrayValue.append( vEmpty ); ! arrayValue.append( vUInt ); ! arrayValue.append( vInt ); ! arrayValue.append( vDouble ); ! arrayValue.append( vString ); ! objectValue["v1"] = vEmpty; ! objectValue["v2"] = vUInt; ! objectValue["v3"] = vInt; ! objectValue["v4"] = vDouble; ! objectValue["v5"] = vString; ! streamOut_ << emptyValue << arrayValue << objectValue; prepareUnserialize(); ! OpenTest::Properties p1, p2, p3; ! streamIn_ >> p1 >> p2 >> p3; ! CPPUT_ASSERT_EQUAL( emptyValue, p1 ); ! CPPUT_ASSERT_EQUAL( arrayValue, p2 ); ! CPPUT_ASSERT_EQUAL( objectValue, p3 ); } Index: remoteinterfacestest.cpp =================================================================== RCS file: /cvsroot/cppunit/cppunit2/src/opentesttest/remoteinterfacestest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** remoteinterfacestest.cpp 6 Sep 2005 07:43:48 -0000 1.1 --- remoteinterfacestest.cpp 7 Nov 2005 22:43:08 -0000 1.2 *************** *** 8,19 **** namespace CppUT { // converter for assert equal - inline std::string toString( const OpenTest::Properties &value ) - { - return value.toString().c_str(); - } - inline std::string toString( const OpenTest::Value &value ) { ! return value.toString().c_str(); } --- 8,14 ---- namespace CppUT { // converter for assert equal inline std::string toString( const OpenTest::Value &value ) { ! return value.toStyledString().c_str(); } |