[Mockpp-commits] mockpp/mockpp/chaining ChainingMockObjectSupport.h,1.26,1.27 Invocation.h,1.20,1.21
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2006-04-08 12:01:22
|
Update of /cvsroot/mockpp/mockpp/mockpp/chaining In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26244/mockpp/chaining Modified Files: ChainingMockObjectSupport.h Invocation.h OnConsecutiveCalls.h gen_consecutive_N.pl Log Message: improve onConsecutiveCalls family Index: OnConsecutiveCalls.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/OnConsecutiveCalls.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OnConsecutiveCalls.h 7 Apr 2006 19:54:14 -0000 1.1 +++ OnConsecutiveCalls.h 8 Apr 2006 12:00:33 -0000 1.2 @@ -33,23 +33,27 @@ #include <mockpp/mockpp.h> // always first +#include <mockpp/stub/StubSequence.h> +#include <mockpp/stub/TypelessStubSequence.h> + MOCKPP_NS_START -/** Creates a sequence of 1 typeless stubs. [...1139 lines suppressed...] + MOCKPP_STL::vector<TypelessStub<R>*> vec; + vec.push_back( stub1); + vec.push_back( stub2); + vec.push_back( stub3); + vec.push_back( stub4); + vec.push_back( stub5); + vec.push_back( stub6); + vec.push_back( stub7); + vec.push_back( stub8); + vec.push_back( stub9); + vec.push_back( stub10); + return new TypelessStubSequence<R>( vec.begin(), vec.end() ); +} + MOCKPP_NS_END + #endif // MOCKPP_ONCONSECUTIVECALLS_H Index: ChainingMockObjectSupport.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/ChainingMockObjectSupport.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ChainingMockObjectSupport.h 7 Apr 2006 19:54:10 -0000 1.26 +++ ChainingMockObjectSupport.h 8 Apr 2006 12:00:33 -0000 1.27 @@ -62,8 +62,6 @@ #include <mockpp/stub/ThrowStub.h> #include <mockpp/stub/ReturnStub.h> -#include <mockpp/stub/StubSequence.h> -#include <mockpp/stub/TypelessStubSequence.h> #include <mockpp/matcher/TypelessMatcher.h> @@ -72,7 +70,7 @@ /** * @defgroup grp_constraint_abbrev Abbreviated Parameter Constraints - * @see MOCKPP_NS::Constraint + * @see mockpp::Constraint * Provides convenience functions that create contraint objects. * Use of these functions should also help to increase readability * if you import them via some appriopriate \c using directive. @@ -80,7 +78,7 @@ /** * @defgroup grp_stub_abbrev Abbreviated Stubs - * @see MOCKPP_NS::Stub + * @see mockpp::Stub * Provides convenience functions that create stub objects. * Use of these functions should also help to increase readability * if you import them via some appriopriate \c using directive. @@ -88,7 +86,7 @@ /** * @defgroup grp_matcher_abbrev Abbreviated Matchers - * @see MOCKPP_NS::InvocationMatcher + * @see mockpp::InvocationMatcher * Provides convenience functions that create matcher objects. * Use of these functions should also help to increase readability * if you import them via some appriopriate \c using directive. @@ -96,7 +94,7 @@ /** Creates a constraint that matches any invocation * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsAnything + * @see mockpp::IsAnything * @return the new constraint */ TypelessConstraint::AP any(); @@ -104,7 +102,7 @@ /** Creates a constraint that never matches an invocation * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsNothing + * @see mockpp::IsNothing * @return the new constraint */ TypelessConstraint::AP nothing(); @@ -112,7 +110,7 @@ /** Passes a value back via a reference (outbound value). * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::OutBound + * @see mockpp::OutBound * @param op object to return at invoationwith * @return the new constraint */ @@ -126,7 +124,7 @@ /** Creates a constraint that tests for equality * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsEqual + * @see mockpp::IsEqual * @param op object to compare with * @return the new constraint */ @@ -140,7 +138,7 @@ /** Creates a constraint that tests for non-equality * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsNot + * @see mockpp::IsNot * @param op object to compare with * @return the new constraint */ @@ -154,7 +152,7 @@ /** Creates a constraint that tests for near-equality * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsCloseTo + * @see mockpp::IsCloseTo * @param operand object to compare with * @param deviation amount of allowed deviation * @return the new constraint @@ -169,7 +167,7 @@ /** Creates a less-or-equal constraint * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsLessOrEqual + * @see mockpp::IsLessOrEqual * @param value object to compare with * @return the new constraint */ @@ -183,7 +181,7 @@ /** Creates a less-than constraint * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsLessThan + * @see mockpp::IsLessThan * @param value object to compare with * @return the new constraint */ @@ -197,7 +195,7 @@ /** Creates a greater-than constraint * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsGreaterThan + * @see mockpp::IsGreaterThan * @param value object to compare with * @return the new constraint */ @@ -211,7 +209,7 @@ /** Creates a greater-or-equal constraint * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsGreaterOrEqual + * @see mockpp::IsGreaterOrEqual * @param value object to compare with * @return the new constraint */ @@ -225,7 +223,7 @@ /** Creates a constraint that checks if an object is the same * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsSame + * @see mockpp::IsSame * @param operand object to compare with * @return the new constraint */ @@ -243,7 +241,7 @@ * The base class is needed since dynamic_cast checks for an existing traversal * from \c derived to \c base. * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsInstanceOf + * @see mockpp::IsInstanceOf * @return the new constraint */ template <typename ROOT, @@ -259,7 +257,7 @@ /** Creates a constraint that checks for the occurence of a substring * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::StringContains + * @see mockpp::StringContains * @param substring the substring * @return the new constraint */ @@ -273,7 +271,7 @@ /** Creates a constraint that checks for the occurence of a starting substring * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::StringStartsWith + * @see mockpp::StringStartsWith * @param substring the substring * @return the new constraint */ @@ -287,7 +285,7 @@ /** Creates a constraint that checks for the occurence of a trailing substring * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::StringEndsWith + * @see mockpp::StringEndsWith * @param substring the substring * @return the new constraint */ @@ -301,7 +299,7 @@ /** Creates a constraint that checks for the occurence of a substring * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::StringContains + * @see mockpp::StringContains * @param substring the substring * @return the new constraint */ @@ -315,7 +313,7 @@ /** Creates a constraint that negates another * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::IsNot + * @see mockpp::IsNot * @param c the other constraint * @return the new constraint */ @@ -329,7 +327,7 @@ /** Creates a constraint to logically-and two other constraints * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::And + * @see mockpp::And * @param left the first constraint * @param right the second constraint * @return the new constraint @@ -345,7 +343,7 @@ /** Creates a constraint to logically-or two other constraints * @ingroup grp_constraint_abbrev - * @see MOCKPP_NS::Or + * @see mockpp::Or * @param left the first constraint * @param right the second constraint * @return the new constraint @@ -361,7 +359,7 @@ /** Creates a stub returning a value * @ingroup grp_stub_abbrev - * @see MOCKPP_NS::ReturnStub + * @see mockpp::ReturnStub * @param o the value to return * @return the new stub */ @@ -374,7 +372,7 @@ /** Creates a stub returning a void stub * @ingroup grp_stub_abbrev - * @see MOCKPP_NS::VoidStub + * @see mockpp::VoidStub * @return the new stub */ TypelessStub<void>::AP isVoid( ); @@ -382,7 +380,7 @@ /** Creates a stub throwing a value * @ingroup grp_stub_abbrev - * @see MOCKPP_NS::ThrowStub + * @see mockpp::ThrowStub * @param val the value to throw * @return the new stub */ @@ -396,7 +394,7 @@ /** Creates a matcher to verify a single invocation * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::InvokeOnceMatcher + * @see mockpp::InvokeOnceMatcher * @return the new matcher */ AutoPointer<TypelessMatcher> once(); @@ -404,7 +402,7 @@ /** Creates a matcher to verify a minimum invocation count of one. * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::InvokeAtLeastOnceMatcher + * @see mockpp::InvokeAtLeastOnceMatcher * @return the new matcher */ AutoPointer<TypelessMatcher> atLeastOnce(); @@ -412,7 +410,7 @@ /** Creates a matcher to verify an arbitrary invocation count. * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::UnlimitedMatcher + * @see mockpp::UnlimitedMatcher * @return the new matcher */ AutoPointer<TypelessMatcher> unlimited(); @@ -420,7 +418,7 @@ /** Creates a matcher to verify a maximal invocation count. * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::InvokeAtMostMatcher + * @see mockpp::InvokeAtMostMatcher * @return the new matcher */ AutoPointer<TypelessMatcher> atMost( int expectedCount ); @@ -428,7 +426,7 @@ /** Creates a matcher to verify a minimal invocation count. * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::InvokeAtLeastMatcher + * @see mockpp::InvokeAtLeastMatcher * @return the new matcher */ AutoPointer<TypelessMatcher> atLeast(int expectedCount); @@ -436,7 +434,7 @@ /** Creates a matcher to verify an exact invocation count. * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::InvokeCountMatcher + * @see mockpp::InvokeCountMatcher * @return the new matcher */ AutoPointer<TypelessMatcher> exactly( int expectedCount ); @@ -444,7 +442,7 @@ /** Creates a matcher to verify that the invactation never occured. * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::TestFailureMatcher + * @see mockpp::TestFailureMatcher * @return the new matcher */ AutoPointer<TypelessMatcher> never(); @@ -452,7 +450,7 @@ /** Creates a matcher to verify that the invactation never occured. * @ingroup grp_matcher_abbrev - * @see MOCKPP_NS::TestFailureMatcher + * @see mockpp::TestFailureMatcher * @param errorMessage additional info for error message * @return the new matcher */ Index: gen_consecutive_N.pl =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/gen_consecutive_N.pl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gen_consecutive_N.pl 7 Apr 2006 19:54:14 -0000 1.1 +++ gen_consecutive_N.pl 8 Apr 2006 12:00:33 -0000 1.2 @@ -22,7 +22,7 @@ \@internal NOT INTENDED FOR PUBLIC INCLUSION \@brief Generated with gen_consecutive_N.pl. - \$I" . "d: CountedChainableMethod.h,v 1.7 2005/10/19 20:53:09 ewald-arnold Exp \$ + \$I" . "d: OnConsecutiveCalls.h,v 1.7 2006/04/07 20:53:09 ewald-arnold Exp \$ ***************************************************************************/ @@ -53,6 +53,9 @@ #include <mockpp/mockpp.h> // always first +#include <mockpp/stub/StubSequence.h> +#include <mockpp/stub/TypelessStubSequence.h> + MOCKPP_NS_START @@ -83,38 +86,45 @@ print "Creating onConsectiveCalls " . $numArgs ."\n"; +################################################################### + print OUT " -/** Creates a sequence of " . $numArgs . " typeless stubs. +/** Creates a sequence of " . $numArgs . " stubs. * \@ingroup grp_stub_abbrev - * \@see mockpp::TypelessStubSequence + * \@see mockpp::StubSequence * \@param stub1 first stub"; for($p = 2; $p <= $numArgs; ++$p) { print OUT " - * \@param stub" . $p . " the next stub"; } + * \@param stub" . $p . " the next stub"; } print OUT " * \@return the new stub */ -template <typename R> -typename TypelessStub<R>::AP onConsecutiveCalls( TypelessStub<R> *stub1"; +template <typename R, // ReturnType + typename I> // Invocation +typename Stub<R, I>::AP onConsecutiveCalls( AutoPointer<Stub<R, I> > stub1"; for($p = 2; $p <= $numArgs; ++$p) { print OUT " - , TypelessStub<R> *stub" . $p; } + , AutoPointer<Stub<R, I> > stub" . $p; } print OUT " - ) + ) { - MOCKPP_STL::vector<TypelessStub<R>*> vec;"; + MOCKPP_STL::vector<Stub<R, I>*> vec;"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " - vec.push_back( stub" . $p . ");" }; + vec.push_back( stub" . $p . ".release());" }; print OUT " - return new TypelessStubSequence<R>( vec.begin(), vec.end() ); + return new StubSequence<R, I>( vec.begin(), vec.end() ); } +"; + +################################################################### +print OUT " /** Creates a sequence of " . $numArgs . " stubs. * \@ingroup grp_stub_abbrev * \@see mockpp::StubSequence @@ -123,6 +133,7 @@ for($p = 2; $p <= $numArgs; ++$p) { print OUT " * \@param stub" . $p . " the next stub"; } + print OUT " * \@return the new stub */ @@ -136,22 +147,95 @@ print OUT " ) { - MOCKPP_STL::vector<Stub<R, I>*> vec;"; + MOCKPP_STL::vector<Stub<I, R>*> vec;"; for($p = 1; $p <= $numArgs; ++$p) { print OUT " - vec.push_back( stub" . $p . ");" }; + vec.push_back( stub" . $p . ");" }; print OUT " return new StubSequence<R, I>( vec.begin(), vec.end() ); } -" +"; + +################################################################### + +print OUT " +/** Creates a sequence of " . $numArgs . " typeless stubs. + * \@ingroup grp_stub_abbrev + * \@see mockpp::TypelessStubSequence + * \@param stub1 first stub"; + +for($p = 2; $p <= $numArgs; ++$p) { print OUT " + * \@param stub" . $p . " the next stub"; } + + +print OUT " + * \@return the new stub + */ +template <typename R> // ReturnType +typename TypelessStub<R>::AP onConsecutiveCalls( AutoPointer<TypelessStub<R> > stub1"; + +for($p = 2; $p <= $numArgs; ++$p) { print OUT " + , AutoPointer<TypelessStub<R> > stub" . $p; } + +print OUT " + ) +{ + MOCKPP_STL::vector<TypelessStub<R>*> vec;"; + +for($p = 1; $p <= $numArgs; ++$p) { print OUT " + vec.push_back( stub" . $p . ".release());" }; + +print OUT " + return new TypelessStubSequence<R>( vec.begin(), vec.end() ); } +"; + +################################################################### + +print OUT " +/** Creates a sequence of " . $numArgs . " typeless stubs. + * \@ingroup grp_stub_abbrev + * \@see mockpp::TypelessStubSequence + * \@param stub1 first stub"; + +for($p = 2; $p <= $numArgs; ++$p) { print OUT " + * \@param stub" . $p . " the next stub"; } + + +print OUT " + * \@return the new stub + */ +template <typename R> // ReturnType +typename TypelessStub<R>::AP onConsecutiveCalls( TypelessStub<R> *stub1"; + +for($p = 2; $p <= $numArgs; ++$p) { print OUT " + , TypelessStub<R> *stub" . $p; } + +print OUT " + ) +{ + MOCKPP_STL::vector<TypelessStub<R>*> vec;"; + +for($p = 1; $p <= $numArgs; ++$p) { print OUT " + vec.push_back( stub" . $p . ");" }; + print OUT " + return new TypelessStubSequence<R>( vec.begin(), vec.end() ); +} + +"; + +################################################################### +} + +print OUT " MOCKPP_NS_END + #endif // MOCKPP_ONCONSECUTIVECALLS_H "; Index: Invocation.h =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/chaining/Invocation.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Invocation.h 15 Mar 2006 21:34:02 -0000 1.20 +++ Invocation.h 8 Apr 2006 12:00:33 -0000 1.21 @@ -52,7 +52,7 @@ /** Default comparison function for the various \c Invocation classes. * The default implementation compares the values of the two * objects. - * @see MOCKPP_NS::Invocation + * @see mockpp::Invocation * @param left left operand * @param right right operand * @return true if both values are equal |