mockpp-commits Mailing List for Mock Objects for C++ (Page 48)
Brought to you by:
ewald-arnold
You can subscribe to this list here.
2005 |
Jan
|
Feb
(17) |
Mar
(178) |
Apr
(119) |
May
(60) |
Jun
(3) |
Jul
(60) |
Aug
(16) |
Sep
(55) |
Oct
(156) |
Nov
(136) |
Dec
(255) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(98) |
Feb
(8) |
Mar
(57) |
Apr
(43) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ewald A. <ewa...@us...> - 2005-03-12 17:51:05
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23860/mockpp/tests Modified Files: AbstractDynamicChainingMock_test.cpp AbstractInvocationDispatcher_test.cpp ChainingMockObjectSupport_test.cpp IsInstanceOf_test.cpp Makefile.am MyBuilderNamespace.h VisitableMockObject_5_test.cpp Log Message: fixes for g++ 2.95.3 under OpenBsd 3.1 Index: AbstractInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractInvocationDispatcher_test.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- AbstractInvocationDispatcher_test.cpp 11 Mar 2005 00:24:57 -0000 1.17 +++ AbstractInvocationDispatcher_test.cpp 12 Mar 2005 17:50:55 -0000 1.18 @@ -206,7 +206,7 @@ CPPUNIT_ASSERT( s == MOCKPP_PCHAR( "??t1\nt2\n" )); aid.clear(); - s.clear(); + s = MOCKPP_PCHAR(""); CPPUNIT_ASSERT( aid.describeTo(s) == MOCKPP_PCHAR( "no expectations set" )); } Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Makefile.am,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- Makefile.am 6 Mar 2005 21:45:50 -0000 1.66 +++ Makefile.am 12 Mar 2005 17:50:55 -0000 1.67 @@ -2,10 +2,10 @@ CLEANFILES = *.~* *.~~* *~ -mock_test_LDADD = $(top_builddir)/mockpp/libmockpp.la -ldl -lstdc++ \ +mock_test_LDADD = $(top_builddir)/mockpp/libmockpp.la $(LIBDL) -lstdc++ \ $(EA_EXTRA_LIB) $(LIBCPPUNIT) -jmock_test_LDADD = $(top_builddir)/mockpp/libmockpp.la -ldl -lstdc++ \ +jmock_test_LDADD = $(top_builddir)/mockpp/libmockpp.la $(LIBDL) -lstdc++ \ $(EA_EXTRA_LIB) $(LIBCPPUNIT) AM_LDFLAGS = $(all_libraries) Index: IsInstanceOf_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/IsInstanceOf_test.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- IsInstanceOf_test.cpp 12 Mar 2005 10:16:06 -0000 1.8 +++ IsInstanceOf_test.cpp 12 Mar 2005 17:50:55 -0000 1.9 @@ -74,6 +74,15 @@ int a; }; +class C +{ + public: + + virtual ~C() { } + + int a; +}; + void IsInstanceOf_test::test_describe() { mockpp::IsInstanceOf<A> instance; @@ -87,12 +96,17 @@ { A a; B b; + C c; mockpp::IsInstanceOf<A> instance; CPPUNIT_ASSERT(instance.eval(a) == true); CPPUNIT_ASSERT(instance.eval(b) == true); - B &rb = b; - CPPUNIT_ASSERT(instance.eval(rb) == false); + + B &rb1 = *((B*) 0); + CPPUNIT_ASSERT(instance.eval(rb1) == false); + + B &rb2 = (B&) c; + CPPUNIT_ASSERT(instance.eval(rb2) == false); } Index: MyBuilderNamespace.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/MyBuilderNamespace.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- MyBuilderNamespace.h 22 Jan 2005 20:41:04 -0000 1.11 +++ MyBuilderNamespace.h 12 Mar 2005 17:50:55 -0000 1.12 @@ -30,6 +30,8 @@ #include <mockpp/matcher/InvokedRecorder.h> +#include <algorithm> + class MyBuilderNamespace : public mockpp::BuilderNamespace { Index: ChainingMockObjectSupport_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/ChainingMockObjectSupport_test.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ChainingMockObjectSupport_test.cpp 5 Jan 2005 19:30:05 -0000 1.22 +++ ChainingMockObjectSupport_test.cpp 12 Mar 2005 17:50:55 -0000 1.23 @@ -125,16 +125,32 @@ }; +class C +{ + public: + + virtual ~C() { } + + int c; +}; + + void ChainingMockObjectSupport_test::test_instance() { A a; B b; + C c; mockpp::Constraint<A>::AP instance0 = mockpp::isA( a ); mockpp::Constraint<A>::AP instance = mockpp::isA( A() ); CPPUNIT_ASSERT( instance->eval( a ) == true ); CPPUNIT_ASSERT( instance->eval( b ) == true ); - CPPUNIT_ASSERT( instance->eval( *( reinterpret_cast<B*>( 0 ) ) ) == false ); + + B &rb1 = *((B*) 0); + CPPUNIT_ASSERT( instance->eval( rb1 ) == false ); + + B &rb2 = (B&) c; + CPPUNIT_ASSERT( instance->eval( rb2 ) == false ); } Index: VisitableMockObject_5_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/VisitableMockObject_5_test.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- VisitableMockObject_5_test.cpp 4 Mar 2005 17:40:32 -0000 1.22 +++ VisitableMockObject_5_test.cpp 12 Mar 2005 17:50:55 -0000 1.23 @@ -470,7 +470,6 @@ MOCKPP_CONST_VISITABLE_EXT1(MyVisitableMockObject_5ex, int, abc_const_visitable1, const CA&, int, Ext, CA); - MOCKPP_CONST_VISITABLE_EXT0(MyVisitableMockObject_5ex, int, abc_const_visitable0, int, Ext); bool isClear() Index: AbstractDynamicChainingMock_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractDynamicChainingMock_test.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- AbstractDynamicChainingMock_test.cpp 27 Feb 2005 11:48:16 -0000 1.21 +++ AbstractDynamicChainingMock_test.cpp 12 Mar 2005 17:50:55 -0000 1.22 @@ -210,6 +210,7 @@ public: void setProp() {} + int getProp() { return 0; @@ -226,7 +227,7 @@ void AbstractDynamicChainingMock_test::test_describer() { -#ifndef __BORLANDC__ // todo +#if !defined(__BORLANDC__) && (__GNUC__ >= 3) // @todo make compiling mockpp::AbstractDynamicChainingMock<int, GetterInvocation>::Describer desc; CPPUNIT_ASSERT(desc.hasDescription() == false); |
From: Ewald A. <ewa...@us...> - 2005-03-12 17:51:05
|
Update of /cvsroot/mockpp/mockpp/mockpp/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23860/mockpp/examples Modified Files: Makefile.am Log Message: fixes for g++ 2.95.3 under OpenBsd 3.1 Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/examples/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.am 5 Jan 2005 14:39:59 -0000 1.10 +++ Makefile.am 12 Mar 2005 17:50:54 -0000 1.11 @@ -2,7 +2,7 @@ INCLUDES = $(all_includes) -I$(top_srcdir) $(EA_EXTRA_INC) -LDADD = ../libmockpp.la $(LIBCPPUNIT) +LDADD = ../libmockpp.la $(LIBCPPUNIT) $(EA_EXTRA_LIB) AM_LDFLAGS = $(all_libraries) noinst_PROGRAMS = mock_greeter @@ -12,7 +12,8 @@ mock_greeter_SOURCES = mock_greeter.cpp compile-test: - g++ $(srcdir)/mock_greeter.cpp -o /tmp/mock_greeter -lmockpp -lcppunit $(EA_EXTRA_LIB) $(EA_EXTRA_INC) -mock_greeter_LDADD = $(top_builddir)/mockpp/libmockpp.la -ldl $(LIBCPPUNIT) \ + g++ $(srcdir)/mock_greeter.cpp -o /tmp/mock_greeter + +mock_greeter_LDADD = $(top_builddir)/mockpp/libmockpp.la $(LIBDL) $(LIBCPPUNIT) \ -lstdc++ mock_greeter_LDFLAGS = -L/opt/intel_cc_80/lib |
From: Ewald A. <ewa...@us...> - 2005-03-12 10:16:21
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6573/mockpp/tests Modified Files: IsInstanceOf_test.cpp Log Message: fix gcc 2.95.3 Index: IsInstanceOf_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/IsInstanceOf_test.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- IsInstanceOf_test.cpp 30 Dec 2004 20:54:06 -0000 1.7 +++ IsInstanceOf_test.cpp 12 Mar 2005 10:16:06 -0000 1.8 @@ -91,7 +91,8 @@ mockpp::IsInstanceOf<A> instance; CPPUNIT_ASSERT(instance.eval(a) == true); CPPUNIT_ASSERT(instance.eval(b) == true); - CPPUNIT_ASSERT(instance.eval(*(static_cast<B*>(0))) == false); + B &rb = b; + CPPUNIT_ASSERT(instance.eval(rb) == false); } |
From: Ewald A. <ewa...@us...> - 2005-03-11 00:25:40
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22866/mockpp Modified Files: ExpectationBoundary.h ExpectationConglomeration.h ExpectationSegment.h ExpectationSet.h VerifyingTestCaller.h Log Message: scope fixes for gcc-3.4.3 Index: ExpectationConglomeration.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ExpectationConglomeration.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ExpectationConglomeration.h 27 Feb 2005 11:48:14 -0000 1.16 +++ ExpectationConglomeration.h 11 Mar 2005 00:24:54 -0000 1.17 @@ -74,7 +74,7 @@ actualItems.insert(actualItem); haveActualValue = true; - if (shouldCheckImmediately()) + if (this->shouldCheckImmediately()) checkImmediateValue(actualItem); } @@ -99,7 +99,7 @@ { expectedSingleItems.push_back(expectedItem); expectNothing = false; - setHasExpectations(); + this->setHasExpectations(); return *this; } @@ -113,7 +113,7 @@ { expectedBoundaryItems.push_back(Boundary (lower, upper)); expectNothing = false; - setHasExpectations(); + this->setHasExpectations(); return *this; } @@ -178,15 +178,15 @@ } else { - if (!hasExpectations() ) + if (!this->hasExpectations() ) return; String fmt = i18n(MOCKPP_PCHAR("%1 expected a value.")); - fmt << getVerifiableName(); + fmt << this->getVerifiableName(); MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue ); fmt = i18n(MOCKPP_PCHAR("%1 did not receive the expected item set.")); - fmt << getVerifiableName(); + fmt << this->getVerifiableName(); typename std::set<T>::const_iterator it; for (it = actualItems.begin(); it != actualItems.end(); ++it) MOCKPP_ASSERT_TRUE_MESSAGE(fmt, contains(*it)); @@ -205,7 +205,7 @@ { expectNothing = true; clearExpectation(); - setHasExpectations(); + this->setHasExpectations(); } Index: VerifyingTestCaller.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VerifyingTestCaller.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- VerifyingTestCaller.h 30 Jan 2005 18:02:29 -0000 1.7 +++ VerifyingTestCaller.h 11 Mar 2005 00:24:54 -0000 1.8 @@ -112,7 +112,7 @@ */ std::string toString() const { - return "VerifyingTestCaller " + getName(); + return "VerifyingTestCaller " + this->getName(); } private: Index: ExpectationSet.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ExpectationSet.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- ExpectationSet.h 27 Feb 2005 11:48:14 -0000 1.30 +++ ExpectationSet.h 11 Mar 2005 00:24:54 -0000 1.31 @@ -72,7 +72,7 @@ actualItems.insert(actualItem); haveActualValue = true; - if (shouldCheckImmediately()) + if (this->shouldCheckImmediately()) checkImmediateValue(actualItem); } @@ -97,7 +97,7 @@ { expectNothing = false; expectedItems.insert(expectedItem); - setHasExpectations(); + this->setHasExpectations(); return *this; } @@ -132,7 +132,7 @@ } else { - if (!hasExpectations() ) + if (!this->hasExpectations() ) return; String fmt = i18n(MOCKPP_PCHAR("%1 expected a value.")); @@ -164,7 +164,7 @@ { expectNothing = true; clearExpectation(); - setHasExpectations(); + this->setHasExpectations(); } Index: ExpectationSegment.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ExpectationSegment.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- ExpectationSegment.h 27 Feb 2005 11:48:14 -0000 1.24 +++ ExpectationSegment.h 11 Mar 2005 00:24:54 -0000 1.25 @@ -94,7 +94,7 @@ { haveActualValue = true; myActualString = aString; - if (shouldCheckImmediately()) + if (this->shouldCheckImmediately()) { verify(); } @@ -108,7 +108,7 @@ { myExpectedSegment = segment; expectNothing = false; - setHasExpectations(); + this->setHasExpectations(); } @@ -121,7 +121,7 @@ void setExpectNothing() { expectNothing = true; - setHasExpectations(); + this->setHasExpectations(); } @@ -133,17 +133,17 @@ if( expectNothing ) { String fmt = i18n(MOCKPP_PCHAR("%1 expected no value.")); - fmt << getVerifiableName(); + fmt << this->getVerifiableName(); MOCKPP_ASSERT_FALSE_MESSAGE(fmt, haveActualValue ); } else { - if (!hasExpectations() ) + if (!this->hasExpectations() ) return; String fmt = i18n(MOCKPP_PCHAR("%1 expected a value.")); - fmt << getVerifiableName(); + fmt << this->getVerifiableName(); MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue ); MOCKPP_ASSERT_INCLUDES_MESSAGE( Index: ExpectationBoundary.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ExpectationBoundary.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ExpectationBoundary.h 27 Feb 2005 11:48:14 -0000 1.17 +++ ExpectationBoundary.h 11 Mar 2005 00:24:53 -0000 1.18 @@ -77,7 +77,7 @@ { actualValue = value; haveActualValue = true; - if (shouldCheckImmediately()) + if (this->shouldCheckImmediately()) { verify(); } @@ -94,7 +94,7 @@ lower_bound = lower; upper_bound = upper; expectNothing = false; - setHasExpectations(); + this->setHasExpectations(); } @@ -168,7 +168,7 @@ { expectNothing = true; clearActual(); - setHasExpectations(); + this->setHasExpectations(); } @@ -180,25 +180,25 @@ if( expectNothing ) { String fmt = i18n(MOCKPP_PCHAR("%1 expected no value.")); - fmt << getVerifiableName(); + fmt << this->getVerifiableName(); MOCKPP_ASSERT_FALSE_MESSAGE(fmt, haveActualValue ); } else { - if (!hasExpectations() ) + if (!this->hasExpectations() ) return; String fmt = i18n(MOCKPP_PCHAR("%1 expected a value.")); - fmt << getVerifiableName(); + fmt << this->getVerifiableName(); MOCKPP_ASSERT_TRUE_MESSAGE(fmt, haveActualValue ); fmt = i18n(MOCKPP_PCHAR("%1 received a value of %2 which is less than the expected value of %3.")); - fmt << getVerifiableName() << actualValue << lower_bound; + fmt << this->getVerifiableName() << actualValue << lower_bound; MOCKPP_ASSERT_TRUE_MESSAGE(fmt, lower_bound <= actualValue ); fmt = i18n(MOCKPP_PCHAR("%1 received a value of %2 which is greater than the expected value of %3.")); - fmt << getVerifiableName() << actualValue << upper_bound; + fmt << this->getVerifiableName() << actualValue << upper_bound; MOCKPP_ASSERT_TRUE_MESSAGE(fmt, actualValue <= upper_bound); } } @@ -212,9 +212,6 @@ { this->clearHasExpectations(); } - - - }; |
From: Ewald A. <ewa...@us...> - 2005-03-11 00:25:39
|
Update of /cvsroot/mockpp/mockpp/mockpp/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22866/mockpp/builder Modified Files: MatchBuilder.h Log Message: scope fixes for gcc-3.4.3 Index: MatchBuilder.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/builder/MatchBuilder.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- MatchBuilder.h 30 Jan 2005 12:09:17 -0000 1.34 +++ MatchBuilder.h 11 Mar 2005 00:24:54 -0000 1.35 @@ -42,6 +42,7 @@ #include <mockpp/chaining/StubMatchersCollection.h> #include <mockpp/builder/StubBuilder.h> +#include <mockpp/builder/BuilderNamespace.h> #include <mockpp/matcher/InvokedRecorder.h> #include <mockpp/matcher/InvokedAfterMatcher.h> @@ -52,8 +53,29 @@ namespace mockpp { -class BuilderNamespace; -class MatchBuilderAdapterBase; +/** Base for a helper class for convenient handling of match builders. + * @internal + */ +class MatchBuilderAdapterBase +{ + public: + + /** Returns the internal builder + * @return pointer to builder + */ + virtual void *getBuilder() const = 0; + + /** Destructs the adapter + */ + virtual ~MatchBuilderAdapterBase() + {} + + /** Adds another match to the builder + * @param customMatcher pointer to matcher object + */ + virtual void match( TypelessMatcher::AP customMatcher ) = 0; +}; + /** Builder class for matcher related purposes. * @ingroup grp_chainer @@ -81,7 +103,7 @@ */ MatchBuilder<R, I>& after( const String &priorCallID ) { - setupOrderingAfterMatchers( *getBuilderNamespace(), priorCallID, priorCallID ); + this->setupOrderingAfterMatchers( *getBuilderNamespace(), priorCallID, priorCallID ); return *this; } @@ -92,7 +114,7 @@ */ MatchBuilder<R, I>& before( const String &subsequentCallID ) { - setupOrderingBeforeMatchers( *getBuilderNamespace(), subsequentCallID, subsequentCallID ); + this->setupOrderingBeforeMatchers( *getBuilderNamespace(), subsequentCallID, subsequentCallID ); return *this; } @@ -104,7 +126,7 @@ */ MatchBuilder<R, I>& after( BuilderNamespace &otherMock, const String &priorCallID ) { - setupOrderingAfterMatchers( otherMock, priorCallID, priorCallID + MOCKPP_PCHAR( " on " ) + otherMock.getIdent() ); + this->setupOrderingAfterMatchers( otherMock, priorCallID, priorCallID + MOCKPP_PCHAR( " on " ) + otherMock.getIdent() ); return *this; } @@ -116,7 +138,7 @@ */ MatchBuilder<R, I>& before( BuilderNamespace &otherMock, const String &subsequentCallID ) { - setupOrderingBeforeMatchers( otherMock, subsequentCallID, subsequentCallID + MOCKPP_PCHAR( " on " ) + otherMock.getIdent() ); + this->setupOrderingBeforeMatchers( otherMock, subsequentCallID, subsequentCallID + MOCKPP_PCHAR( " on " ) + otherMock.getIdent() ); return *this; } @@ -180,30 +202,6 @@ }; -/** Base for a helper class for convenient handling of match builders. - * @internal - */ -class MatchBuilderAdapterBase -{ - public: - - /** Returns the internal builder - * @return pointer to builder - */ - virtual void *getBuilder() const = 0; - - /** Destructs the adapter - */ - virtual ~MatchBuilderAdapterBase() - {} - - /** Adds another match to the builder - * @param customMatcher pointer to matcher object - */ - virtual void match( TypelessMatcher::AP customMatcher ) = 0; -}; - - /** A helper class for convenient handling of match builders. * @internal */ |
From: Ewald A. <ewa...@us...> - 2005-03-11 00:25:39
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22866 Modified Files: ChangeLog TODO mockpp.kdevelop Log Message: scope fixes for gcc-3.4.3 Index: TODO =================================================================== RCS file: /cvsroot/mockpp/mockpp/TODO,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- TODO 4 Mar 2005 23:36:59 -0000 1.38 +++ TODO 11 Mar 2005 00:24:53 -0000 1.39 @@ -1,5 +1,5 @@ -MixedMockObject +reset() in ChainableMockObjects DOC: ---- Index: mockpp.kdevelop =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp.kdevelop,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- mockpp.kdevelop 18 Feb 2005 21:07:53 -0000 1.64 +++ mockpp.kdevelop 11 Mar 2005 00:24:53 -0000 1.65 @@ -17,7 +17,7 @@ </ignoreparts> <projectdirectory>.</projectdirectory> <absoluteprojectpath>false</absoluteprojectpath> - <description/> + <description></description> <secondaryLanguages> <language>Perl</language> <language>Bash</language> @@ -28,7 +28,7 @@ <kdevautoproject> <general> <activetarget>mockpp/tests/mock_test</activetarget> - <useconfiguration>unicode_debug</useconfiguration> + <useconfiguration>unicode_gcc_3_4</useconfiguration> </general> <run> <mainprogram/> @@ -61,18 +61,18 @@ <envvars/> <configargs>--enable-unicode</configargs> <builddir>/home/compile/mockpp/u</builddir> - <topsourcedir/> - <cppflags/> - <ldflags/> + <topsourcedir></topsourcedir> + <cppflags></cppflags> + <ldflags></ldflags> <ccompiler>kdevgccoptions</ccompiler> <cxxcompiler>kdevgppoptions</cxxcompiler> <f77compiler>kdevg77options</f77compiler> - <ccompilerbinary/> - <cxxcompilerbinary/> - <f77compilerbinary/> - <cflags/> - <cxxflags/> - <f77flags/> + <ccompilerbinary></ccompilerbinary> + <cxxcompilerbinary></cxxcompilerbinary> + <f77compilerbinary></f77compilerbinary> + <cflags></cflags> + <cxxflags></cxxflags> + <f77flags></f77flags> </unicode> <ascii> <envvars/> @@ -93,7 +93,7 @@ </ascii> <unicode_debug> <envvars/> - <configargs>--enable-unicode --enable-debug=full</configargs> + <configargs>--enable-unicode --enable-debug=full prefix=/tmp/install</configargs> <builddir>/home/compile/mockpp/u</builddir> <topsourcedir/> <cppflags/> @@ -125,19 +125,36 @@ <cxxflags>-O0 -g -Wall -wd383 -wd981</cxxflags> <f77flags/> </intel_unicode_debug> + <unicode_gcc_3_4> + <envvars/> + <configargs>--enable-unicode --enable-debug=full prefix=/tmp/install</configargs> + <builddir>/home/compile/mockpp/gcc-3.4</builddir> + <topsourcedir></topsourcedir> + <cppflags></cppflags> + <ldflags></ldflags> + <ccompiler>kdevgccoptions</ccompiler> + <cxxcompiler>kdevgppoptions</cxxcompiler> + <f77compiler>kdevg77options</f77compiler> + <ccompilerbinary></ccompilerbinary> + <cxxcompilerbinary>g++-3.4.3</cxxcompilerbinary> + <f77compilerbinary></f77compilerbinary> + <cflags></cflags> + <cxxflags>-O0 -g -Wall </cxxflags> + <f77flags></f77flags> + </unicode_gcc_3_4> </configurations> </kdevautoproject> <kdevdebugger> <general> <dbgshell>libtool</dbgshell> - <programargs/> - <gdbpath/> + <programargs></programargs> + <gdbpath></gdbpath> <breakonloadinglibs>true</breakonloadinglibs> <separatetty>false</separatetty> <floatingtoolbar>true</floatingtoolbar> - <configGdbScript/> - <runShellScript/> - <runGdbScript/> + <configGdbScript></configGdbScript> + <runShellScript></runShellScript> + <runGdbScript></runGdbScript> </general> <display> <staticmembers>true</staticmembers> Index: ChangeLog =================================================================== RCS file: /cvsroot/mockpp/mockpp/ChangeLog,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- ChangeLog 4 Mar 2005 21:11:32 -0000 1.33 +++ ChangeLog 11 Mar 2005 00:24:53 -0000 1.34 @@ -3,6 +3,9 @@ mockpp history -------------- +2005-03-04 1.6.0: - MixedMockObject combines enhanced mock objects + - scope fixes for g++ 3.4.3 + 2005-03-04 1.5.0: - added class ConstraintList - VisitableMockObjects and the according controller also take Constraints as objects instead of actual values. |
From: Ewald A. <ewa...@us...> - 2005-03-11 00:25:08
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22866/mockpp/chaining Modified Files: AbstractDynamicChainingMock.h FIFOInvocationDispatcher.h InvocationMocker.h LIFOInvocationDispatcher.h Log Message: scope fixes for gcc-3.4.3 Index: InvocationMocker.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/InvocationMocker.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- InvocationMocker.h 27 Feb 2005 11:48:15 -0000 1.23 +++ InvocationMocker.h 11 Mar 2005 00:24:55 -0000 1.24 @@ -63,10 +63,12 @@ class InvocationMockerBase : public Invokable<R, I>, public StubMatchersCollection<R, I> { - protected: + public: class DescriberBase; + protected: + /** Constructs the object * @param in_describer pointer to describer object * @param defaultStub pointer to default stub object @@ -128,7 +130,7 @@ catch ( const AssertionFailedError & error ) { throw AssertionFailedError( __LINE__, __FILE__, - error.getMessage() + MOCKPP_PCHAR( "\n" ) + toString() ); + error.getMessage() + MOCKPP_PCHAR( "\n" ) + this->toString() ); } } @@ -305,7 +307,8 @@ Stub<R, I> *stub, const String &name ) const { - for ( InvocationMockerBase<R, I>::ConstIterator it = matchers.begin(); it != matchers.end(); ++it ) + typename InvocationMockerBase<R, I>::ConstIterator it; + for (it = matchers.begin(); it != matchers.end(); ++it ) { InvocationMatcher<I>* matcher = *it; @@ -375,9 +378,9 @@ */ virtual R invoke( const I &invocation ) { - for ( Iterator it = matchers.begin(); it != matchers.end(); ++it ) + for ( Iterator it = this->matchers.begin(); it != this->matchers.end(); ++it ) ( *it ) ->incInvoked( invocation ); - return stub->invoke( invocation ); + return this->stub->invoke( invocation ); } }; @@ -423,9 +426,9 @@ */ virtual void invoke( const I &invocation ) { - for ( Iterator it = matchers.begin(); it != matchers.end(); ++it ) + for ( Iterator it = this->matchers.begin(); it != this->matchers.end(); ++it ) ( *it ) ->incInvoked( invocation ); - stub->invoke( invocation ); + this->stub->invoke( invocation ); } }; @@ -463,9 +466,9 @@ \ void mockpp::InvocationMocker<void, I>::invoke( const I &invocation ) \ { \ - for ( Iterator it = matchers.begin(); it != matchers.end(); ++it ) \ + for ( Iterator it = this->matchers.begin(); it != this->matchers.end(); ++it ) \ ( *it ) ->incInvoked( invocation ); \ - stub->invoke( invocation ); \ + this->stub->invoke( invocation ); \ } Index: LIFOInvocationDispatcher.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/LIFOInvocationDispatcher.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- LIFOInvocationDispatcher.h 12 Jan 2005 20:25:06 -0000 1.9 +++ LIFOInvocationDispatcher.h 11 Mar 2005 00:24:55 -0000 1.10 @@ -59,8 +59,8 @@ */ virtual R dispatch( const I &invocation ) { - Iterator it = invokables.rbegin(); - Iterator end = invokables.rend(); + Iterator it = this->invokables.rbegin(); + Iterator end = this->invokables.rend(); for ( /**/; it != end; ++it ) { @@ -68,7 +68,7 @@ return ( *it ) ->invoke( invocation ); } - return defaultStub->invoke( invocation ); + return this->defaultStub->invoke( invocation ); } }; @@ -91,8 +91,8 @@ */ virtual void dispatch( const I &invocation ) { - Iterator it = invokables.rbegin(); - Iterator end = invokables.rend(); + Iterator it = this->invokables.rbegin(); + Iterator end = this->invokables.rend(); for ( /**/; it != end; ++it ) { if ( ( *it ) ->matches( invocation ) ) @@ -102,7 +102,7 @@ } } - defaultStub->invoke( invocation ); + this->defaultStub->invoke( invocation ); } }; @@ -122,8 +122,8 @@ #define MOCKPP_LIFOINVOCATIONDISPATCHER_PTI_IMPL(I) \ void mockpp::LIFOInvocationDispatcher<void, I>::dispatch( const I &invocation ) \ { \ - Iterator it = invokables.rbegin(); \ - Iterator end = invokables.rend(); \ + Iterator it = this->invokables.rbegin(); \ + Iterator end = this->invokables.rend(); \ for ( /**/; it != end; ++it ) \ { \ if ( ( *it ) ->matches( invocation ) ) \ @@ -133,7 +133,7 @@ } \ } \ \ - defaultStub->invoke( invocation ); \ + this->defaultStub->invoke( invocation ); \ } \ #endif Index: AbstractDynamicChainingMock.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/AbstractDynamicChainingMock.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- AbstractDynamicChainingMock.h 27 Feb 2005 11:48:15 -0000 1.21 +++ AbstractDynamicChainingMock.h 11 Mar 2005 00:24:55 -0000 1.22 @@ -139,7 +139,7 @@ */ virtual String toString() const { - return getVerifiableName(); + return this->getVerifiableName(); } /** Gets the mock object's name @@ -147,7 +147,7 @@ */ String getMockName() const { - return getVerifiableName(); + return this->getVerifiableName(); } /** Sets the default stub for the object @@ -235,22 +235,22 @@ */ virtual R mockInvocation( const I &invocation ) { - if ( failure.get() != 0 ) - throw *failure.get(); + if ( this->failure.get() != 0 ) + throw *this->failure.get(); try { - return invocationDispatcher->dispatch( invocation ); + return this->invocationDispatcher->dispatch( invocation ); } catch ( const AssertionFailedError & assertion ) { DynamicChainingMockError<R, I> dme( this, invocation, - invocationDispatcher.get(), + this->invocationDispatcher.get(), assertion.getMessage() ); - failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage())); - throw *failure.get(); + this->failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage())); + throw *this->failure.get(); } } }; @@ -294,22 +294,22 @@ */ virtual void mockInvocation( const I &invocation ) { - if ( failure.get() != 0 ) - throw *failure.get(); + if ( this->failure.get() != 0 ) + throw *this->failure.get(); try { - invocationDispatcher->dispatch( invocation ); + this->invocationDispatcher->dispatch( invocation ); } catch ( const AssertionFailedError & assertion ) { DynamicChainingMockError<void, I> dme( this, invocation, - invocationDispatcher.get(), + this->invocationDispatcher.get(), assertion.getMessage() ); - failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage())); - throw *failure.get(); + this->failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage())); + throw *this->failure.get(); } } }; @@ -330,22 +330,22 @@ #define MOCKPP_ABSTRACTDYNAMICCHAININGMOCK_PTI_IMPL(I) \ void mockpp::AbstractDynamicChainingMock<void, I>::mockInvocation( const I &invocation ) \ { \ - if ( failure.get() != 0 ) \ - throw *failure.get(); \ + if ( this->failure.get() != 0 ) \ + throw *this->failure.get(); \ \ try \ { \ - invocationDispatcher->dispatch( invocation ); \ + this->invocationDispatcher->dispatch( invocation ); \ } \ \ catch ( const AssertionFailedError & assertion ) \ { \ DynamicChainingMockError<void, I> dme( this, \ invocation, \ - invocationDispatcher.get(), \ + this->invocationDispatcher.get(), \ assertion.getMessage() ); \ - failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage())); \ - throw *failure.get(); \ + this->failure.reset( new AssertionFailedError(__LINE__, __FILE__, dme.getMessage())); \ + throw *this->failure.get(); \ } \ } Index: FIFOInvocationDispatcher.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/FIFOInvocationDispatcher.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- FIFOInvocationDispatcher.h 12 Jan 2005 20:25:06 -0000 1.9 +++ FIFOInvocationDispatcher.h 11 Mar 2005 00:24:55 -0000 1.10 @@ -60,15 +60,15 @@ */ virtual R dispatch( const I &invocation ) { - Iterator it = invokables.begin(); - Iterator end = invokables.end(); + Iterator it = this->invokables.begin(); + Iterator end = this->invokables.end(); for ( /**/; it != end; ++it ) { if ( ( *it ) ->matches( invocation ) ) return ( *it ) ->invoke( invocation ); } - return defaultStub->invoke( invocation ); + return this->defaultStub->invoke( invocation ); } }; @@ -91,8 +91,8 @@ */ virtual void dispatch( const I &invocation ) { - Iterator it = invokables.begin(); - Iterator end = invokables.end(); + Iterator it = this->invokables.begin(); + Iterator end = this->invokables.end(); for ( /**/; it != end; ++it ) { if ( ( *it ) ->matches( invocation ) ) @@ -102,7 +102,7 @@ } } - defaultStub->invoke( invocation ); + this->defaultStub->invoke( invocation ); } }; @@ -122,8 +122,8 @@ #define MOCKPP_FIFOINVOCATIONDISPATCHER_PTI_IMPL(I) \ void mockpp::FIFOInvocationDispatcher<void, I>::dispatch( const I &invocation ) \ { \ - Iterator it = invokables.begin(); \ - Iterator end = invokables.end(); \ + Iterator it = this->invokables.begin(); \ + Iterator end = this->invokables.end(); \ for ( /**/; it != end; ++it ) \ { \ if ( ( *it ) ->matches( invocation ) ) \ @@ -133,7 +133,7 @@ } \ } \ \ - defaultStub->invoke( invocation ); \ + this->defaultStub->invoke( invocation ); \ } |
From: Ewald A. <ewa...@us...> - 2005-03-11 00:25:08
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22866/mockpp/tests Modified Files: AbstractInvocationDispatcher_test.cpp DynamicChainingMockError_test.cpp Log Message: scope fixes for gcc-3.4.3 Index: DynamicChainingMockError_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/DynamicChainingMockError_test.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- DynamicChainingMockError_test.cpp 30 Dec 2004 20:54:06 -0000 1.13 +++ DynamicChainingMockError_test.cpp 11 Mar 2005 00:24:57 -0000 1.14 @@ -75,7 +75,7 @@ virtual R dispatch( const I &invocation ) { - return defaultStub->invoke(invocation); + return this->defaultStub->invoke(invocation); } }; Index: AbstractInvocationDispatcher_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/AbstractInvocationDispatcher_test.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- AbstractInvocationDispatcher_test.cpp 27 Feb 2005 11:48:16 -0000 1.16 +++ AbstractInvocationDispatcher_test.cpp 11 Mar 2005 00:24:57 -0000 1.17 @@ -124,7 +124,7 @@ virtual R dispatch( const I &invocation ) { - return defaultStub->invoke(invocation); + return this->defaultStub->invoke(invocation); } }; |
From: Ewald A. <ewa...@us...> - 2005-03-11 00:25:07
|
Update of /cvsroot/mockpp/mockpp/mockpp/compat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22866/mockpp/compat Modified Files: Formatter.h Log Message: scope fixes for gcc-3.4.3 Index: Formatter.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/compat/Formatter.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- Formatter.h 5 Mar 2005 14:53:40 -0000 1.26 +++ Formatter.h 11 Mar 2005 00:24:57 -0000 1.27 @@ -295,7 +295,7 @@ mockpp::String & MOCKPP_EXPORT operator << (mockpp::String &formatter, const T *po) { mockpp::String s = MOCKPP_PCHAR("[") - + MOCKPP_GET_STRING(typeid(*o).name()) + + MOCKPP_GET_STRING(typeid(*po).name()) + MOCKPP_PCHAR("*]"); formatter << s; return formatter; |
From: Ewald A. <ewa...@us...> - 2005-03-11 00:25:07
|
Update of /cvsroot/mockpp/mockpp/mockpp/stub In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22866/mockpp/stub Modified Files: ThrowStub.h TypelessStub.h Log Message: scope fixes for gcc-3.4.3 Index: TypelessStub.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/stub/TypelessStub.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- TypelessStub.h 5 Mar 2005 15:50:48 -0000 1.11 +++ TypelessStub.h 11 Mar 2005 00:24:57 -0000 1.12 @@ -139,7 +139,7 @@ */ virtual R invoke( const I &invocation ) { - return stubber->typelessInvoke(); + return this->stubber->typelessInvoke(); } }; @@ -169,7 +169,7 @@ */ virtual void invoke( const I &invocation ) { - stubber->typelessInvoke(); + this->stubber->typelessInvoke(); } }; @@ -177,19 +177,19 @@ #else // MOCKPP_PTI_WEAKNESS Partial Template Instatiation Weakness /** Declare specialized methods for mockpp::InvocationMocker. - * Neccessary for compiler with weak template capabilities. + * Neccessary for compilers with weak template capabilities. */ #define MOCKPP_TYPELESSSTUBADAPTER_PTI_DECL(I) \ void mockpp::TypelessStubAdapter<void, I>::invoke( const I &); /** Implement specialized methods for mockpp::InvocationMocker. - * Neccessary for compiler with weak template capabilities. + * Neccessary for compilers with weak template capabilities. */ #define MOCKPP_TYPELESSSTUBADAPTER_PTI_IMPL(I) \ void mockpp::TypelessStubAdapter<void, I>::invoke( const I &invocation) \ { \ - stubber->typelessInvoke(); \ + this->stubber->typelessInvoke(); \ } Index: ThrowStub.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/stub/ThrowStub.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ThrowStub.h 30 Jan 2005 12:09:18 -0000 1.26 +++ ThrowStub.h 11 Mar 2005 00:24:57 -0000 1.27 @@ -111,7 +111,7 @@ */ virtual R typelessInvoke() { - throwable.get()->throw_me(); + this->throwable.get()->throw_me(); return R(); // avoids warnings } }; @@ -147,7 +147,7 @@ */ virtual void typelessInvoke() { - throwable.get()->throw_me(); + this->throwable.get()->throw_me(); } }; @@ -167,7 +167,7 @@ #define MOCKPP_THROWSTUB_PTI_IMPL(I) \ virtual void mockpp::ThrowStub<void, I>::typelessInvoke() \ { \ - throwable.get()->throw_me(); \ + this->throwable.get()->throw_me(); \ } |
From: Ewald A. <ewa...@us...> - 2005-03-06 21:48:48
|
Update of /cvsroot/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30414 Modified Files: mockpp.doxygen.in Log Message: update to doxygen 1.4.1 Index: mockpp.doxygen.in =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp.doxygen.in,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- mockpp.doxygen.in 8 Jan 2005 09:18:35 -0000 1.8 +++ mockpp.doxygen.in 6 Mar 2005 21:48:37 -0000 1.9 @@ -1,59 +1,468 @@ -# Doxyfile 1.2.13-20020210 +# Doxyfile 1.4.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] [...1245 lines suppressed...] +# remove the intermediate dot files that are used to generate +# the various graphs. + DOT_CLEANUP = YES + #--------------------------------------------------------------------------- -# Configuration options related to the search engine +# Configuration::additions related to the search engine #--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + SEARCHENGINE = YES -#CGI_NAME = searchdoxy.cgi -#CGI_URL = http://arnold.dyndns.org/cgi-bin -#DOC_URL = http://arnold.dyndns.org/mockpp -#DOC_ABSPATH = /usr/local/httpd/htdocs/mockpp -#BIN_ABSPATH = /usr/bin -#EXT_DOC_PATHS = |
From: Ewald A. <ewa...@us...> - 2005-03-06 21:46:31
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29577/mockpp/tests Modified Files: Makefile.am Added Files: MixedMockObject_5_test.cpp Log Message: restructured for new MixedMockObject class Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Makefile.am,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- Makefile.am 4 Mar 2005 20:26:40 -0000 1.65 +++ Makefile.am 6 Mar 2005 21:45:50 -0000 1.66 @@ -36,7 +36,7 @@ VisitableMockObject_5_test.cpp VisitableMockObject_void_test.cpp VisitableMockObject_1_void_test.cpp \ VisitableMockObject_2_void_test.cpp VisitableMockObject_3_void_test.cpp VisitableMockObject_4_void_test.cpp \ VisitableMockObject_5_void_test.cpp VerifyingTestCase_test.cpp classes_ABCDE.cpp \ - VerifyingTestCaller_test.cpp TrackingCounter_test.cpp + VerifyingTestCaller_test.cpp TrackingCounter_test.cpp MixedMockObject_5_test.cpp mock_test_count: list=mock_test.files; \ --- NEW FILE: MixedMockObject_5_test.cpp --- /*************************************************************************** MixedMockObject_5_test.cpp - unit tests for MixedMockObject class and 5 parameter methods ------------------- begin : Sat Mar 05 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de $Id: MixedMockObject_5_test.cpp,v 1.1 2005/03/06 21:45:50 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ #include <mockpp/mockpp.h> // always first #ifndef HAVE_CPPUNIT # warning CppUnit not available at compile time #else #include <mockpp/ExpectationValue.h> #include <mockpp/MixedMockObject.h> #include <mockpp/util/AssertMo.h> #include <mockpp/chaining/ChainingMockObjectSupport.h> #include <mockpp/constraint/IsEqual.h> #include <mockpp/constraint/IsNot.h> #include "classes_ABCDE.h" #include <cppunit/extensions/HelperMacros.h> class MixedMockObject_5_test : public CppUnit::TestFixture { public: CPPUNIT_TEST_SUITE( MixedMockObject_5_test ); CPPUNIT_TEST(test_controller); CPPUNIT_TEST(test_return); CPPUNIT_TEST_SUITE_END(); public: void test_controller(); void test_return(); }; CPPUNIT_TEST_SUITE_REGISTRATION(MixedMockObject_5_test); class MyMixedMockObject_5_Interface { public: virtual int chain_mixed5 (const CA&, const CB&, const CC&, const CD&, const CE&) = 0; virtual int chain_mixed4 (const CA&, const CB&, const CC&, const CD&) = 0; virtual int chain_mixed3 (const CA&, const CB&, const CC&) = 0; virtual int chain_mixed2 (const CA&, const CB&) = 0; virtual int chain_mixed1 (const CA&) = 0; virtual int chain_mixed0 () = 0; virtual int visit_mixed5 (const CA&, const CB&, const CC&, const CD&, const CE&) = 0; virtual int visit_mixed4 (const CA&, const CB&, const CC&, const CD&) = 0; virtual int visit_mixed3 (const CA&, const CB&, const CC&) = 0; virtual int visit_mixed2 (const CA&, const CB&) = 0; virtual int visit_mixed1 (const CA&) = 0; virtual int visit_mixed0 () = 0; }; class MyMixedMockObject_5 : public mockpp::MixedMockObject, public MyMixedMockObject_5_Interface { public: MyMixedMockObject_5(const mockpp::String &name) : mockpp::MixedMockObject(name, 0), MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE5(chain_mixed5), MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE4(chain_mixed4), MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE3(chain_mixed3), MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE2(chain_mixed2), MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE1(chain_mixed1), MOCKPP_CONSTRUCT_MEMBERS_FOR_CHAINABLE0(chain_mixed0), MOCKPP_CONSTRUCT_MEMBERS_FOR_VISITABLE5(visit_mixed5), MOCKPP_CONSTRUCT_MEMBERS_FOR_VISITABLE4(visit_mixed4), MOCKPP_CONSTRUCT_MEMBERS_FOR_VISITABLE3(visit_mixed3), MOCKPP_CONSTRUCT_MEMBERS_FOR_VISITABLE2(visit_mixed2), MOCKPP_CONSTRUCT_MEMBERS_FOR_VISITABLE1(visit_mixed1), MOCKPP_CONSTRUCT_MEMBERS_FOR_VISITABLE0(visit_mixed0) {} MOCKPP_CHAINABLE5(MyMixedMockObject_5, int, chain_mixed5, CA, CB, CC, CD, CE); MOCKPP_CHAINABLE4(MyMixedMockObject_5, int, chain_mixed4, CA, CB, CC, CD); MOCKPP_CHAINABLE3(MyMixedMockObject_5, int, chain_mixed3, CA, CB, CC); MOCKPP_CHAINABLE2(MyMixedMockObject_5, int, chain_mixed2, CA, CB); MOCKPP_CHAINABLE1(MyMixedMockObject_5, int, chain_mixed1, CA); MOCKPP_CHAINABLE0(MyMixedMockObject_5, int, chain_mixed0); MOCKPP_VISITABLE5(MyMixedMockObject_5, int, visit_mixed5, CA, CB, CC, CD, CE); MOCKPP_VISITABLE4(MyMixedMockObject_5, int, visit_mixed4, CA, CB, CC, CD); MOCKPP_VISITABLE3(MyMixedMockObject_5, int, visit_mixed3, CA, CB, CC); MOCKPP_VISITABLE2(MyMixedMockObject_5, int, visit_mixed2, CA, CB); MOCKPP_VISITABLE1(MyMixedMockObject_5, int, visit_mixed1, CA); MOCKPP_VISITABLE0(MyMixedMockObject_5, int, visit_mixed0); }; void MixedMockObject_5_test::test_controller() { MyMixedMockObject_5 mvo(MOCKPP_PCHAR("mvo")); MOCKPP_CONTROLLER_FOR(MyMixedMockObject_5, visit_mixed5) ctr (&mvo); ctr.addThrowable(mockpp::make_throwable(std::string("exceptional string"))); ctr.addThrowable(std::string("exceptional string"), 3); ctr.setDefaultThrowable(mockpp::make_throwable(int(123))); ctr.addReturnValue(1); ctr.addReturnValue(11); ctr.setDefaultReturnValue(123); ctr.addResponseValue(0, 1, 2, 3, 4, 5); ctr.addResponseValue(1, 0, 2, 3, 4, 5); ctr.addResponseThrowable(mockpp::make_throwable(int(1)), 0, 2, 3, 4, 5); ctr.addResponseThrowable(mockpp::make_throwable(int(0)), 1, 2, 3, 4, 5); } void MixedMockObject_5_test::test_return() { MyMixedMockObject_5 mvo(MOCKPP_PCHAR("mvo")); MOCKPP_CONTROLLER_FOR(MyMixedMockObject_5, visit_mixed5) ctr (&mvo); ctr.setDefaultReturnValue(123); ctr.addReturnValue(1,2); ctr.addReturnValue(11, 2); mvo.visit_mixed5(1, 2, 3, 4, 5); mvo.visit_mixed5(1, 2, 3, 4, 5); mvo.visit_mixed5(2, 2, 3, 4, 5); mvo.visit_mixed5(2, 2, 3, 4, 5); mvo.visit_mixed5(3, 2, 3, 4, 5); mvo.visit_mixed5(4, 2, 3, 4, 5); mvo.activate(); CPPUNIT_ASSERT(1 == mvo.visit_mixed5(1, 2, 3, 4, 5)); CPPUNIT_ASSERT(1 == mvo.visit_mixed5(1, 2, 3, 4, 5)); CPPUNIT_ASSERT(11 == mvo.visit_mixed5(2, 2, 3, 4, 5)); CPPUNIT_ASSERT(11 == mvo.visit_mixed5(2, 2, 3, 4, 5)); CPPUNIT_ASSERT(123 == mvo.visit_mixed5(3, 2, 3, 4, 5)); CPPUNIT_ASSERT(123 == mvo.visit_mixed5(4, 2, 3, 4, 5)); mvo.verify(); } #endif // HAVE_CPPUNIT |
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29577/mockpp Modified Files: ChainableMockObject.cpp ChainableMockObject.h Makefile.am VisitableMockObject.cpp VisitableMockObject.h Added Files: MixedMockObject.cpp MixedMockObject.h Log Message: restructured for new MixedMockObject class Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/Makefile.am,v retrieving revision 1.70 retrieving revision 1.71 diff -u -d -r1.70 -r1.71 --- Makefile.am 4 Mar 2005 17:39:40 -0000 1.70 +++ Makefile.am 6 Mar 2005 21:45:51 -0000 1.71 @@ -15,9 +15,9 @@ $(top_builddir)/mockpp/chaining/libchaining.la $(top_builddir)/mockpp/builder/libbuilder.la libmockpp_la_SOURCES = ExpectationCounter.cpp mockpp.cpp Throwable.cpp \ - ThrowableList.cpp MockObject.cpp VisitableMockObject.cpp VerifiableList.cpp \ - Verifiable.cpp VerifyingTestCase.cpp SelfDescribing.cpp ChainableMockObject.cpp \ - VerifyingTestCaller.cpp TrackingCounter.cpp + ThrowableList.cpp MockObject.cpp VisitableMockObject.cpp VerifiableList.cpp \ + Verifiable.cpp VerifyingTestCase.cpp SelfDescribing.cpp ChainableMockObject.cpp \ + VerifyingTestCaller.cpp TrackingCounter.cpp MixedMockObject.cpp pkginclude_HEADERS = mockpp_config.h ReturnObjectList.h Expectation.h \ AbstractExpectation.h ExpectationValue.h ExpectationSegment.h ExpectationList.h \ --- NEW FILE: MixedMockObject.cpp --- /** @file @brief MockObject that merges all the advanced mock objects $Id: MixedMockObject.cpp,v 1.1 2005/03/06 21:45:52 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Sat Mar 05 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #include <mockpp/mockpp.h> // always first #include <mockpp/MixedMockObject.h> namespace mockpp { MOCKPP_EXPORT MixedMockObject::MixedMockObject(const String &name, VerifiableList *parent) : VerifiableList(name, parent) , VisitableMockObjectBase(name+MOCKPP_PCHAR("/Visitable"), parent) , ChainableMockObjectBase(name+MOCKPP_PCHAR("/Chainable")) { } MOCKPP_EXPORT MixedMockObject::~MixedMockObject() { } void MOCKPP_EXPORT MixedMockObject::verify() { visitableVerify(); chainableVerify(); } void MOCKPP_EXPORT MixedMockObject::clear() { reset(); } void MOCKPP_EXPORT MixedMockObject::reset() { visitableReset(); chainableClear(); } } // namespace mockpp --- NEW FILE: MixedMockObject.h --- /** @file @brief MockObject that merges all the advanced mock objects $Id: MixedMockObject.h,v 1.1 2005/03/06 21:45:52 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** begin : Sat Mar 05 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #ifndef MOCKPP_MixedMOCKOBJECT_H #define MOCKPP_MixedMOCKOBJECT_H #include <mockpp/mockpp.h> // always first #include <mockpp/VisitableMockObject.h> #include <mockpp/ChainableMockObject.h> namespace mockpp { /** A MockObject that merges all the advanced mock objects. * \ingroup grp_advanced_mo */ class MixedMockObject : public VerifiableList , public VisitableMockObjectBase , public ChainableMockObjectBase { public: /** Construct the item. * @param name human readable description about the object * @param parent parent verifiable */ MixedMockObject(const String &name, VerifiableList *parent = 0); /** Destruct the item. */ virtual ~MixedMockObject(); /** Frees all internal data. */ virtual void clear(); /** Frees all internal data. */ virtual void reset(); /** Verifies the object and the mock objects it contains.. * If it fails, an AssertionFailedError is thrown */ virtual void verify(); }; } // namespace mockpp #endif // MOCKPP_MixedMOCKOBJECT_H Index: ChainableMockObject.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ChainableMockObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ChainableMockObject.cpp 27 Feb 2005 11:48:14 -0000 1.15 +++ ChainableMockObject.cpp 6 Mar 2005 21:45:51 -0000 1.16 @@ -38,27 +38,25 @@ namespace mockpp { -MOCKPP_EXPORT ChainableMockObject::ChainableMockObject(const String &name, VerifiableList *parent) - : MockObject(name, parent) - , BuilderNamespace(name) +MOCKPP_EXPORT ChainableMockObjectBase::ChainableMockObjectBase(const String &name) + : BuilderNamespace(name) { } -MOCKPP_EXPORT ChainableMockObject::~ChainableMockObject() +MOCKPP_EXPORT ChainableMockObjectBase::~ChainableMockObjectBase() { - clear(); + chainableClear(); } -void MOCKPP_EXPORT ChainableMockObject::verify() +void MOCKPP_EXPORT ChainableMockObjectBase::chainableVerify() { - MockObject::verify(); checkPendingRecorders(); } -void MOCKPP_EXPORT ChainableMockObject::checkPendingRecorders() const +void MOCKPP_EXPORT ChainableMockObjectBase::checkPendingRecorders() const { String penders; while(pendingRecorders.size() != 0) @@ -73,13 +71,13 @@ if (penders.length() != 0) throw AssertionFailedError( __LINE__, __FILE__, - MOCKPP_PCHAR("Chaining mock object \"") + getVerifiableName() + MOCKPP_PCHAR("Chaining mock object \"") + getIdent() + MOCKPP_PCHAR( "\": there are unassigned idenfiers:\n " ) + penders); } -MatchBuilderAdapterBase * MOCKPP_EXPORT ChainableMockObject::lookupID( const String &id ) const +MatchBuilderAdapterBase * MOCKPP_EXPORT ChainableMockObjectBase::lookupID( const String &id ) const { TableType::const_iterator it = idTable.find( id ); if ( it == idTable.end() ) @@ -89,7 +87,7 @@ } -void MOCKPP_EXPORT ChainableMockObject::registerUniqueID( const String &id, MatchBuilderAdapterBase *builder ) +void MOCKPP_EXPORT ChainableMockObjectBase::registerUniqueID( const String &id, MatchBuilderAdapterBase *builder ) { MatchBuilderAdapterBase *tmb = lookupID(id); if ( tmb != 0 ) @@ -101,19 +99,19 @@ } -void MOCKPP_EXPORT ChainableMockObject::storeBuilder( AutoPointer<MatchBuilderAdapterBase> builder ) +void MOCKPP_EXPORT ChainableMockObjectBase::storeBuilder( AutoPointer<MatchBuilderAdapterBase> builder ) { allBuilders.push_back(builder.release()); } -void MOCKPP_EXPORT ChainableMockObject::addPendingRecorder(const String &id, InvokedRecorder::AP recorder) +void MOCKPP_EXPORT ChainableMockObjectBase::addPendingRecorder(const String &id, InvokedRecorder::AP recorder) { pendingRecorders.insert( std::make_pair(id, recorder.release()) ); } -void MOCKPP_EXPORT ChainableMockObject::storeID( const String &id, MatchBuilderAdapterBase *builder ) +void MOCKPP_EXPORT ChainableMockObjectBase::storeID( const String &id, MatchBuilderAdapterBase *builder ) { idTable.insert( std::make_pair(id, builder) ); @@ -126,7 +124,7 @@ } -void MOCKPP_EXPORT ChainableMockObject::clear() +void MOCKPP_EXPORT ChainableMockObjectBase::chainableClear() { while(idTable.size() != 0) { @@ -146,4 +144,33 @@ } +///////////////////////////////////////////////////////////////// + + +MOCKPP_EXPORT ChainableMockObject::ChainableMockObject(const String &name, VerifiableList *parent) + : MockObject(name, parent) + , ChainableMockObjectBase(name) +{ +} + + +MOCKPP_EXPORT ChainableMockObject::~ChainableMockObject() +{ + clear(); +} + + +void MOCKPP_EXPORT ChainableMockObject::verify() +{ + MockObject::verify(); + chainableVerify(); +} + + +void MOCKPP_EXPORT ChainableMockObject::clear() +{ + chainableClear(); +} + + } // namespace mockpp Index: ChainableMockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/ChainableMockObject.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- ChainableMockObject.h 4 Mar 2005 20:26:40 -0000 1.23 +++ ChainableMockObject.h 6 Mar 2005 21:45:51 -0000 1.24 @@ -49,12 +49,11 @@ namespace mockpp { -/** A generic object that can be used to replace a real world object for testing purposes. +/** Base for a generic object that can be used to replace a real world object for testing purposes. * It emulates the real world behaviour by feeding it "chained expectations". * \ingroup grp_advanced_mo */ -class ChainableMockObject : public MockObject, - public BuilderNamespace +class ChainableMockObjectBase : public BuilderNamespace { typedef std::map<String, MatchBuilderAdapterBase*> TableType; typedef std::multimap<String, InvokedRecorder*> PendingType; @@ -63,13 +62,12 @@ /** Construct the item. * @param name human readable description about the object - * @param parent parent verifiable */ - ChainableMockObject(const String &name, VerifiableList *parent = 0); + ChainableMockObjectBase(const String &name); /** Destruct the item. */ - virtual ~ChainableMockObject(); + virtual ~ChainableMockObjectBase(); /** Searches a name. * @internal @@ -96,11 +94,6 @@ */ virtual void storeBuilder( AutoPointer<MatchBuilderAdapterBase> builder ); - /** Frees all internal data. - * @internal - */ - virtual void clear(); - /** Stores another recorder object for later use. * @internal * Pending recorders occur when an after() or before() call occurs before the @@ -116,10 +109,17 @@ */ void checkPendingRecorders() const; // @todo make private + protected: + /** Verifies the object and the mock objects it contains.. * If it fails, an AssertionFailedError is thrown */ - virtual void verify(); + void chainableVerify(); + + /** Frees all internal data. + * @internal + */ + virtual void chainableClear(); private: @@ -136,6 +136,37 @@ }; +/** A generic object that can be used to replace a real world object for testing purposes. + * It emulates the real world behaviour by feeding it "chained expectations". + * \ingroup grp_advanced_mo + */ +class ChainableMockObject : public MockObject, + public ChainableMockObjectBase +{ + public: + + /** Construct the item. + * @param name human readable description about the object + * @param parent parent verifiable + */ + ChainableMockObject(const String &name, VerifiableList *parent = 0); + + /** Destruct the item. + */ + virtual ~ChainableMockObject(); + + /** Verifies the object and the mock objects it contains.. + * If it fails, an AssertionFailedError is thrown + */ + virtual void verify(); + + /** Frees all internal data. + * @internal + */ + virtual void clear(); +}; + + } // namespace mockpp Index: VisitableMockObject.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockObject.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- VisitableMockObject.cpp 5 Mar 2005 20:43:37 -0000 1.22 +++ VisitableMockObject.cpp 6 Mar 2005 21:45:52 -0000 1.23 @@ -36,77 +36,73 @@ namespace mockpp { -MOCKPP_EXPORT VisitableMockObject::VisitableMockObject(const String &name, VerifiableList *parent) - : MockObject(name, parent), - methodList(name+MOCKPP_PCSTRING("/methodList"), this) +MOCKPP_EXPORT VisitableMockObjectBase::VisitableMockObjectBase(const String &name, VerifiableList *parent) + :methodList(name+MOCKPP_PCSTRING("/methodList"), parent) { activated = false; } -void MOCKPP_EXPORT VisitableMockObject::addExpectedMethod(const std::string &name) const +MOCKPP_EXPORT VisitableMockObjectBase::~VisitableMockObjectBase() +{ +} + + +void MOCKPP_EXPORT VisitableMockObjectBase::addExpectedMethod(const std::string &name) const { MOCKPP_ASSERT_EQUALS(isActivated(), false); methodList.addExpected(name); } -void MOCKPP_EXPORT VisitableMockObject::addActualMethod(const std::string &name) const +void MOCKPP_EXPORT VisitableMockObjectBase::addActualMethod(const std::string &name) const { MOCKPP_ASSERT_EQUALS(isActivated(), true); methodList.addActual(name); } -void MOCKPP_EXPORT VisitableMockObject::activate() +void MOCKPP_EXPORT VisitableMockObjectBase::activate() { activated = true; } -bool MOCKPP_EXPORT VisitableMockObject::isActivated() const +bool MOCKPP_EXPORT VisitableMockObjectBase::isActivated() const { return activated; } -void MOCKPP_EXPORT VisitableMockObject::verify() +void MOCKPP_EXPORT VisitableMockObjectBase::visitableVerify() { - MockObject::verify(); for (unsigned i = 0; i < controllers.size(); ++i) controllers[i]->verify(); } -void MOCKPP_EXPORT VisitableMockObject::clear() -{ - reset(); -} - - -void MOCKPP_EXPORT VisitableMockObject::reset() +void MOCKPP_EXPORT VisitableMockObjectBase::visitableReset() { - MockObject::reset(); activated = false; for (unsigned i = 0; i < controllers.size(); ++i) controllers[i]->reset(); } -void MOCKPP_EXPORT VisitableMockObject::unsetThrowablesInline() +void MOCKPP_EXPORT VisitableMockObjectBase::unsetThrowablesInline() { for (unsigned i = 0; i < controllers.size(); ++i) controllers[i]->unsetThrowablesInline(); } -void MOCKPP_EXPORT VisitableMockObject::addController (Controller *ctr) +void MOCKPP_EXPORT VisitableMockObjectBase::addController (Controller *ctr) { controllers.push_back(ctr); } -void MOCKPP_EXPORT VisitableMockObject::removeController (Controller *ctr) +void MOCKPP_EXPORT VisitableMockObjectBase::removeController (Controller *ctr) { std::vector<Controller*>::iterator it = std::find (controllers.begin(), controllers.end(), ctr); @@ -115,7 +111,7 @@ } -unsigned MOCKPP_EXPORT VisitableMockObject::numController() const +unsigned MOCKPP_EXPORT VisitableMockObjectBase::numController() const { return controllers.size(); } @@ -123,6 +119,41 @@ ///////////////////////////////////////////////////////////////// + +MOCKPP_EXPORT VisitableMockObject::VisitableMockObject(const String &name, VerifiableList *parent) + : MockObject(name, parent) + , VisitableMockObjectBase(name, this) +{ +} + + +MOCKPP_EXPORT VisitableMockObject::~VisitableMockObject() +{ +} + + +void MOCKPP_EXPORT VisitableMockObject::verify() +{ + visitableVerify(); +} + + +void MOCKPP_EXPORT VisitableMockObject::reset() +{ + MockObject::reset(); + visitableReset(); +} + + +void MOCKPP_EXPORT VisitableMockObject::clear() +{ + reset(); +} + + +///////////////////////////////////////////////////////////////// + + MOCKPP_EXPORT VisitableMockObject::Controller::~Controller() { } Index: VisitableMockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockObject.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- VisitableMockObject.h 5 Mar 2005 20:43:07 -0000 1.37 +++ VisitableMockObject.h 6 Mar 2005 21:45:52 -0000 1.38 @@ -49,42 +49,28 @@ namespace mockpp { -/** A generic object that can be used to replace a real world object for testing purposes. +/** Base class for a generic object that can be used to replace a real world object for testing purposes. * It emulates the real world behaviour by feeding it values and exceptions. * \ingroup grp_advanced_mo */ -class VisitableMockObject : public MockObject +class VisitableMockObjectBase { public: - /** - * Construct the item. + /** Construct the item. * @param name human readable description about the object * @param parent parent verifiable */ - VisitableMockObject(const String &name, VerifiableList *parent = 0); + VisitableMockObjectBase(const String &name, VerifiableList *parent); - /** - * Verify that the expected and actual values are equal. - * If it fails, an AssertionFailedError is thrown + /** Destruct the item. */ - virtual void verify(); + virtual ~VisitableMockObjectBase(); - /** - * Changes from record mode to normal working mode so you can use the object + /** Changes from record mode to normal working mode so you can use the object */ void activate(); - /** - * Sets all internal objects to the state after construction. - */ - virtual void reset(); - - /** - * Sets all internal objects to the state after construction. - */ - virtual void clear(); - /** Switches exception handling back to pre-1.2 behaviour. * @see VisitableMockObject::Controller::unsetThrowablesInline() */ @@ -126,6 +112,17 @@ */ unsigned numController() const; + protected: + + /** Verify that the expected and actual values are equal. + * If it fails, an AssertionFailedError is thrown + */ + void visitableVerify(); + + /** Sets all internal objects to the state after construction. + */ + void visitableReset(); + private: mutable ExpectationList<std::string> methodList; @@ -133,6 +130,46 @@ std::vector<Controller*> controllers; }; + +/** A generic object that can be used to replace a real world object for testing purposes. + * It emulates the real world behaviour by feeding it values and exceptions. + * \ingroup grp_advanced_mo + */ +class VisitableMockObject : public MockObject + , public VisitableMockObjectBase +{ + public: + + /** + * Construct the item. + * @param name human readable description about the object + * @param parent parent verifiable + */ + VisitableMockObject(const String &name, VerifiableList *parent = 0); + + /** Destruct the item. + */ + virtual ~VisitableMockObject(); + + /** + * Verify that the expected and actual values are equal. + * If it fails, an AssertionFailedError is thrown + */ + virtual void verify(); + +/** + * Sets all internal objects to the state after construction. + */ + virtual void reset(); + + /** + * Sets all internal objects to the state after construction. + */ + virtual void clear(); +}; + + + /** * @defgroup grp_controller Controlling behaviour of a Visitable Mock Object */ |
From: Ewald A. <ewa...@us...> - 2005-03-05 20:45:32
|
Update of /cvsroot/mockpp/mockpp/mockpp/examples/tutorial In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27436/mockpp/examples/tutorial Modified Files: tut-visit.dox Log Message: fixed bad exmples Index: tut-visit.dox =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/examples/tutorial/tut-visit.dox,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- tut-visit.dox 4 Mar 2005 23:37:00 -0000 1.5 +++ tut-visit.dox 5 Mar 2005 20:45:09 -0000 1.6 @@ -169,11 +169,11 @@ the appended string "processed" so only this substring is verified: \code - mock.write(stringContains("processed")); - mock.write(stringContains("processed")); + mock.write(stringContains(std::string("processed"))); + mock.write(stringContains(std::string("processed"))); \endcode -In a similar manner the return value can be influence by passing the controller object +In a similar manner the return value can be influenced by passing the controller object according constraints instead of exact values. \code |
From: Ewald A. <ewa...@us...> - 2005-03-05 20:45:31
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27436/mockpp/docs/en Modified Files: dev_basic.docbook Log Message: fixed bad exmples Index: dev_basic.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_basic.docbook,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dev_basic.docbook 27 Feb 2005 11:48:16 -0000 1.10 +++ dev_basic.docbook 5 Mar 2005 20:45:09 -0000 1.11 @@ -121,11 +121,9 @@ ConstraintList <int> cl ("verifyValue", 0); - cl.addExpected(1); cl.addExpected(new IsGreaterOrEqual<int>(10)); <co id="great-eq-co" linkends="great-eq" /> cl.addExpected(new IsLessOrEqual<int>(20)); <co id="less-eq-co" linkends="less-eq" /> - cl.addActual(1); cl.addActual(13); cl.addActual(23); |
From: Ewald A. <ewa...@us...> - 2005-03-05 20:43:46
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26921/mockpp Modified Files: VisitableMockObject.cpp Log Message: added method for consistency Index: VisitableMockObject.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockObject.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- VisitableMockObject.cpp 27 Feb 2005 11:48:14 -0000 1.21 +++ VisitableMockObject.cpp 5 Mar 2005 20:43:37 -0000 1.22 @@ -78,6 +78,12 @@ } +void MOCKPP_EXPORT VisitableMockObject::clear() +{ + reset(); +} + + void MOCKPP_EXPORT VisitableMockObject::reset() { MockObject::reset(); |
From: Ewald A. <ewa...@us...> - 2005-03-05 20:43:16
|
Update of /cvsroot/mockpp/mockpp/mockpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26844/mockpp Modified Files: VisitableMockObject.h Log Message: extended docs Index: VisitableMockObject.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/VisitableMockObject.h,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- VisitableMockObject.h 4 Mar 2005 17:39:40 -0000 1.36 +++ VisitableMockObject.h 5 Mar 2005 20:43:07 -0000 1.37 @@ -80,6 +80,11 @@ */ virtual void reset(); + /** + * Sets all internal objects to the state after construction. + */ + virtual void clear(); + /** Switches exception handling back to pre-1.2 behaviour. * @see VisitableMockObject::Controller::unsetThrowablesInline() */ @@ -205,6 +210,13 @@ */ void setDefaultReturnValue (const your_type &rv); + /** Sets the default return value. + * This value is returned if there are no throwables available and if there + * are no other possible return values in a list. + * @param rv the default return value + */ + void setDefaultReturnValue (const your_type &rv); + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. @@ -228,6 +240,28 @@ unsigned count = std::numeric_limits < unsigned >::max ()); /** Adds another response value. + * Response values are determined on the parameter constraints you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 the 1. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const ret_type &rv, + const mockpp::ConstraintHolder<type1> &p1, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response throwable. + * Response throwables are determined on the parameter constraints you pass. This way the + * object throws an object that is totally based on the input. + * @param t the throwable + * @param p1 the 1. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(mockpp::Throwable *t, + const mockpp::ConstraintHolder<type1> &p1, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. * @param rv the return value @@ -252,6 +286,32 @@ unsigned count = std::numeric_limits < unsigned >::max ()); /** Adds another response value. + * Response values are determined on the parameter constraints you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const ret_type &rv, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response throwable. + * Response throwables are determined on the parameter constraints you pass. This way the + * object throws an object that is totally based on the input. + * @param t the throwable + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(mockpp::Throwable *t, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. * @param rv the return value @@ -277,12 +337,35 @@ const your_type1 &p1, const your_type2 &p2, const your_type3 &p3, unsigned count = std::numeric_limits < unsigned >::max ()); - /** Sets the default return value. - * This value is returned if there are no throwables available and if there - * are no other possible return values in a list. - * @param rv the default return value + /** Adds another response value. + * Response values are determined on the parameter constraints you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param p3 the 3. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. */ - void setDefaultReturnValue (const your_type &rv); + void addResponseValue(const ret_type &rv, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + const mockpp::ConstraintHolder<type3> &p3, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response throwable. + * Response throwables are determined on the parameter constraints you pass. This way the + * object throws an object that is totally based on the input. + * @param t the throwable + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param p3 the 3. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(mockpp::Throwable *t, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + const mockpp::ConstraintHolder<type3> &p3, + unsigned count = MOCKPP_UNLIMITED); /** Adds another response value. * Response values are determined on the parameters you pass. This way the @@ -315,6 +398,40 @@ unsigned count = std::numeric_limits < unsigned >::max ()); /** Adds another response value. + * Response values are determined on the parameter constraints you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param p3 the 3. parameter of the method + * @param p4 the 4. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const ret_type &rv, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + const mockpp::ConstraintHolder<type3> &p3, + const mockpp::ConstraintHolder<type4> &p4, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response throwable. + * Response throwables are determined on the parameter constraints you pass. This way the + * object throws an object that is totally based on the input. + * @param t the throwable + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param p3 the 3. parameter of the method + * @param p4 the 4. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(mockpp::Throwable *t, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + const mockpp::ConstraintHolder<type3> &p3, + const mockpp::ConstraintHolder<type4> &p4, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response value. * Response values are determined on the parameters you pass. This way the * object returns a value that is totally based on the input. * @param rv the return value @@ -345,7 +462,45 @@ const your_type1 &p1, const your_type2 &p2, const your_type3 &p3, const your_type4 &p4, const your_type5 &p5, unsigned count = std::numeric_limits < unsigned >::max ()); -// @todo update doc + + /** Adds another response value. + * Response values are determined on the parameter constraints you pass. This way the + * object returns a value that is totally based on the input. + * @param rv the return value + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param p3 the 3. parameter of the method + * @param p4 the 4. parameter of the method + * @param p5 the 5. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseValue(const ret_type &rv, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + const mockpp::ConstraintHolder<type3> &p3, + const mockpp::ConstraintHolder<type4> &p4, + const mockpp::ConstraintHolder<type5> &p5, + unsigned count = MOCKPP_UNLIMITED); + + /** Adds another response throwable. + * Response throwables are determined on the parameter constraints you pass. This way the + * object throws an object that is totally based on the input. + * @param t the throwable + * @param p1 the 1. parameter of the method + * @param p2 the 2. parameter of the method + * @param p3 the 3. parameter of the method + * @param p4 the 4. parameter of the method + * @param p5 the 5. parameter of the method + * @param count the number of times this value shall be returned. Default is unlimited. + */ + void addResponseThrowable(mockpp::Throwable *t, + const mockpp::ConstraintHolder<type1> &p1, + const mockpp::ConstraintHolder<type2> &p2, + const mockpp::ConstraintHolder<type3> &p3, + const mockpp::ConstraintHolder<type4> &p4, + const mockpp::ConstraintHolder<type5> &p5, + unsigned count = MOCKPP_UNLIMITED); + #endif // DOXYGEN_SHOULD_SKIP_THIS } ; |
From: Ewald A. <ewa...@us...> - 2005-03-05 16:29:46
|
Update of /cvsroot/mockpp/mockpp/mockpp/matcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28596/mockpp/matcher Modified Files: Makefile.am Log Message: file in dist missing Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/matcher/Makefile.am,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Makefile.am 3 Mar 2005 23:32:26 -0000 1.12 +++ Makefile.am 5 Mar 2005 16:29:37 -0000 1.13 @@ -6,7 +6,7 @@ InvokeAtLeastOnceMatcher.h InvokeCountMatcher.h InvokedAfterMatcher.h InvokedRecorder.h \ InvokeOnceMatcher.h NoArgumentsMatcher.h StatelessInvocationMatcher.h TestFailureMatcher.h \ InvokeAtMostMatcher.h InvokedBeforeMatcher.h InvokeAtLeastMatcher.h InvocationMatcher.h \ - TypelessMatcher.h MatcherHolder.h + TypelessMatcher.h MatcherHolder.h UnlimitedMatcher.h libmatcherincludedir = $(includedir)/mockpp/matcher |
From: Ewald A. <ewa...@us...> - 2005-03-05 15:50:59
|
Update of /cvsroot/mockpp/mockpp/mockpp/matcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19486/mockpp/matcher Modified Files: StatelessInvocationMatcher.h TypelessMatcher.h Log Message: changes for docs Index: TypelessMatcher.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/matcher/TypelessMatcher.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- TypelessMatcher.h 1 Mar 2005 19:36:19 -0000 1.12 +++ TypelessMatcher.h 5 Mar 2005 15:50:48 -0000 1.13 @@ -104,7 +104,7 @@ * @param invocation the invocation data (only dummy data) * @return true: the invocation matches */ - virtual bool matches( const I &/*invocation*/ ) + virtual bool matches( const I &invocation ) { return matcher->matches(); } @@ -112,7 +112,7 @@ /** Increments the invocation count * @param invocation the invocation data */ - virtual void incInvoked( const I &/*invocation*/ ) + virtual void incInvoked( const I &invocation ) { matcher->incInvoked(); } Index: StatelessInvocationMatcher.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/matcher/StatelessInvocationMatcher.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- StatelessInvocationMatcher.h 2 Mar 2005 12:48:37 -0000 1.19 +++ StatelessInvocationMatcher.h 5 Mar 2005 15:50:47 -0000 1.20 @@ -55,7 +55,7 @@ /** Increments the invocation count * @param invocation the invocation data */ - virtual void incInvoked( const I & /*invocation*/ ) + virtual void incInvoked( const I &invocation ) { // Do nothing because state cannot change } |
From: Ewald A. <ewa...@us...> - 2005-03-05 15:50:58
|
Update of /cvsroot/mockpp/mockpp/mockpp/stub In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19486/mockpp/stub Modified Files: TypelessStub.h Log Message: changes for docs Index: TypelessStub.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/stub/TypelessStub.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- TypelessStub.h 1 Mar 2005 19:36:19 -0000 1.10 +++ TypelessStub.h 5 Mar 2005 15:50:48 -0000 1.11 @@ -137,7 +137,7 @@ * @param invocation invocation data * @return return value from mocked invocation */ - virtual R invoke( const I &/*invocation*/ ) + virtual R invoke( const I &invocation ) { return stubber->typelessInvoke(); } @@ -167,7 +167,7 @@ /** Mock the invocation * @param invocation invocation data */ - virtual void invoke( const I &/*invocation*/ ) + virtual void invoke( const I &invocation ) { stubber->typelessInvoke(); } |
From: Ewald A. <ewa...@us...> - 2005-03-05 15:50:57
|
Update of /cvsroot/mockpp/mockpp/mockpp/constraint In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19486/mockpp/constraint Modified Files: ConstraintSet.h Log Message: changes for docs Index: ConstraintSet.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/constraint/ConstraintSet.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ConstraintSet.h 4 Mar 2005 23:35:56 -0000 1.12 +++ ConstraintSet.h 5 Mar 2005 15:50:47 -0000 1.13 @@ -48,10 +48,11 @@ public: /** Tests if the constraint set matches the invocation + * @param invocation the invocation data * @return true: the set matches */ template <typename I> // Invocation - bool matches( const I & /*invocatio*/n ) + bool matches( const I & invocation ) { return true; } |
From: Ewald A. <ewa...@us...> - 2005-03-05 15:50:56
|
Update of /cvsroot/mockpp/mockpp/mockpp/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19486/mockpp/builder Modified Files: IdentityBuilder.cpp Log Message: changes for docs Index: IdentityBuilder.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/builder/IdentityBuilder.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IdentityBuilder.cpp 4 Mar 2005 23:35:55 -0000 1.1 +++ IdentityBuilder.cpp 5 Mar 2005 15:50:46 -0000 1.2 @@ -45,5 +45,6 @@ { } + } // namespace mockpp |
From: Ewald A. <ewa...@us...> - 2005-03-05 15:20:19
|
Update of /cvsroot/mockpp/mockpp/bcbX In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12552/bcbX Modified Files: mockpp.cbx Log Message: added new files Index: mockpp.cbx =================================================================== RCS file: /cvsroot/mockpp/mockpp/bcbX/mockpp.cbx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- mockpp.cbx 3 Mar 2005 23:31:06 -0000 1.10 +++ mockpp.cbx 5 Mar 2005 15:20:10 -0000 1.11 @@ -59,7 +59,7 @@ <property category="buildorder" name="node.7" value="27"/> <property category="buildorder" name="node.8" value="35"/> <property category="buildorder" name="node.9" value="9"/> - <property category="cbproject" name="lastnodeid" value="74"/> + <property category="cbproject" name="lastnodeid" value="80"/> <property category="cbproject" name="version" value="X.1.0"/> <property category="classbrowser" name="enable" value="1"/> <property category="gnuc++.g++compile" name="option.fpic_using_GOT.enabled" value="1"/> @@ -90,7 +90,7 @@ <property category="linux.gnuc++.Release_Build" name="saved" value="1"/> <property category="runtime" name="DefaultConfiguration" value="-1"/> <property category="runtime" name="ExcludeDefaultForZero" value="1"/> - <property category="unique" name="id" value="74"/> + <property category="unique" name="id" value="80"/> <property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.1" value="_DEBUG"/> <property category="win32.Debug_Build.win32b.bcc32" name="option.D.enabled" value="1"/> <property category="win32.Debug_Build.win32b.bcc32" name="option.I.arg.1" value="$(BCBX)\include"/> @@ -232,6 +232,9 @@ <file path="../mockpp/chaining/ChainingMockObjectSupport.cpp"> <property category="unique" name="id" value="27"/> </file> + <file path="../mockpp/constraint/ConstraintSet.cpp"> + <property category="unique" name="id" value="77"/> + </file> <file path="C%|/tmp/compilex/cppunit_1_10.lib"> <property category="unique" name="id" value="63"/> </file> @@ -244,6 +247,9 @@ <file path="../mockpp/compat/Formatter.cpp"> <property category="unique" name="id" value="29"/> </file> + <file path="../mockpp/builder/IdentityBuilder.cpp"> + <property category="unique" name="id" value="79"/> + </file> <file path="../mockpp/chaining/Invocation.cpp"> <property category="unique" name="id" value="25"/> </file> @@ -295,6 +301,9 @@ <file path="../mockpp/TrackingCounter.cpp"> <property category="unique" name="id" value="67"/> </file> + <file path="../mockpp/constraint/TypelessConstraint.cpp"> + <property category="unique" name="id" value="75"/> + </file> <file path="../mockpp/matcher/TypelessMatcher.cpp"> <property category="unique" name="id" value="41"/> </file> |
From: Ewald A. <ewa...@us...> - 2005-03-05 14:54:23
|
Update of /cvsroot/mockpp/mockpp/mockpp/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6692/mockpp/util Modified Files: NotImplementedException.cpp Log Message: fixes non-unicode and BCB5 Index: NotImplementedException.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/util/NotImplementedException.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- NotImplementedException.cpp 26 Jan 2005 21:59:13 -0000 1.14 +++ NotImplementedException.cpp 5 Mar 2005 14:53:41 -0000 1.15 @@ -35,6 +35,7 @@ namespace mockpp { + MOCKPP_EXPORT NotImplementedException::NotImplementedException(unsigned srcline, const char* srcfile, const String &message) @@ -48,3 +49,5 @@ + + |
From: Ewald A. <ewa...@us...> - 2005-03-05 14:54:23
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6692/mockpp/tests Modified Files: Formatter_test.cpp Log Message: fixes non-unicode and BCB5 Index: Formatter_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Formatter_test.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Formatter_test.cpp 3 Mar 2005 15:49:36 -0000 1.21 +++ Formatter_test.cpp 5 Mar 2005 14:53:41 -0000 1.22 @@ -371,16 +371,16 @@ void Formatter_test::test_fmt_String() { mockpp::String fmt (MOCKPP_PCHAR("%9%8%7%6%5%4%3%2%1%0")); - fmt << MOCKPP_CHAR("0") - << MOCKPP_CHAR("1") - << MOCKPP_CHAR("2") - << MOCKPP_CHAR("3") - << MOCKPP_CHAR("4") - << MOCKPP_CHAR("5") - << MOCKPP_CHAR("6") - << MOCKPP_CHAR("7") - << MOCKPP_CHAR("8") - << MOCKPP_CHAR("9"); + fmt << MOCKPP_PCHAR("0") + << MOCKPP_PCHAR("1") + << MOCKPP_PCHAR("2") + << MOCKPP_PCHAR("3") + << MOCKPP_PCHAR("4") + << MOCKPP_PCHAR("5") + << MOCKPP_PCHAR("6") + << MOCKPP_PCHAR("7") + << MOCKPP_PCHAR("8") + << MOCKPP_PCHAR("9"); MOCKPP_ASSERT_EQUALS(fmt, MOCKPP_PCSTRING("9876543210")); } @@ -388,19 +388,7 @@ void Formatter_test::test_fmt_Char() { - mockpp::String fmt (MOCKPP_PCHAR("%9%8%7%6%5%4%3%2%1%0")); - fmt << MOCKPP_CHAR('0') - << MOCKPP_CHAR('1') - << MOCKPP_CHAR('2') - << MOCKPP_CHAR('3') - << MOCKPP_CHAR('4') - << MOCKPP_CHAR('5') - << MOCKPP_CHAR('6') - << MOCKPP_CHAR('7') - << MOCKPP_CHAR('8') - << MOCKPP_CHAR('9'); - - MOCKPP_ASSERT_EQUALS(fmt, MOCKPP_PCSTRING("9876543210")); + mockpp::String fmt; fmt = MOCKPP_PCHAR("%9%8%7%6%5%4%3%2%1%0"); fmt << (signed char) ('0') @@ -413,7 +401,6 @@ << (signed char)('7') << (signed char)('8') << (signed char)('9'); - MOCKPP_ASSERT_EQUALS(fmt, MOCKPP_PCSTRING("9876543210")); fmt = MOCKPP_PCHAR("%9%8%7%6%5%4%3%2%1%0"); @@ -427,7 +414,32 @@ << (unsigned char)('7') << (unsigned char)('8') << (unsigned char)('9'); + MOCKPP_ASSERT_EQUALS(fmt, MOCKPP_PCSTRING("9876543210")); + + fmt = MOCKPP_PCHAR("%9%8%7%6%5%4%3%2%1%0"); + fmt << (char)('0') + << (char)('1') + << (char)('2') + << (char)('3') + << (char)('4') + << (char)('5') + << (char)('6') + << (char)('7') + << (char)('8') + << (char)('9'); + MOCKPP_ASSERT_EQUALS(fmt, MOCKPP_PCSTRING("9876543210")); + fmt = MOCKPP_PCHAR("%9%8%7%6%5%4%3%2%1%0"); + fmt << MOCKPP_CHAR('0') + << MOCKPP_CHAR('1') + << MOCKPP_CHAR('2') + << MOCKPP_CHAR('3') + << MOCKPP_CHAR('4') + << MOCKPP_CHAR('5') + << MOCKPP_CHAR('6') + << MOCKPP_CHAR('7') + << MOCKPP_CHAR('8') + << MOCKPP_CHAR('9'); MOCKPP_ASSERT_EQUALS(fmt, MOCKPP_PCSTRING("9876543210")); } |