/***mockcpp is a C/C++ mock framework.Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.***/#include <mockcpp/mockcpp.h>#include <mockcpp/Matcher.h>#include <mockcpp/TypelessStubAdapter.h>#include <mockcpp/InvokedOnce.h>#include <mockcpp/InvokedAtLeast.h>#include <mockcpp/InvokedAtMost.h>#include <mockcpp/InvokedExactly.h>#include <mockcpp/TestFailureMatcher.h>#include <mockcpp/ReturnStub.h>#include <mockcpp/ReturnObjectList.h>#include <mockcpp/Constraint.h>#include <mockcpp/OutBoundPointer.h>#include <mockcpp/IsMirror.h>#include <mockcpp/IgnoreReturnStub.h>#include <mockcpp/RepeatStub.h>#include <mockcpp/StringConstraint.h>#include <mockcpp/IsStringStartWith.h>#include <mockcpp/IsStringEndWith.h>#include <mockcpp/IsStringContains.h>#include <mockcpp/DieStub.h>MOCKCPP_NS_START//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTMatcher* once(){return new InvokedOnce;}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTMatcher* exactly(unsigned int times){return new InvokedExactly(times);}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTMatcher* atLeast(unsigned int times){return new InvokedAtLeast(times);}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTMatcher* atMost(unsigned int times){return new InvokedAtMost(times);}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTMatcher* atLeastOnce(){return atLeast(1);}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTMatcher* atMostOnce(){return atMost(1);}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTMatcher* never(){return new TestFailureMatcher("Invoking an invocation which should never be invoked","never()");}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTStub* returnValue(const Any& val){return new TypelessStubAdapter(new ReturnStub(val));}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTStub* repeat(const Any& val, unsigned int repeatTimes){return new TypelessStubAdapter(new RepeatStub(val, repeatTimes));}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTStub* ignoreReturnValue(){return new TypelessStubAdapter(new IgnoreReturnStub());}MOCKCPP_EXPORTStub* die(int code){return new TypelessStubAdapter(new DieStub(code));}//////////////////////////////////////////////////////////////////MOCKCPP_EXPORTStub* returnObjectList( const Any& o01, const Any& o02, const Any& o03, const Any& o04, const Any& o05, const Any& o06, const Any& o07, const Any& o08, const Any& o09, const Any& o10, const Any& o11, const Any& o12){return new TypelessStubAdapter(new ReturnObjectList(o01, o02, o03, o04, o05, o06,o07, o08, o09, o10, o11, o12));}MOCKCPP_EXPORTConstraint* outBoundP(void* p, size_t size, Constraint* constraint){return new OutBoundPointer<void*>(p, size, constraint);}MOCKCPP_EXPORTConstraint* mirror(void* p, size_t size){return new IsMirror<void*>(p, size);}MOCKCPP_EXPORTConstraint* smirror(char* s){return new IsMirror<char*>(s, strlen(s)+1);}MOCKCPP_EXPORTConstraint* smirror(const char* s){return new IsMirror<const char*>(s, strlen(s)+1);}MOCKCPP_EXPORTConstraint* smirror(unsigned char* s){return new IsMirror<unsigned char*>(s, strlen((char*)s)+1);}MOCKCPP_EXPORTConstraint* smirror(const unsigned char* s){return new IsMirror<const unsigned char*>(s, strlen((const char*)s)+1);}MOCKCPP_EXPORTConstraint* startWith(unsigned char* s){return new StringConstraint((char*)s, new IsStringStartWith());}MOCKCPP_EXPORTConstraint* startWith(unsigned const char* s){return new StringConstraint((const char*)s, new IsStringStartWith());}MOCKCPP_EXPORTConstraint* startWith(const std::string& s){return new StringConstraint(s, new IsStringStartWith());}MOCKCPP_EXPORTConstraint* endWith(unsigned char* s){return new StringConstraint((char*)s, new IsStringEndWith());}MOCKCPP_EXPORTConstraint* endWith(unsigned const char* s){return new StringConstraint((const char*)s, new IsStringEndWith());}MOCKCPP_EXPORTConstraint* endWith(const std::string& s){return new StringConstraint(s, new IsStringEndWith());}MOCKCPP_EXPORTConstraint* contains(unsigned char* s){return new StringConstraint((char*)s, new IsStringContains());}MOCKCPP_EXPORTConstraint* contains(unsigned const char* s){return new StringConstraint((const char*)s, new IsStringContains());}MOCKCPP_EXPORTConstraint* contains(const std::string& s){return new StringConstraint(s, new IsStringContains());}MOCKCPP_NS_END
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。