]>
git.saurik.com Git - wxWidgets.git/blob - tests/mbconv/main.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/mbconv/main.cpp
3 // Purpose: wxMBConv unit test
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2003 TT-Solutions
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
14 #include "wx/strconv.h"
15 #include "wx/string.h"
17 #include "wx/cppunit.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 class MBConvTestCase
: public CppUnit::TestCase
29 CPPUNIT_TEST_SUITE( MBConvTestCase
);
30 CPPUNIT_TEST( WC2CP1250
);
31 CPPUNIT_TEST_SUITE_END();
35 NO_COPY_CLASS(MBConvTestCase
);
38 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase
, "MBConvTestCase" );
40 void MBConvTestCase::WC2CP1250()
42 static const struct Data
48 { L
"hello", "hello" }, // test that it works in simplest case
49 { L
"½ of ½ is ¼", "" }, // this should fail as cp1250 doesn't have 1/2
52 wxCSConv
cs1250(wxFONTENCODING_CP1250
);
53 for ( size_t n
= 0; n
< WXSIZEOF(data
); n
++ )
55 const Data
& d
= data
[n
];
56 CPPUNIT_ASSERT( wxString(d
.wc
, cs1250
) == d
.cp1250
);
60 // ----------------------------------------------------------------------------
61 // program entry point
62 // ----------------------------------------------------------------------------
66 CppUnit::TextUi::TestRunner runner
;
67 runner
.addTest(MBConvTestCase::suite());
69 return runner
.run("") ? 0 : 1;