00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #define MOCKPP_NEED_EXPORTS
00031 #include <mockpp/mockpp.h>
00032
00033 #include <mockpp/util/NotImplementedException.h>
00034 #include <mockpp/util/AssertMo.h>
00035
00036 #include <mockpp/Verifiable.h>
00037
00038 #include <mockpp/compat/Formatter.h>
00039 #include <mockpp/compat/AssertionFailedError.h>
00040
00041
00042 MOCKPP_NS_START
00043
00044
00045 void MOCKPP_API_IMPL0 assertExcludes(unsigned srcline, const char* srcfile,
00046 const String &description,
00047 const MOCKPP_STL::string &excludeString,
00048 const MOCKPP_STL::string &targetString)
00049 {
00050 assertTrue(srcline, srcfile, description, targetString.find(excludeString) == String::npos);
00051 }
00052
00053 #ifdef MOCKPP_UNICODE
00054
00055 void MOCKPP_API_IMPL0 assertExcludes(unsigned srcline, const char* srcfile,
00056 const String &description,
00057 const MOCKPP_STL::basic_string<wchar_t> &excludeString,
00058 const MOCKPP_STL::basic_string<wchar_t> &targetString)
00059 {
00060 assertTrue(srcline, srcfile, description, targetString.find(excludeString) == String::npos);
00061 }
00062
00063 #endif
00064
00065 void MOCKPP_API_IMPL0 assertIncludes(unsigned srcline, const char* srcfile,
00066 const String &description,
00067 const MOCKPP_STL::string &includeString,
00068 const MOCKPP_STL::string &targetString)
00069 {
00070 assertTrue(srcline, srcfile, description, targetString.find(includeString) != String::npos);
00071 }
00072
00073 #ifdef MOCKPP_UNICODE
00074
00075 void MOCKPP_API_IMPL0 assertIncludes(unsigned srcline, const char* srcfile,
00076 const String &description,
00077 const MOCKPP_STL::basic_string<wchar_t> &includeString,
00078 const MOCKPP_STL::basic_string<wchar_t> &targetString)
00079 {
00080 assertTrue(srcline, srcfile, description, targetString.find(includeString) != String::npos);
00081 }
00082
00083 #endif
00084
00085 void MOCKPP_API_IMPL0 assertStartsWith(unsigned srcline, const char* srcfile,
00086 const String &description,
00087 const MOCKPP_STL::string &startString,
00088 const MOCKPP_STL::string &targetString)
00089 {
00090 assertTrue(srcline, srcfile, description, targetString.find(startString) == 0);
00091
00092 }
00093
00094 #ifdef MOCKPP_UNICODE
00095
00096 void MOCKPP_API_IMPL0 assertStartsWith(unsigned srcline, const char* srcfile,
00097 const String &description,
00098 const MOCKPP_STL::basic_string<wchar_t> &startString,
00099 const MOCKPP_STL::basic_string<wchar_t> &targetString)
00100 {
00101 assertTrue(srcline, srcfile, description, targetString.find(startString) == 0);
00102 }
00103
00104 #endif
00105
00106 void MOCKPP_API_IMPL0 assertVerifyFails(unsigned srcline, const char* srcfile,
00107 Verifiable *aVerifiable)
00108 {
00109 bool threwException = false;
00110 MOCKPP_TRY
00111 {
00112 aVerifiable->verify();
00113 }
00114 MOCKPP_CATCH(AssertionFailedError & )
00115 {
00116 threwException = true;
00117 }
00118
00119 assertTrue(srcline, srcfile, mockpp_i18n(MOCKPP_PCHAR("Should not have verified.")), threwException);
00120 }
00121
00122
00123 void MOCKPP_API_IMPL0 notImplemented(unsigned srcline, const char* srcfile,
00124 const String &mockName)
00125 {
00126 MOCKPP_NS::String fmt = mockpp_i18n(MOCKPP_PCHAR("Not Implemented in %1."));
00127 fmt << mockName;
00128 MOCKPP_THROW(NotImplementedException(srcline, srcfile, fmt));
00129 }
00130
00131
00132 MOCKPP_NS_END
00133