00001 00008 /************************************************************************** 00009 00010 begin : Fri Sep 24 2004 00011 copyright : (C) 2002-2010 by Ewald Arnold 00012 email : mockpp at ewald-arnold dot de 00013 00014 00015 This program is free software; you can redistribute it and/or modify 00016 it under the terms of the GNU Lesser General Public License as 00017 published by the Free Software Foundation; either version 2 of the License, 00018 or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 00029 **/ 00030 00031 #define MOCKPP_NEED_EXPORTS 00032 #include <mockpp/mockpp.h> // always first 00033 00034 #include <mockpp/chaining/ChainingMockObjectSupport.h> 00035 00036 #include <mockpp/constraint/IsAnything.h> 00037 #include <mockpp/constraint/IsNothing.h> 00038 00039 #include <mockpp/matcher/InvokeOnceMatcher.h> 00040 #include <mockpp/matcher/InvokeAtLeastOnceMatcher.h> 00041 #include <mockpp/matcher/InvokeAtLeastMatcher.h> 00042 #include <mockpp/matcher/InvokeAtMostMatcher.h> 00043 #include <mockpp/matcher/InvokeCountMatcher.h> 00044 #include <mockpp/matcher/UnlimitedMatcher.h> 00045 #include <mockpp/matcher/TestFailureMatcher.h> 00046 00047 00048 MOCKPP_NS_START 00049 00050 00051 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) once() 00052 { 00053 return new InvokeOnceMatcher(); 00054 } 00055 00056 00057 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) atLeastOnce() 00058 { 00059 return new InvokeAtLeastOnceMatcher(); 00060 } 00061 00062 00063 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) atMost( int expectedCount ) 00064 { 00065 return new InvokeAtMostMatcher( expectedCount ); 00066 } 00067 00068 00069 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) atLeast(int expectedCount) 00070 { 00071 return new InvokeAtLeastMatcher(expectedCount); 00072 } 00073 00074 00075 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) unlimited() 00076 { 00077 return new UnlimitedMatcher(); 00078 } 00079 00080 00081 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) exactly( int expectedCount ) 00082 { 00083 return new InvokeCountMatcher( expectedCount ); 00084 } 00085 00086 00087 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) never() 00088 { 00089 return new TestFailureMatcher( MOCKPP_PCHAR("never expected") ); 00090 } 00091 00092 00093 MOCKPP_API_IMPL(AutoPointer<TypelessMatcher>) never( const String &errorMessage ) 00094 { 00095 return new TestFailureMatcher( MOCKPP_PCHAR( "never expected (" ) 00096 + errorMessage 00097 + MOCKPP_PCHAR( ")" ) ); 00098 } 00099 00100 00101 MOCKPP_API_IMPL0 TypelessConstraint::AP any() 00102 { 00103 return new IsAnything; 00104 } 00105 00106 00107 MOCKPP_API_IMPL0 TypelessConstraint::AP nothing() 00108 { 00109 return new IsNothing; 00110 } 00111 00112 00113 MOCKPP_API_IMPL0 TypelessStub<void>::AP isVoid() 00114 { 00115 return new VoidStub; 00116 } 00117 00118 MOCKPP_NS_END