]>
Commit | Line | Data |
---|---|---|
1 | #include "wx/wxprec.h" | |
2 | ||
3 | #include <string> | |
4 | ||
5 | // need this to be able to use CPPUNIT_ASSERT_EQUAL with wxString objects | |
6 | // | |
7 | // NB: at least for VC7.1 the specialization must be done before cppunit | |
8 | // headers inclusion as otherwise it's just ignored! | |
9 | namespace CppUnit | |
10 | { | |
11 | ||
12 | template <typename T> struct assertion_traits; | |
13 | ||
14 | template <> | |
15 | struct assertion_traits<wxString> | |
16 | { | |
17 | static bool equal(const wxString& s1, const wxString& s2) | |
18 | { | |
19 | return s1 == s2; | |
20 | } | |
21 | ||
22 | static std::string toString(const wxString& s) | |
23 | { | |
24 | return std::string(s.mb_str()); | |
25 | } | |
26 | }; | |
27 | ||
28 | } // namespace CppUnit | |
29 | ||
30 | #include "wx/cppunit.h" | |
31 | ||
32 | // define wxHAVE_U_ESCAPE if the compiler supports \uxxxx character constants | |
33 | #if (defined(__VISUALC__) && (__VISUALC__ >= 1300)) || \ | |
34 | (defined(__GNUC__) && (__GNUC__ >= 3)) | |
35 | #define wxHAVE_U_ESCAPE | |
36 | #endif | |
37 | ||
38 | #define CPPUNIT_ASSERT_STR_EQUAL(s1, s2) \ | |
39 | CPPUNIT_ASSERT_EQUAL( wxString(s1), wxString(s2) ) | |
40 |