removed wxTextFile test case, what was it doing here?
[wxWidgets.git] / tests / strings / unicode.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/strings/unicode.cpp
3 // Purpose: Unicode unit test
4 // Author: Vadim Zeitlin, Wlodzimierz ABX Skiba
5 // Created: 2004-04-28
6 // RCS-ID: $Id$
7 // Copyright: (c) 2004 Vadim Zeitlin, Wlodzimierz Skiba
8 ///////////////////////////////////////////////////////////////////////////////
9
10 // ----------------------------------------------------------------------------
11 // headers
12 // ----------------------------------------------------------------------------
13
14 #include "testprec.h"
15
16 #ifdef __BORLANDC__
17 #pragma hdrstop
18 #endif
19
20 #ifndef WX_PRECOMP
21 #endif // WX_PRECOMP
22
23 // ----------------------------------------------------------------------------
24 // test class
25 // ----------------------------------------------------------------------------
26
27 class UnicodeTestCase : public CppUnit::TestCase
28 {
29 public:
30 UnicodeTestCase();
31
32 private:
33 CPPUNIT_TEST_SUITE( UnicodeTestCase );
34 CPPUNIT_TEST( ToFromAscii );
35 CPPUNIT_TEST_SUITE_END();
36
37 void ToFromAscii();
38
39 DECLARE_NO_COPY_CLASS(UnicodeTestCase)
40 };
41
42 // register in the unnamed registry so that these tests are run by default
43 CPPUNIT_TEST_SUITE_REGISTRATION( UnicodeTestCase );
44
45 // also include in it's own registry so that these tests can be run alone
46 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( UnicodeTestCase, "UnicodeTestCase" );
47
48 UnicodeTestCase::UnicodeTestCase()
49 {
50 }
51
52 void UnicodeTestCase::ToFromAscii()
53 {
54
55 #define TEST_TO_FROM_ASCII(txt) \
56 { \
57 static const char *msg = txt; \
58 wxString s = wxString::FromAscii(msg); \
59 CPPUNIT_ASSERT( strcmp( s.ToAscii() , msg ) == 0 ); \
60 }
61
62 TEST_TO_FROM_ASCII( "Hello, world!" );
63 TEST_TO_FROM_ASCII( "additional \" special \t test \\ component \n :-)" );
64 }
65