2004-04-30 20:26:14 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tests/strings/unicode.cpp
|
|
|
|
// Purpose: Unicode unit test
|
|
|
|
// Author: Vadim Zeitlin, Wlodzimierz ABX Skiba
|
|
|
|
// Created: 2004-04-28
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2004 Vadim Zeitlin, Wlodzimierz Skiba
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2004-11-22 05:00:19 +00:00
|
|
|
#include "testprec.h"
|
2004-04-30 20:26:14 +00:00
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#endif // WX_PRECOMP
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// test class
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class UnicodeTestCase : public CppUnit::TestCase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UnicodeTestCase();
|
|
|
|
|
|
|
|
private:
|
|
|
|
CPPUNIT_TEST_SUITE( UnicodeTestCase );
|
|
|
|
CPPUNIT_TEST( ToFromAscii );
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
|
|
|
|
void ToFromAscii();
|
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(UnicodeTestCase)
|
|
|
|
};
|
|
|
|
|
|
|
|
// register in the unnamed registry so that these tests are run by default
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( UnicodeTestCase );
|
|
|
|
|
|
|
|
// also include in it's own registry so that these tests can be run alone
|
|
|
|
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( UnicodeTestCase, "UnicodeTestCase" );
|
|
|
|
|
|
|
|
UnicodeTestCase::UnicodeTestCase()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnicodeTestCase::ToFromAscii()
|
|
|
|
{
|
|
|
|
|
|
|
|
#define TEST_TO_FROM_ASCII(txt) \
|
|
|
|
{ \
|
|
|
|
static const char *msg = txt; \
|
|
|
|
wxString s = wxString::FromAscii(msg); \
|
|
|
|
CPPUNIT_ASSERT( strcmp( s.ToAscii() , msg ) == 0 ); \
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_TO_FROM_ASCII( "Hello, world!" );
|
|
|
|
TEST_TO_FROM_ASCII( "additional \" special \t test \\ component \n :-)" );
|
|
|
|
}
|
|
|
|
|