CppUnit project page CppUnit home page

assertstring.h

Go to the documentation of this file.
00001 #ifndef CPPUT_ASSERTSTRING_H_INCLUDED
00002 # define CPPUT_ASSERTSTRING_H_INCLUDED
00003 
00004 # include <cpput/assertcommon.h>
00005 
00006 namespace CppUT {
00007 
00008    CheckerResult CPPUT_API checkStdStringStartsWith( const std::string &string,
00009                                                      const std::string &pattern,
00010                                                      const Message &message );
00011 
00012    CheckerResult CPPUT_API checkStdStringEndsWith( const std::string &string,
00013                                                    const std::string &pattern,
00014                                                    const Message &message );
00015 
00016    CheckerResult CPPUT_API checkStdStringContains( const std::string &string,
00017                                                    const std::string &pattern,
00018                                                    const Message &message );
00019 
00020    CheckerResult CPPUT_API checkStdStringEquals( const std::string &expected,
00021                                                  const std::string &actual,
00022                                                  const Message &message );
00023 
00024    template<typename String1
00025            ,typename String2>
00026    CheckerResult checkStringStartsWith( const String1 &string,
00027                                         const String2 &pattern,
00028                                         const Message &message = Message() )
00029    {
00030       return checkStdStringStartsWith( convertToString( string ),
00031                                        convertToString( pattern ),
00032                                        message );
00033    }
00034 
00035    template<typename String1
00036            ,typename String2>
00037    CheckerResult checkStringEndsWith( const String1 &string,
00038                                       const String2 &pattern,
00039                                       const Message &message = Message() )
00040    {
00041       return checkStdStringEndsWith( convertToString( string ),
00042                                      convertToString( pattern ),
00043                                      message );
00044    }
00045 
00046    template<typename String1
00047            ,typename String2>
00048    CheckerResult checkStringContains( const String1 &string,
00049                                       const String2 &pattern,
00050                                       const Message &message = Message() )
00051    {
00052       return checkStdStringContains( convertToString( string ),
00053                                      convertToString( pattern ),
00054                                      message );
00055    }
00056 
00057 
00058    template<typename String1
00059            ,typename String2>
00060    CheckerResult checkStringEquals( const String1 &expected,
00061                                     const String2 &actual,
00062                                     const Message &message = Message() )
00063    {
00064       return checkStdStringEquals( convertToString( expected ),
00065                                    convertToString( actual ),
00066                                    message );
00067    }
00068 
00069 
00070 // string assertions
00071 
00075 # define CPPUT_ASSERTSTR_START   \
00076    CPPUT_BEGIN_ASSERTION_MACRO() \
00077    ::CppUT::checkStringStartsWith
00078 
00082 # define CPPUT_ASSERTSTR_END     \
00083    CPPUT_BEGIN_ASSERTION_MACRO() \
00084    ::CppUT::checkStringEndsWith
00085 
00089 # define CPPUT_ASSERTSTR_CONTAIN \
00090    CPPUT_BEGIN_ASSERTION_MACRO() \
00091    ::CppUT::checkStringContains
00092 
00099 # define CPPUT_ASSERTSTR_EQUAL   \
00100    CPPUT_BEGIN_ASSERTION_MACRO() \
00101    ::CppUT::checkStringEquals
00102 
00103 
00104 
00105 // string checks
00106 
00110 # define CPPUT_CHECKSTR_START   \
00111    CPPUT_BEGIN_CHECKING_MACRO() \
00112    ::CppUT::checkStringStartsWith
00113 
00117 # define CPPUT_CHECKSTR_END     \
00118    CPPUT_BEGIN_CHECKING_MACRO() \
00119    ::CppUT::checkStringEndsWith
00120 
00124 # define CPPUT_CHECKSTR_CONTAIN \
00125    CPPUT_BEGIN_CHECKING_MACRO() \
00126    ::CppUT::checkStringContains
00127 
00134 # define CPPUT_CHECKSTR_EQUAL   \
00135    CPPUT_BEGIN_CHECKING_MACRO() \
00136    ::CppUT::checkStringEquals
00137 
00138 
00139 
00140 } // namespace CppUT
00141 
00142 
00143 #endif // CPPUT_ASSERTSTRING_H_INCLUDED

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers