X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2cc0718168e045cf65f738d54e5a2f80ae267a04..1fbf26be167a9188c45322ed9ece04af54708d2a:/tests/mbconv/main.cpp diff --git a/tests/mbconv/main.cpp b/tests/mbconv/main.cpp index c90ee39fac..6c509c838d 100644 --- a/tests/mbconv/main.cpp +++ b/tests/mbconv/main.cpp @@ -11,6 +11,16 @@ // headers // ---------------------------------------------------------------------------- +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif // WX_PRECOMP + #include "wx/strconv.h" #include "wx/string.h" @@ -32,9 +42,13 @@ private: void WC2CP1250(); - NO_COPY_CLASS(MBConvTestCase); + DECLARE_NO_COPY_CLASS(MBConvTestCase) }; +// register in the unnamed registry so that these tests are run by default +CPPUNIT_TEST_SUITE_REGISTRATION( MBConvTestCase ); + +// also include in it's own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MBConvTestCase, "MBConvTestCase" ); void MBConvTestCase::WC2CP1250() @@ -46,26 +60,20 @@ void MBConvTestCase::WC2CP1250() } data[] = { { L"hello", "hello" }, // test that it works in simplest case - { L"½ of ½ is ¼", "" }, // this should fail as cp1250 doesn't have 1/2 + { L"\xBD of \xBD is \xBC", NULL }, // this should fail as cp1250 doesn't have 1/2 }; wxCSConv cs1250(wxFONTENCODING_CP1250); for ( size_t n = 0; n < WXSIZEOF(data); n++ ) { const Data& d = data[n]; - CPPUNIT_ASSERT( wxString(d.wc, cs1250) == d.cp1250 ); + if (d.cp1250) + { + CPPUNIT_ASSERT( strcmp(cs1250.cWC2MB(d.wc), d.cp1250) == 0 ); + } + else + { + CPPUNIT_ASSERT( (const char*)cs1250.cWC2MB(d.wc) == NULL ); + } } } - -// ---------------------------------------------------------------------------- -// program entry point -// ---------------------------------------------------------------------------- - -int main() -{ - CppUnit::TextUi::TestRunner runner; - runner.addTest(MBConvTestCase::suite()); - - return runner.run("") ? 0 : 1; -} -