Globally replace _T() with wxT().

Standardize on using a single macro across all wxWidgets sources and solve the name clash with Sun CC standard headers (see #10660).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-07-23 20:30:22 +00:00
parent 32cdc45397
commit 9a83f86094
798 changed files with 10370 additions and 10349 deletions

View File

@@ -69,15 +69,15 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CrtTestCase, "CrtTestCase" );
void CrtTestCase::SetGetEnv()
{
#define TESTVAR_NAME _T("WXTESTVAR")
#define TESTVAR_NAME wxT("WXTESTVAR")
wxString val;
wxSetEnv(TESTVAR_NAME, _T("value"));
wxSetEnv(TESTVAR_NAME, wxT("value"));
CPPUNIT_ASSERT( wxGetEnv(TESTVAR_NAME, &val) );
CPPUNIT_ASSERT_EQUAL( "value", val );
CPPUNIT_ASSERT_EQUAL( "value", wxString(wxGetenv(TESTVAR_NAME)) );
wxSetEnv(TESTVAR_NAME, _T("something else"));
wxSetEnv(TESTVAR_NAME, wxT("something else"));
CPPUNIT_ASSERT( wxGetEnv(TESTVAR_NAME, &val) );
CPPUNIT_ASSERT_EQUAL( "something else", val );
CPPUNIT_ASSERT_EQUAL( "something else", wxString(wxGetenv(TESTVAR_NAME)) );

View File

@@ -86,22 +86,22 @@ StdStringTestCase::StdStringTestCase()
void StdStringTestCase::StdConstructors()
{
wxString s1(_T("abcdefgh")),
s2(_T("abcdefghijklm"), 8),
s3(_T("abcdefghijklm")),
s4(8, _T('a'));
wxString s1(wxT("abcdefgh")),
s2(wxT("abcdefghijklm"), 8),
s3(wxT("abcdefghijklm")),
s4(8, wxT('a'));
wxString s5(s1),
s6(s3, 0, 8),
s7(s3.begin(), s3.begin() + 8);
wxString s8(s1, 4, 8);
CPPUNIT_ASSERT_EQUAL( _T("abcdefgh"), s1 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdefgh"), s1 );
CPPUNIT_ASSERT_EQUAL( s1, s2 );
CPPUNIT_ASSERT_EQUAL( _T("aaaaaaaa"), s4 );
CPPUNIT_ASSERT_EQUAL( _T("abcdefgh"), s5 );
CPPUNIT_ASSERT_EQUAL( wxT("aaaaaaaa"), s4 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdefgh"), s5 );
CPPUNIT_ASSERT_EQUAL( s1, s6 );
CPPUNIT_ASSERT_EQUAL( s1, s7 );
CPPUNIT_ASSERT_EQUAL( _T("efgh"), s8 );
CPPUNIT_ASSERT_EQUAL( wxT("efgh"), s8 );
const char *pc = s1.c_str();
CPPUNIT_ASSERT_EQUAL( "bcd", wxString(pc + 1, pc + 4) );
@@ -123,22 +123,22 @@ void StdStringTestCase::StdAppend()
{
wxString s1, s2, s3, s4, s5, s6, s7, s8;
s1 = s2 = s3 = s4 = s5 = s6 = _T("abc");
s1.append(_T("def"));
s2.append(_T("defgh"), 3);
s3.append(wxString(_T("abcdef")), 3, 6);
s1 = s2 = s3 = s4 = s5 = s6 = wxT("abc");
s1.append(wxT("def"));
s2.append(wxT("defgh"), 3);
s3.append(wxString(wxT("abcdef")), 3, 6);
s4.append(s1);
s5.append(3, _T('a'));
s5.append(3, wxT('a'));
s5.append(2, 'x');
s5.append(1, (unsigned char)'y');
s6.append(s1.begin() + 3, s1.end());
CPPUNIT_ASSERT_EQUAL( _T("abcdef"), s1 );
CPPUNIT_ASSERT_EQUAL( _T("abcdef"), s2 );
CPPUNIT_ASSERT_EQUAL( _T("abcdef"), s3 );
CPPUNIT_ASSERT_EQUAL( _T("abcabcdef"), s4 );
CPPUNIT_ASSERT_EQUAL( _T("abcaaaxxy"), s5 );
CPPUNIT_ASSERT_EQUAL( _T("abcdef"), s6 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdef"), s1 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdef"), s2 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdef"), s3 );
CPPUNIT_ASSERT_EQUAL( wxT("abcabcdef"), s4 );
CPPUNIT_ASSERT_EQUAL( wxT("abcaaaxxy"), s5 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdef"), s6 );
const char *pc = s1.c_str() + 2;
s7.append(pc, pc + 4);
@@ -148,33 +148,33 @@ void StdStringTestCase::StdAppend()
s8.append(pw, pw + 4);
CPPUNIT_ASSERT_EQUAL( "cdef", s8 );
s7 = s8 = wxString(_T("null\0time"), 9);
s7 = s8 = wxString(wxT("null\0time"), 9);
s7.append(_T("def"));
s8.append(_T("defgh"), 3);
s7.append(wxT("def"));
s8.append(wxT("defgh"), 3);
CPPUNIT_ASSERT_EQUAL( wxString(_T("null\0timedef"), 12), s7 );
CPPUNIT_ASSERT_EQUAL( wxString(_T("null\0timedef"), 12), s8 );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("null\0timedef"), 12), s7 );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("null\0timedef"), 12), s8 );
}
void StdStringTestCase::StdAssign()
{
wxString s1, s2, s3, s4, s5, s6, s7, s8;
s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = _T("abc");
s1.assign(_T("def"));
s2.assign(_T("defgh"), 3);
s3.assign(wxString(_T("abcdef")), 3, 6);
s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = wxT("abc");
s1.assign(wxT("def"));
s2.assign(wxT("defgh"), 3);
s3.assign(wxString(wxT("abcdef")), 3, 6);
s4.assign(s1);
s5.assign(3, _T('a'));
s5.assign(3, wxT('a'));
s6.assign(s1.begin() + 1, s1.end());
CPPUNIT_ASSERT_EQUAL( _T("def"), s1 );
CPPUNIT_ASSERT_EQUAL( _T("def"), s2 );
CPPUNIT_ASSERT_EQUAL( _T("def"), s3 );
CPPUNIT_ASSERT_EQUAL( _T("def"), s4 );
CPPUNIT_ASSERT_EQUAL( _T("aaa"), s5 );
CPPUNIT_ASSERT_EQUAL( _T("ef"), s6 );
CPPUNIT_ASSERT_EQUAL( wxT("def"), s1 );
CPPUNIT_ASSERT_EQUAL( wxT("def"), s2 );
CPPUNIT_ASSERT_EQUAL( wxT("def"), s3 );
CPPUNIT_ASSERT_EQUAL( wxT("def"), s4 );
CPPUNIT_ASSERT_EQUAL( wxT("aaa"), s5 );
CPPUNIT_ASSERT_EQUAL( wxT("ef"), s6 );
const char *pc = s1.c_str();
s7.assign(pc, pc + 2);
@@ -192,12 +192,12 @@ void StdStringTestCase::StdCompare()
{
wxString s1, s2, s3, s4, s5, s6, s7, s8;
s1 = _T("abcdefgh");
s2 = _T("abcdefgh");
s3 = _T("abc");
s4 = _T("abcdefghi");
s5 = _T("aaa");
s6 = _T("zzz");
s1 = wxT("abcdefgh");
s2 = wxT("abcdefgh");
s3 = wxT("abc");
s4 = wxT("abcdefghi");
s5 = wxT("aaa");
s6 = wxT("zzz");
CPPUNIT_ASSERT( s1.compare(s2) == 0 );
CPPUNIT_ASSERT( s1.compare(s3) > 0 );
@@ -205,22 +205,22 @@ void StdStringTestCase::StdCompare()
CPPUNIT_ASSERT( s1.compare(s5) > 0 );
CPPUNIT_ASSERT( s1.compare(s6) < 0 );
CPPUNIT_ASSERT( s1.compare(1, 12, s1) > 0);
CPPUNIT_ASSERT( s1.compare(_T("abcdefgh")) == 0);
CPPUNIT_ASSERT( s1.compare(1, 7, _T("bcdefgh")) == 0);
CPPUNIT_ASSERT( s1.compare(1, 7, _T("bcdefgh"), 7) == 0);
CPPUNIT_ASSERT( s1.compare(wxT("abcdefgh")) == 0);
CPPUNIT_ASSERT( s1.compare(1, 7, wxT("bcdefgh")) == 0);
CPPUNIT_ASSERT( s1.compare(1, 7, wxT("bcdefgh"), 7) == 0);
}
void StdStringTestCase::StdErase()
{
wxString s1, s2, s3, s4, s5, s6, s7;
s1 = _T("abcdefgh");
s2 = _T("abcdefgh");
s3 = _T("abc");
s4 = _T("abcdefghi");
s5 = _T("aaa");
s6 = _T("zzz");
s7 = _T("zabcdefg");
s1 = wxT("abcdefgh");
s2 = wxT("abcdefgh");
s3 = wxT("abc");
s4 = wxT("abcdefghi");
s5 = wxT("aaa");
s6 = wxT("zzz");
s7 = wxT("zabcdefg");
s1.erase(1, 1);
s2.erase(4, 12);
@@ -228,13 +228,13 @@ void StdStringTestCase::StdErase()
wxString::iterator it2 = s4.erase(s4.begin() + 4, s4.begin() + 6);
wxString::iterator it3 = s7.erase(s7.begin() + 4, s7.begin() + 8);
CPPUNIT_ASSERT_EQUAL( _T("acdefgh"), s1 );
CPPUNIT_ASSERT_EQUAL( _T("abcd"), s2 );
CPPUNIT_ASSERT_EQUAL( _T("ac"), s3 );
CPPUNIT_ASSERT_EQUAL( _T("abcdghi"), s4 );
CPPUNIT_ASSERT_EQUAL( _T("zabc"), s7 );
CPPUNIT_ASSERT( *it == _T('c') );
CPPUNIT_ASSERT( *it2 == _T('g') );
CPPUNIT_ASSERT_EQUAL( wxT("acdefgh"), s1 );
CPPUNIT_ASSERT_EQUAL( wxT("abcd"), s2 );
CPPUNIT_ASSERT_EQUAL( wxT("ac"), s3 );
CPPUNIT_ASSERT_EQUAL( wxT("abcdghi"), s4 );
CPPUNIT_ASSERT_EQUAL( wxT("zabc"), s7 );
CPPUNIT_ASSERT( *it == wxT('c') );
CPPUNIT_ASSERT( *it2 == wxT('g') );
CPPUNIT_ASSERT( it3 == s7.end() );
}
@@ -242,20 +242,20 @@ void StdStringTestCase::StdFind()
{
// 0 1 2
// 01234567890123456789012345
wxString s1 = _T("abcdefgABCDEFGabcABCabcABC");
wxString s2 = _T("gAB");
wxString s1 = wxT("abcdefgABCDEFGabcABCabcABC");
wxString s2 = wxT("gAB");
CPPUNIT_ASSERT( s1.find(_T('A')) == 7u );
CPPUNIT_ASSERT( s1.find(_T('A'), 7) == 7u );
CPPUNIT_ASSERT( s1.find(_T('Z')) == wxString::npos );
CPPUNIT_ASSERT( s1.find(_T('C'), 22) == 25u );
CPPUNIT_ASSERT( s1.find(wxT('A')) == 7u );
CPPUNIT_ASSERT( s1.find(wxT('A'), 7) == 7u );
CPPUNIT_ASSERT( s1.find(wxT('Z')) == wxString::npos );
CPPUNIT_ASSERT( s1.find(wxT('C'), 22) == 25u );
CPPUNIT_ASSERT( s1.find(_T("gAB")) == 6u );
CPPUNIT_ASSERT( s1.find(_T("gAB"), 7) == wxString::npos );
CPPUNIT_ASSERT( s1.find(_T("gAB"), 6) == 6u );
CPPUNIT_ASSERT( s1.find(wxT("gAB")) == 6u );
CPPUNIT_ASSERT( s1.find(wxT("gAB"), 7) == wxString::npos );
CPPUNIT_ASSERT( s1.find(wxT("gAB"), 6) == 6u );
CPPUNIT_ASSERT( s1.find(_T("gABZZZ"), 2, 3) == 6u );
CPPUNIT_ASSERT( s1.find(_T("gABZZZ"), 7, 3) == wxString::npos );
CPPUNIT_ASSERT( s1.find(wxT("gABZZZ"), 2, 3) == 6u );
CPPUNIT_ASSERT( s1.find(wxT("gABZZZ"), 7, 3) == wxString::npos );
CPPUNIT_ASSERT( s1.find(s2) == 6u );
CPPUNIT_ASSERT( s1.find(s2, 7) == wxString::npos );
@@ -263,26 +263,26 @@ void StdStringTestCase::StdFind()
// 0 1 2
// 0123456 78901234567 8901234567
//wxString _s1 = _T("abcdefg\0ABCDEFGabc\0ABCabcABC");
//wxString _s2 = _T("g\0AB");
wxString _s1 = _T("abcdefgABCDEFGabcABCabcABC");
wxString _s2 = _T("gAB");
//wxString _s1 = wxT("abcdefg\0ABCDEFGabc\0ABCabcABC");
//wxString _s2 = wxT("g\0AB");
wxString _s1 = wxT("abcdefgABCDEFGabcABCabcABC");
wxString _s2 = wxT("gAB");
_s1.insert(7, 1, '\0');
_s1.insert(18, 1, '\0');
_s2.insert(1, 1, '\0');
CPPUNIT_ASSERT( _s1.find(_T('A')) == 8u );
CPPUNIT_ASSERT( _s1.find(_T('A'), 8) == 8u );
CPPUNIT_ASSERT( _s1.find(_T('Z')) == wxString::npos );
CPPUNIT_ASSERT( _s1.find(_T('C'), 22) == 27u );
CPPUNIT_ASSERT( _s1.find(wxT('A')) == 8u );
CPPUNIT_ASSERT( _s1.find(wxT('A'), 8) == 8u );
CPPUNIT_ASSERT( _s1.find(wxT('Z')) == wxString::npos );
CPPUNIT_ASSERT( _s1.find(wxT('C'), 22) == 27u );
CPPUNIT_ASSERT( _s1.find(_T("AB")) == 8u );
CPPUNIT_ASSERT( _s1.find(_T("AB"), 26) == wxString::npos );
CPPUNIT_ASSERT( _s1.find(_T("AB"), 23) == 25u );
CPPUNIT_ASSERT( _s1.find(wxT("AB")) == 8u );
CPPUNIT_ASSERT( _s1.find(wxT("AB"), 26) == wxString::npos );
CPPUNIT_ASSERT( _s1.find(wxT("AB"), 23) == 25u );
CPPUNIT_ASSERT( _s1.find(_T("ABZZZ"), 2, 2) == 8u );
CPPUNIT_ASSERT( _s1.find(_T("ABZZZ"), 26, 2) == wxString::npos );
CPPUNIT_ASSERT( _s1.find(wxT("ABZZZ"), 2, 2) == 8u );
CPPUNIT_ASSERT( _s1.find(wxT("ABZZZ"), 26, 2) == wxString::npos );
CPPUNIT_ASSERT( _s1.find(_s2) == 6u );
CPPUNIT_ASSERT( _s1.find(_s2, 7) == wxString::npos );
@@ -293,157 +293,157 @@ void StdStringTestCase::StdFindFirst()
{
// 0 1 2 3
// 01234567890123456789012345678901234
wxString s1 = _T("aaaaaabcdefghlkjiaaaaaabcdbcdbcdbcd");
wxString s2 = _T("aaaaaa");
wxString s1 = wxT("aaaaaabcdefghlkjiaaaaaabcdbcdbcdbcd");
wxString s2 = wxT("aaaaaa");
CPPUNIT_ASSERT( s1.find_first_not_of(_T('a')) == 6u );
CPPUNIT_ASSERT( s1.find_first_not_of(_T('a'), 7) == 7u );
CPPUNIT_ASSERT( s2.find_first_not_of(_T('a')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_first_not_of(wxT('a')) == 6u );
CPPUNIT_ASSERT( s1.find_first_not_of(wxT('a'), 7) == 7u );
CPPUNIT_ASSERT( s2.find_first_not_of(wxT('a')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_first_not_of(_T("abde"), 4) == 7u );
CPPUNIT_ASSERT( s1.find_first_not_of(_T("abde"), 7) == 7u );
CPPUNIT_ASSERT( s1.find_first_not_of(_T("abcdefghijkl")) == wxString::npos );
CPPUNIT_ASSERT( s1.find_first_not_of(wxT("abde"), 4) == 7u );
CPPUNIT_ASSERT( s1.find_first_not_of(wxT("abde"), 7) == 7u );
CPPUNIT_ASSERT( s1.find_first_not_of(wxT("abcdefghijkl")) == wxString::npos );
CPPUNIT_ASSERT( s1.find_first_not_of(_T("abcdefghi"), 0, 4) == 9u );
CPPUNIT_ASSERT( s1.find_first_not_of(wxT("abcdefghi"), 0, 4) == 9u );
CPPUNIT_ASSERT( s1.find_first_of(_T('c')) == 7u );
CPPUNIT_ASSERT( s1.find_first_of(_T('v')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_first_of(_T('c'), 10) == 24u );
CPPUNIT_ASSERT( s1.find_first_of(wxT('c')) == 7u );
CPPUNIT_ASSERT( s1.find_first_of(wxT('v')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_first_of(wxT('c'), 10) == 24u );
CPPUNIT_ASSERT( s1.find_first_of(_T("ijkl")) == 13u );
CPPUNIT_ASSERT( s1.find_first_of(_T("ddcfg"), 17) == 24u );
CPPUNIT_ASSERT( s1.find_first_of(_T("ddcfga"), 17, 5) == 24u );
CPPUNIT_ASSERT( s1.find_first_of(wxT("ijkl")) == 13u );
CPPUNIT_ASSERT( s1.find_first_of(wxT("ddcfg"), 17) == 24u );
CPPUNIT_ASSERT( s1.find_first_of(wxT("ddcfga"), 17, 5) == 24u );
}
void StdStringTestCase::StdFindLast()
{
// 0 1 2 3
// 01234567890123456789012345678901234
wxString s1 = _T("aaaaaabcdefghlkjiaaaaaabcdbcdbcdbcd");
wxString s2 = _T("aaaaaa");
wxString s1 = wxT("aaaaaabcdefghlkjiaaaaaabcdbcdbcdbcd");
wxString s2 = wxT("aaaaaa");
CPPUNIT_ASSERT( s2.find_last_not_of(_T('a')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_last_not_of(_T('d')) == 33u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T('d'), 25) == 24u );
CPPUNIT_ASSERT( s2.find_last_not_of(wxT('a')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT('d')) == 33u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT('d'), 25) == 24u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T("bcd")) == 22u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T("abc"), 24) == 16u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT("bcd")) == 22u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT("abc"), 24) == 16u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T("abcdefghijklmnopqrstuv"), 24, 3) == 16u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT("abcdefghijklmnopqrstuv"), 24, 3) == 16u );
CPPUNIT_ASSERT( s2.find_last_of(_T('c')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_last_of(_T('a')) == 22u );
CPPUNIT_ASSERT( s1.find_last_of(_T('b'), 24) == 23u );
CPPUNIT_ASSERT( s2.find_last_of(wxT('c')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_last_of(wxT('a')) == 22u );
CPPUNIT_ASSERT( s1.find_last_of(wxT('b'), 24) == 23u );
CPPUNIT_ASSERT( s1.find_last_of(_T("ijklm")) == 16u );
CPPUNIT_ASSERT( s1.find_last_of(_T("ijklma"), 33, 4) == 16u );
CPPUNIT_ASSERT( s1.find_last_of(_T("a"), 17) == 17u );
CPPUNIT_ASSERT( s1.find_last_of(wxT("ijklm")) == 16u );
CPPUNIT_ASSERT( s1.find_last_of(wxT("ijklma"), 33, 4) == 16u );
CPPUNIT_ASSERT( s1.find_last_of(wxT("a"), 17) == 17u );
// 0 1 2 3
// 012345 67890123456789 01234567890123456
// wxString s1 = _T("aaaaaa\0bcdefghlkjiaa\0aaaabcdbcdbcdbcd");
// wxString s2 = _T("aaaaaa\0");
// wxString s1 = wxT("aaaaaa\0bcdefghlkjiaa\0aaaabcdbcdbcdbcd");
// wxString s2 = wxT("aaaaaa\0");
s1.insert(6,1,'\0');
s1.insert(20,1,'\0');
s2.insert(6,1,'\0');
CPPUNIT_ASSERT( s2.find_last_not_of(_T('a')) == 6u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T('d')) == 35u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T('d'), 27) == 26u );
CPPUNIT_ASSERT( s2.find_last_not_of(wxT('a')) == 6u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT('d')) == 35u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT('d'), 27) == 26u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T("bcd")) == 24u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T("abc"), 26) == 20u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT("bcd")) == 24u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT("abc"), 26) == 20u );
CPPUNIT_ASSERT( s1.find_last_not_of(_T("abcdefghijklmnopqrstuv"), 26, 3) == 20u );
CPPUNIT_ASSERT( s1.find_last_not_of(wxT("abcdefghijklmnopqrstuv"), 26, 3) == 20u );
CPPUNIT_ASSERT( s2.find_last_of(_T('c')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_last_of(_T('a')) == 24u );
CPPUNIT_ASSERT( s1.find_last_of(_T('b'), 26) == 25u );
CPPUNIT_ASSERT( s2.find_last_of(wxT('c')) == wxString::npos );
CPPUNIT_ASSERT( s1.find_last_of(wxT('a')) == 24u );
CPPUNIT_ASSERT( s1.find_last_of(wxT('b'), 26) == 25u );
CPPUNIT_ASSERT( s1.find_last_of(_T("ijklm")) == 17u );
CPPUNIT_ASSERT( s1.find_last_of(_T("ijklma"), 35, 4) == 17u );
CPPUNIT_ASSERT( s1.find_last_of(_T("a"), 18) == 18u );
CPPUNIT_ASSERT( s1.find_last_of(wxT("ijklm")) == 17u );
CPPUNIT_ASSERT( s1.find_last_of(wxT("ijklma"), 35, 4) == 17u );
CPPUNIT_ASSERT( s1.find_last_of(wxT("a"), 18) == 18u );
}
void StdStringTestCase::StdInsert()
{
wxString s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = _T("aaaa");
s9 = s10 = _T("cdefg");
s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = wxT("aaaa");
s9 = s10 = wxT("cdefg");
s1.insert(1, _T("cc") );
s2.insert(2, _T("cdef"), 3);
s1.insert(1, wxT("cc") );
s2.insert(2, wxT("cdef"), 3);
s3.insert(2, s10);
s4.insert(2, s10, 3, 7);
s5.insert(1, 2, _T('c'));
s6.insert(s6.begin() + 3, _T('X'));
s5.insert(1, 2, wxT('c'));
s6.insert(s6.begin() + 3, wxT('X'));
s7.insert(s7.begin(), s9.begin(), s9.end() - 1);
s8.insert(s8.begin(), 2, _T('c'));
s8.insert(s8.begin(), 2, wxT('c'));
CPPUNIT_ASSERT_EQUAL( _T("accaaa") , s1 );
CPPUNIT_ASSERT_EQUAL( _T("aacdeaa") , s2 );
CPPUNIT_ASSERT_EQUAL( _T("aacdefgaa"), s3 );
CPPUNIT_ASSERT_EQUAL( _T("aafgaa") , s4 );
CPPUNIT_ASSERT_EQUAL( _T("accaaa") , s5 );
CPPUNIT_ASSERT_EQUAL( _T("aaaXa") , s6 );
CPPUNIT_ASSERT_EQUAL( _T("cdefaaaa") , s7 );
CPPUNIT_ASSERT_EQUAL( _T("ccaaaa") , s8 );
CPPUNIT_ASSERT_EQUAL( wxT("accaaa") , s1 );
CPPUNIT_ASSERT_EQUAL( wxT("aacdeaa") , s2 );
CPPUNIT_ASSERT_EQUAL( wxT("aacdefgaa"), s3 );
CPPUNIT_ASSERT_EQUAL( wxT("aafgaa") , s4 );
CPPUNIT_ASSERT_EQUAL( wxT("accaaa") , s5 );
CPPUNIT_ASSERT_EQUAL( wxT("aaaXa") , s6 );
CPPUNIT_ASSERT_EQUAL( wxT("cdefaaaa") , s7 );
CPPUNIT_ASSERT_EQUAL( wxT("ccaaaa") , s8 );
s1 = s2 = s3 = _T("aaaa");
s1.insert(0, _T("ccc"), 2);
s2.insert(4, _T("ccc"), 2);
s1 = s2 = s3 = wxT("aaaa");
s1.insert(0, wxT("ccc"), 2);
s2.insert(4, wxT("ccc"), 2);
CPPUNIT_ASSERT_EQUAL( _T("ccaaaa"), s1 );
CPPUNIT_ASSERT_EQUAL( _T("aaaacc"), s2 );
CPPUNIT_ASSERT_EQUAL( wxT("ccaaaa"), s1 );
CPPUNIT_ASSERT_EQUAL( wxT("aaaacc"), s2 );
}
void StdStringTestCase::StdReplace()
{
wxString s1, s2, s3, s4, s5, s6, s7, s8, s9;
s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = _T("QWERTYUIOP");
s9 = _T("werty");
s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = wxT("QWERTYUIOP");
s9 = wxT("werty");
s1.replace(3, 4, _T("rtyu"));
s1.replace(8, 7, _T("opopop"));
s2.replace(10, 12, _T("WWWW"));
s1.replace(3, 4, wxT("rtyu"));
s1.replace(8, 7, wxT("opopop"));
s2.replace(10, 12, wxT("WWWW"));
s3.replace(1, 5, s9);
s4.replace(1, 4, s9, 0, 4);
s5.replace(1, 2, s9, 1, 12);
s6.replace(0, 123, s9, 0, 123);
s7.replace(2, 7, s9);
CPPUNIT_ASSERT_EQUAL( _T("QWErtyuIopopop"), s1 );
CPPUNIT_ASSERT_EQUAL( _T("QWERTYUIOPWWWW"), s2 );
CPPUNIT_ASSERT_EQUAL( _T("QwertyUIOP") , s3 );
CPPUNIT_ASSERT_EQUAL( _T("QwertYUIOP") , s4 );
CPPUNIT_ASSERT_EQUAL( _T("QertyRTYUIOP") , s5 );
CPPUNIT_ASSERT_EQUAL( wxT("QWErtyuIopopop"), s1 );
CPPUNIT_ASSERT_EQUAL( wxT("QWERTYUIOPWWWW"), s2 );
CPPUNIT_ASSERT_EQUAL( wxT("QwertyUIOP") , s3 );
CPPUNIT_ASSERT_EQUAL( wxT("QwertYUIOP") , s4 );
CPPUNIT_ASSERT_EQUAL( wxT("QertyRTYUIOP") , s5 );
CPPUNIT_ASSERT_EQUAL( s9, s6 );
CPPUNIT_ASSERT_EQUAL( _T("QWwertyP"), s7 );
CPPUNIT_ASSERT_EQUAL( wxT("QWwertyP"), s7 );
}
void StdStringTestCase::StdRFind()
{
// 0 1 2
// 01234567890123456789012345
wxString s1 = _T("abcdefgABCDEFGabcABCabcABC");
wxString s2 = _T("gAB");
wxString s3 = _T("ab");
wxString s1 = wxT("abcdefgABCDEFGabcABCabcABC");
wxString s2 = wxT("gAB");
wxString s3 = wxT("ab");
CPPUNIT_ASSERT( s1.rfind(_T('A')) == 23u );
CPPUNIT_ASSERT( s1.rfind(_T('A'), 7) == 7u );
CPPUNIT_ASSERT( s1.rfind(_T('Z')) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(_T('C'), 22) == 19u );
CPPUNIT_ASSERT( s1.rfind(wxT('A')) == 23u );
CPPUNIT_ASSERT( s1.rfind(wxT('A'), 7) == 7u );
CPPUNIT_ASSERT( s1.rfind(wxT('Z')) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(wxT('C'), 22) == 19u );
CPPUNIT_ASSERT( s1.rfind(_T("cAB")) == 22u );
CPPUNIT_ASSERT( s1.rfind(_T("cAB"), 15) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(_T("cAB"), 21) == 16u );
CPPUNIT_ASSERT( s1.rfind(wxT("cAB")) == 22u );
CPPUNIT_ASSERT( s1.rfind(wxT("cAB"), 15) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(wxT("cAB"), 21) == 16u );
CPPUNIT_ASSERT( s1.rfind(_T("gABZZZ"), 7, 3) == 6u );
CPPUNIT_ASSERT( s1.rfind(_T("gABZZZ"), 5, 3) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(wxT("gABZZZ"), 7, 3) == 6u );
CPPUNIT_ASSERT( s1.rfind(wxT("gABZZZ"), 5, 3) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(s2) == 6u );
CPPUNIT_ASSERT( s1.rfind(s2, 5) == wxString::npos );
@@ -453,41 +453,41 @@ void StdStringTestCase::StdRFind()
// 0 1 2
// 01234 56789012 345678901234567
// wxString s1 = _T("abcde\0fgABCDE\0FGabcABCabcABC");
// wxString s2 = _T("gAB");
// wxString s3 = _T("ab");
// wxString s1 = wxT("abcde\0fgABCDE\0FGabcABCabcABC");
// wxString s2 = wxT("gAB");
// wxString s3 = wxT("ab");
s1.insert(5,1,'\0');
s1.insert(13,1,'\0');
CPPUNIT_ASSERT( s1.rfind(_T('A')) == 25u );
CPPUNIT_ASSERT( s1.rfind(_T('A'), 8) == 8u );
CPPUNIT_ASSERT( s1.rfind(_T('Z')) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(_T('C'), 22) == 21u );
CPPUNIT_ASSERT( s1.rfind(wxT('A')) == 25u );
CPPUNIT_ASSERT( s1.rfind(wxT('A'), 8) == 8u );
CPPUNIT_ASSERT( s1.rfind(wxT('Z')) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(wxT('C'), 22) == 21u );
CPPUNIT_ASSERT( s1.rfind(_T("cAB")) == 24u );
CPPUNIT_ASSERT( s1.rfind(_T("cAB"), 15) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(_T("cAB"), 21) == 18u );
CPPUNIT_ASSERT( s1.rfind(wxT("cAB")) == 24u );
CPPUNIT_ASSERT( s1.rfind(wxT("cAB"), 15) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(wxT("cAB"), 21) == 18u );
CPPUNIT_ASSERT( s1.rfind(_T("gABZZZ"), 8, 3) == 7u );
CPPUNIT_ASSERT( s1.rfind(_T("gABZZZ"), 5, 3) == wxString::npos );
CPPUNIT_ASSERT( s1.rfind(wxT("gABZZZ"), 8, 3) == 7u );
CPPUNIT_ASSERT( s1.rfind(wxT("gABZZZ"), 5, 3) == wxString::npos );
}
void StdStringTestCase::StdResize()
{
wxString s1, s2, s3, s4;
s1 = s2 = s3 = s4 = _T("abcABCdefDEF");
s1 = s2 = s3 = s4 = wxT("abcABCdefDEF");
s1.resize( 12 );
s2.resize( 10 );
s3.resize( 14, _T(' ') );
s4.resize( 14, _T('W') );
s3.resize( 14, wxT(' ') );
s4.resize( 14, wxT('W') );
CPPUNIT_ASSERT_EQUAL( _T("abcABCdefDEF"), s1 );
CPPUNIT_ASSERT_EQUAL( _T("abcABCdefD"), s2 );
CPPUNIT_ASSERT_EQUAL( _T("abcABCdefDEF "), s3 );
CPPUNIT_ASSERT_EQUAL( _T("abcABCdefDEFWW"), s4 );
CPPUNIT_ASSERT_EQUAL( wxT("abcABCdefDEF"), s1 );
CPPUNIT_ASSERT_EQUAL( wxT("abcABCdefD"), s2 );
CPPUNIT_ASSERT_EQUAL( wxT("abcABCdefDEF "), s3 );
CPPUNIT_ASSERT_EQUAL( wxT("abcABCdefDEFWW"), s4 );
wxString s =
wxString::FromUTF8("\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82");
@@ -497,32 +497,32 @@ void StdStringTestCase::StdResize()
void StdStringTestCase::StdRiter()
{
const wxString s(_T("fozbar"));
const wxString s(wxT("fozbar"));
wxString::const_reverse_iterator ri(s.rbegin());
CPPUNIT_ASSERT( _T('r') == *ri );
CPPUNIT_ASSERT( _T('a') == *++ri );
CPPUNIT_ASSERT( _T('r') == *--ri );
CPPUNIT_ASSERT( wxT('r') == *ri );
CPPUNIT_ASSERT( wxT('a') == *++ri );
CPPUNIT_ASSERT( wxT('r') == *--ri );
ri = s.rend();
ri--;
CPPUNIT_ASSERT( _T('f') == *ri );
CPPUNIT_ASSERT( wxT('f') == *ri );
--ri;
CPPUNIT_ASSERT( _T('o') == *ri );
CPPUNIT_ASSERT( wxT('o') == *ri );
wxString::const_iterator i = ri.base();
CPPUNIT_ASSERT( _T('z') == *i );
CPPUNIT_ASSERT( wxT('z') == *i );
}
void StdStringTestCase::StdSubstr()
{
wxString s1 = _T("abcdefgABCDEFG");
wxString s1 = wxT("abcdefgABCDEFG");
CPPUNIT_ASSERT( s1.substr( 0, 14 ) == s1 );
CPPUNIT_ASSERT( s1.substr( 1, 13 ) == _T("bcdefgABCDEFG") );
CPPUNIT_ASSERT( s1.substr( 1, 20 ) == _T("bcdefgABCDEFG") );
CPPUNIT_ASSERT( s1.substr( 14, 30 ) == _T("") );
CPPUNIT_ASSERT( s1.substr( 1, 13 ) == wxT("bcdefgABCDEFG") );
CPPUNIT_ASSERT( s1.substr( 1, 20 ) == wxT("bcdefgABCDEFG") );
CPPUNIT_ASSERT( s1.substr( 14, 30 ) == wxT("") );
s1.insert(3,1,'\0');
s1.insert(8,1,'\0');
@@ -536,7 +536,7 @@ void StdStringTestCase::StdSubstr()
CPPUNIT_ASSERT( s1.substr( 0, 17 ) == s1 );
CPPUNIT_ASSERT( s1.substr( 1, 17 ) == s2 );
CPPUNIT_ASSERT( s1.substr( 1, 20 ) == s2 );
CPPUNIT_ASSERT( s1.substr( 17, 30 ) == _T("") );
CPPUNIT_ASSERT( s1.substr( 17, 30 ) == wxT("") );
}
#if wxUSE_STD_STRING

View File

@@ -119,12 +119,12 @@ void StringTestCase::String()
for (int i = 0; i < 2; ++i)
{
a = _T("Hello");
b = _T(" world");
c = _T("! How'ya doin'?");
a = wxT("Hello");
b = wxT(" world");
c = wxT("! How'ya doin'?");
a += b;
a += c;
c = _T("Hello world! What's up?");
c = wxT("Hello world! What's up?");
CPPUNIT_ASSERT( c != a );
}
}
@@ -137,12 +137,12 @@ void StringTestCase::PChar()
for (int i = 0; i < 2; ++i)
{
wxStrcpy (a, _T("Hello"));
wxStrcpy (b, _T(" world"));
wxStrcpy (c, _T("! How'ya doin'?"));
wxStrcpy (a, wxT("Hello"));
wxStrcpy (b, wxT(" world"));
wxStrcpy (c, wxT("! How'ya doin'?"));
wxStrcat (a, b);
wxStrcat (a, c);
wxStrcpy (c, _T("Hello world! What's up?"));
wxStrcpy (c, wxT("Hello world! What's up?"));
CPPUNIT_ASSERT( wxStrcmp (c, a) != 0 );
}
}
@@ -150,18 +150,18 @@ void StringTestCase::PChar()
void StringTestCase::Format()
{
wxString s1,s2;
s1.Printf(_T("%03d"), 18);
CPPUNIT_ASSERT( s1 == wxString::Format(_T("%03d"), 18) );
s2.Printf(_T("Number 18: %s\n"), s1.c_str());
CPPUNIT_ASSERT( s2 == wxString::Format(_T("Number 18: %s\n"), s1.c_str()) );
s1.Printf(wxT("%03d"), 18);
CPPUNIT_ASSERT( s1 == wxString::Format(wxT("%03d"), 18) );
s2.Printf(wxT("Number 18: %s\n"), s1.c_str());
CPPUNIT_ASSERT( s2 == wxString::Format(wxT("Number 18: %s\n"), s1.c_str()) );
static const size_t lengths[] = { 1, 512, 1024, 1025, 2048, 4096, 4097 };
for ( size_t n = 0; n < WXSIZEOF(lengths); n++ )
{
const size_t len = lengths[n];
wxString s(_T('Z'), len);
CPPUNIT_ASSERT_EQUAL( len, wxString::Format(_T("%s"), s.c_str()).length());
wxString s(wxT('Z'), len);
CPPUNIT_ASSERT_EQUAL( len, wxString::Format(wxT("%s"), s.c_str()).length());
}
}
@@ -213,15 +213,15 @@ void StringTestCase::StaticConstructors()
void StringTestCase::Extraction()
{
wxString s(_T("Hello, world!"));
wxString s(wxT("Hello, world!"));
CPPUNIT_ASSERT( wxStrcmp( s.c_str() , _T("Hello, world!") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.Left(5).c_str() , _T("Hello") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.Right(6).c_str() , _T("world!") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s(3, 5).c_str() , _T("lo, w") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.Mid(3).c_str() , _T("lo, world!") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.substr(3, 5).c_str() , _T("lo, w") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.substr(3).c_str() , _T("lo, world!") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.c_str() , wxT("Hello, world!") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.Left(5).c_str() , wxT("Hello") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.Right(6).c_str() , wxT("world!") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s(3, 5).c_str() , wxT("lo, w") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.Mid(3).c_str() , wxT("lo, world!") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.substr(3, 5).c_str() , wxT("lo, w") ) == 0 );
CPPUNIT_ASSERT( wxStrcmp( s.substr(3).c_str() , wxT("lo, world!") ) == 0 );
#if wxUSE_UNICODE
static const char *germanUTF8 = "Oberfl\303\244che";
@@ -238,13 +238,13 @@ void StringTestCase::Extraction()
if ( result ) \
CPPUNIT_ASSERT_EQUAL(correct_rest, rest)
TEST_STARTS_WITH( _T("Hello"), _T(", world!"), true );
TEST_STARTS_WITH( _T("Hello, "), _T("world!"), true );
TEST_STARTS_WITH( _T("Hello, world!"), _T(""), true );
TEST_STARTS_WITH( _T("Hello, world!!!"), _T(""), false );
TEST_STARTS_WITH( _T(""), _T("Hello, world!"), true );
TEST_STARTS_WITH( _T("Goodbye"), _T(""), false );
TEST_STARTS_WITH( _T("Hi"), _T(""), false );
TEST_STARTS_WITH( wxT("Hello"), wxT(", world!"), true );
TEST_STARTS_WITH( wxT("Hello, "), wxT("world!"), true );
TEST_STARTS_WITH( wxT("Hello, world!"), wxT(""), true );
TEST_STARTS_WITH( wxT("Hello, world!!!"), wxT(""), false );
TEST_STARTS_WITH( wxT(""), wxT("Hello, world!"), true );
TEST_STARTS_WITH( wxT("Goodbye"), wxT(""), false );
TEST_STARTS_WITH( wxT("Hi"), wxT(""), false );
#undef TEST_STARTS_WITH
@@ -257,15 +257,15 @@ void StringTestCase::Extraction()
if ( result ) \
CPPUNIT_ASSERT_EQUAL(correct_rest, rest)
TEST_ENDS_WITH( _T(""), _T("Hello, world!"), true );
TEST_ENDS_WITH( _T("!"), _T("Hello, world"), true );
TEST_ENDS_WITH( _T(", world!"), _T("Hello"), true );
TEST_ENDS_WITH( _T("ello, world!"), _T("H"), true );
TEST_ENDS_WITH( _T("Hello, world!"), _T(""), true );
TEST_ENDS_WITH( _T("very long string"), _T(""), false );
TEST_ENDS_WITH( _T("?"), _T(""), false );
TEST_ENDS_WITH( _T("Hello, world"), _T(""), false );
TEST_ENDS_WITH( _T("Gello, world!"), _T(""), false );
TEST_ENDS_WITH( wxT(""), wxT("Hello, world!"), true );
TEST_ENDS_WITH( wxT("!"), wxT("Hello, world"), true );
TEST_ENDS_WITH( wxT(", world!"), wxT("Hello"), true );
TEST_ENDS_WITH( wxT("ello, world!"), wxT("H"), true );
TEST_ENDS_WITH( wxT("Hello, world!"), wxT(""), true );
TEST_ENDS_WITH( wxT("very long string"), wxT(""), false );
TEST_ENDS_WITH( wxT("?"), wxT(""), false );
TEST_ENDS_WITH( wxT("Hello, world"), wxT(""), false );
TEST_ENDS_WITH( wxT("Gello, world!"), wxT(""), false );
#undef TEST_ENDS_WITH
}
@@ -275,15 +275,15 @@ void StringTestCase::Trim()
#define TEST_TRIM( str , dir , result ) \
CPPUNIT_ASSERT( wxString(str).Trim(dir) == result )
TEST_TRIM( _T(" Test "), true, _T(" Test") );
TEST_TRIM( _T(" "), true, _T("") );
TEST_TRIM( _T(" "), true, _T("") );
TEST_TRIM( _T(""), true, _T("") );
TEST_TRIM( wxT(" Test "), true, wxT(" Test") );
TEST_TRIM( wxT(" "), true, wxT("") );
TEST_TRIM( wxT(" "), true, wxT("") );
TEST_TRIM( wxT(""), true, wxT("") );
TEST_TRIM( _T(" Test "), false, _T("Test ") );
TEST_TRIM( _T(" "), false, _T("") );
TEST_TRIM( _T(" "), false, _T("") );
TEST_TRIM( _T(""), false, _T("") );
TEST_TRIM( wxT(" Test "), false, wxT("Test ") );
TEST_TRIM( wxT(" "), false, wxT("") );
TEST_TRIM( wxT(" "), false, wxT("") );
TEST_TRIM( wxT(""), false, wxT("") );
#undef TEST_TRIM
}
@@ -291,11 +291,11 @@ void StringTestCase::Trim()
void StringTestCase::Find()
{
#define TEST_FIND( str , start , result ) \
CPPUNIT_ASSERT( wxString(str).find(_T("ell"), start) == result );
CPPUNIT_ASSERT( wxString(str).find(wxT("ell"), start) == result );
TEST_FIND( _T("Well, hello world"), 0, 1 );
TEST_FIND( _T("Well, hello world"), 6, 7 );
TEST_FIND( _T("Well, hello world"), 9, wxString::npos );
TEST_FIND( wxT("Well, hello world"), 0, 1 );
TEST_FIND( wxT("Well, hello world"), 6, 7 );
TEST_FIND( wxT("Well, hello world"), 9, wxString::npos );
#undef TEST_FIND
}
@@ -309,11 +309,11 @@ void StringTestCase::Replace()
CPPUNIT_ASSERT_EQUAL( result, s ); \
}
TEST_REPLACE( _T("012-AWORD-XYZ"), 4, 5, _T("BWORD"), _T("012-BWORD-XYZ") );
TEST_REPLACE( _T("increase"), 0, 2, _T("de"), _T("decrease") );
TEST_REPLACE( _T("wxWindow"), 8, 0, _T("s"), _T("wxWindows") );
TEST_REPLACE( _T("foobar"), 3, 0, _T("-"), _T("foo-bar") );
TEST_REPLACE( _T("barfoo"), 0, 6, _T("foobar"), _T("foobar") );
TEST_REPLACE( wxT("012-AWORD-XYZ"), 4, 5, wxT("BWORD"), wxT("012-BWORD-XYZ") );
TEST_REPLACE( wxT("increase"), 0, 2, wxT("de"), wxT("decrease") );
TEST_REPLACE( wxT("wxWindow"), 8, 0, wxT("s"), wxT("wxWindows") );
TEST_REPLACE( wxT("foobar"), 3, 0, wxT("-"), wxT("foo-bar") );
TEST_REPLACE( wxT("barfoo"), 0, 6, wxT("foobar"), wxT("foobar") );
#define TEST_NULLCHARREPLACE( o , olen, pos , len , replacement , r, rlen ) \
@@ -323,8 +323,8 @@ void StringTestCase::Replace()
CPPUNIT_ASSERT_EQUAL( wxString(r,rlen), s ); \
}
TEST_NULLCHARREPLACE( _T("null\0char"), 9, 5, 1, _T("d"),
_T("null\0dhar"), 9 );
TEST_NULLCHARREPLACE( wxT("null\0char"), 9, 5, 1, wxT("d"),
wxT("null\0dhar"), 9 );
#define TEST_WXREPLACE( o , olen, olds, news, all, r, rlen ) \
{ \
@@ -333,11 +333,11 @@ void StringTestCase::Replace()
CPPUNIT_ASSERT_EQUAL( wxString(r,rlen), s ); \
}
TEST_WXREPLACE( _T("null\0char"), 9, _T("c"), _T("de"), true,
_T("null\0dehar"), 10 );
TEST_WXREPLACE( wxT("null\0char"), 9, wxT("c"), wxT("de"), true,
wxT("null\0dehar"), 10 );
TEST_WXREPLACE( _T("null\0dehar"), 10, _T("de"), _T("c"), true,
_T("null\0char"), 9 );
TEST_WXREPLACE( wxT("null\0dehar"), 10, wxT("de"), wxT("c"), true,
wxT("null\0char"), 9 );
TEST_WXREPLACE( "life", 4, "f", "", false, "lie", 3 );
TEST_WXREPLACE( "life", 4, "f", "", true, "lie", 3 );
@@ -355,17 +355,17 @@ void StringTestCase::Match()
#define TEST_MATCH( s1 , s2 , result ) \
CPPUNIT_ASSERT( wxString(s1).Matches(s2) == result )
TEST_MATCH( _T("foobar"), _T("foo*"), true );
TEST_MATCH( _T("foobar"), _T("*oo*"), true );
TEST_MATCH( _T("foobar"), _T("*bar"), true );
TEST_MATCH( _T("foobar"), _T("??????"), true );
TEST_MATCH( _T("foobar"), _T("f??b*"), true );
TEST_MATCH( _T("foobar"), _T("f?b*"), false );
TEST_MATCH( _T("foobar"), _T("*goo*"), false );
TEST_MATCH( _T("foobar"), _T("*foo"), false );
TEST_MATCH( _T("foobarfoo"), _T("*foo"), true );
TEST_MATCH( _T(""), _T("*"), true );
TEST_MATCH( _T(""), _T("?"), false );
TEST_MATCH( wxT("foobar"), wxT("foo*"), true );
TEST_MATCH( wxT("foobar"), wxT("*oo*"), true );
TEST_MATCH( wxT("foobar"), wxT("*bar"), true );
TEST_MATCH( wxT("foobar"), wxT("??????"), true );
TEST_MATCH( wxT("foobar"), wxT("f??b*"), true );
TEST_MATCH( wxT("foobar"), wxT("f?b*"), false );
TEST_MATCH( wxT("foobar"), wxT("*goo*"), false );
TEST_MATCH( wxT("foobar"), wxT("*foo"), false );
TEST_MATCH( wxT("foobarfoo"), wxT("*foo"), true );
TEST_MATCH( wxT(""), wxT("*"), true );
TEST_MATCH( wxT(""), wxT("?"), false );
#undef TEST_MATCH
}
@@ -373,14 +373,14 @@ void StringTestCase::Match()
void StringTestCase::CaseChanges()
{
wxString s1(_T("Hello!"));
wxString s1(wxT("Hello!"));
wxString s1u(s1);
wxString s1l(s1);
s1u.MakeUpper();
s1l.MakeLower();
CPPUNIT_ASSERT_EQUAL( _T("HELLO!"), s1u );
CPPUNIT_ASSERT_EQUAL( _T("hello!"), s1l );
CPPUNIT_ASSERT_EQUAL( wxT("HELLO!"), s1u );
CPPUNIT_ASSERT_EQUAL( wxT("hello!"), s1l );
wxString s2u, s2l;
s2u.MakeUpper();
@@ -511,15 +511,15 @@ void StringTestCase::Contains()
bool contains;
} containsData[] =
{
{ _T(""), _T(""), true },
{ _T(""), _T("foo"), false },
{ _T("foo"), _T(""), true },
{ _T("foo"), _T("f"), true },
{ _T("foo"), _T("o"), true },
{ _T("foo"), _T("oo"), true },
{ _T("foo"), _T("ooo"), false },
{ _T("foo"), _T("oooo"), false },
{ _T("foo"), _T("fooo"), false },
{ wxT(""), wxT(""), true },
{ wxT(""), wxT("foo"), false },
{ wxT("foo"), wxT(""), true },
{ wxT("foo"), wxT("f"), true },
{ wxT("foo"), wxT("o"), true },
{ wxT("foo"), wxT("oo"), true },
{ wxT("foo"), wxT("ooo"), false },
{ wxT("foo"), wxT("oooo"), false },
{ wxT("foo"), wxT("fooo"), false },
};
for ( size_t n = 0; n < WXSIZEOF(containsData); n++ )
@@ -560,23 +560,23 @@ static const struct ToLongData
bool IsOk() const { return !(flags & Number_Invalid); }
} longData[] =
{
{ _T("1"), 1, Number_Ok },
{ _T("0"), 0, Number_Ok },
{ _T("a"), 0, Number_Invalid },
{ _T("12345"), 12345, Number_Ok },
{ _T("--1"), 0, Number_Invalid },
{ wxT("1"), 1, Number_Ok },
{ wxT("0"), 0, Number_Ok },
{ wxT("a"), 0, Number_Invalid },
{ wxT("12345"), 12345, Number_Ok },
{ wxT("--1"), 0, Number_Invalid },
{ _T("-1"), -1, Number_Signed | Number_Long },
{ wxT("-1"), -1, Number_Signed | Number_Long },
// this is surprizing but consistent with strtoul() behaviour
{ _T("-1"), ULONG_MAX, Number_Unsigned | Number_Long },
{ wxT("-1"), ULONG_MAX, Number_Unsigned | Number_Long },
// this must overflow, even with 64 bit long
{ _T("922337203685477580711"), 0, Number_Invalid },
{ wxT("922337203685477580711"), 0, Number_Invalid },
#ifdef wxLongLong_t
{ _T("2147483648"), wxLL(2147483648), Number_LongLong },
{ _T("-2147483648"), wxLL(-2147483648), Number_LongLong | Number_Signed },
{ _T("9223372036854775808"), wxULL(9223372036854775808), Number_LongLong |
{ wxT("2147483648"), wxLL(2147483648), Number_LongLong },
{ wxT("-2147483648"), wxLL(-2147483648), Number_LongLong | Number_Signed },
{ wxT("9223372036854775808"), wxULL(9223372036854775808), Number_LongLong |
Number_Unsigned },
#endif // wxLongLong_t
};
@@ -673,18 +673,18 @@ void StringTestCase::ToDouble()
bool ok;
} doubleData[] =
{
{ _T("1"), 1, true },
{ _T("1.23"), 1.23, true },
{ _T(".1"), .1, true },
{ _T("1."), 1, true },
{ _T("1.."), 0, false },
{ _T("0"), 0, true },
{ _T("a"), 0, false },
{ _T("12345"), 12345, true },
{ _T("-1"), -1, true },
{ _T("--1"), 0, false },
{ _T("-3E-5"), -3E-5, true },
{ _T("-3E-abcde5"), 0, false },
{ wxT("1"), 1, true },
{ wxT("1.23"), 1.23, true },
{ wxT(".1"), .1, true },
{ wxT("1."), 1, true },
{ wxT("1.."), 0, false },
{ wxT("0"), 0, true },
{ wxT("a"), 0, false },
{ wxT("12345"), 12345, true },
{ wxT("-1"), -1, true },
{ wxT("--1"), 0, false },
{ wxT("-3E-5"), -3E-5, true },
{ wxT("-3E-abcde5"), 0, false },
};
// test ToCDouble() first:
@@ -713,18 +713,18 @@ void StringTestCase::ToDouble()
static const struct ToDoubleData doubleData2[] =
{
{ _T("1"), 1, true },
{ _T("1,23"), 1.23, true },
{ _T(",1"), .1, true },
{ _T("1,"), 1, true },
{ _T("1,,"), 0, false },
{ _T("0"), 0, true },
{ _T("a"), 0, false },
{ _T("12345"), 12345, true },
{ _T("-1"), -1, true },
{ _T("--1"), 0, false },
{ _T("-3E-5"), -3E-5, true },
{ _T("-3E-abcde5"), 0, false },
{ wxT("1"), 1, true },
{ wxT("1,23"), 1.23, true },
{ wxT(",1"), .1, true },
{ wxT("1,"), 1, true },
{ wxT("1,,"), 0, false },
{ wxT("0"), 0, true },
{ wxT("a"), 0, false },
{ wxT("12345"), 12345, true },
{ wxT("-1"), -1, true },
{ wxT("--1"), 0, false },
{ wxT("-3E-5"), -3E-5, true },
{ wxT("-3E-abcde5"), 0, false },
};
for ( n = 0; n < WXSIZEOF(doubleData2); n++ )
@@ -742,41 +742,41 @@ void StringTestCase::StringBuf()
{
// check that buffer can be used to write into the string
wxString s;
wxStrcpy(wxStringBuffer(s, 10), _T("foo"));
wxStrcpy(wxStringBuffer(s, 10), wxT("foo"));
CPPUNIT_ASSERT_EQUAL(3, s.length());
CPPUNIT_ASSERT(_T('f') == s[0u]);
CPPUNIT_ASSERT(_T('o') == s[1]);
CPPUNIT_ASSERT(_T('o') == s[2]);
CPPUNIT_ASSERT(wxT('f') == s[0u]);
CPPUNIT_ASSERT(wxT('o') == s[1]);
CPPUNIT_ASSERT(wxT('o') == s[2]);
{
// also check that the buffer initially contains the original string
// contents
wxStringBuffer buf(s, 10);
CPPUNIT_ASSERT_EQUAL( _T('f'), buf[0] );
CPPUNIT_ASSERT_EQUAL( _T('o'), buf[1] );
CPPUNIT_ASSERT_EQUAL( _T('o'), buf[2] );
CPPUNIT_ASSERT_EQUAL( _T('\0'), buf[3] );
CPPUNIT_ASSERT_EQUAL( wxT('f'), buf[0] );
CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[1] );
CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[2] );
CPPUNIT_ASSERT_EQUAL( wxT('\0'), buf[3] );
}
{
wxStringBufferLength buf(s, 10);
CPPUNIT_ASSERT_EQUAL( _T('f'), buf[0] );
CPPUNIT_ASSERT_EQUAL( _T('o'), buf[1] );
CPPUNIT_ASSERT_EQUAL( _T('o'), buf[2] );
CPPUNIT_ASSERT_EQUAL( _T('\0'), buf[3] );
CPPUNIT_ASSERT_EQUAL( wxT('f'), buf[0] );
CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[1] );
CPPUNIT_ASSERT_EQUAL( wxT('o'), buf[2] );
CPPUNIT_ASSERT_EQUAL( wxT('\0'), buf[3] );
// and check that it can be used to write only the specified number of
// characters to the string
wxStrcpy(buf, _T("barrbaz"));
wxStrcpy(buf, wxT("barrbaz"));
buf.SetLength(4);
}
CPPUNIT_ASSERT_EQUAL(4, s.length());
CPPUNIT_ASSERT(_T('b') == s[0u]);
CPPUNIT_ASSERT(_T('a') == s[1]);
CPPUNIT_ASSERT(_T('r') == s[2]);
CPPUNIT_ASSERT(_T('r') == s[3]);
CPPUNIT_ASSERT(wxT('b') == s[0u]);
CPPUNIT_ASSERT(wxT('a') == s[1]);
CPPUNIT_ASSERT(wxT('r') == s[2]);
CPPUNIT_ASSERT(wxT('r') == s[3]);
// check that creating buffer of length smaller than string works, i.e. at
// least doesn't crash (it would if we naively copied the entire original

View File

@@ -76,54 +76,54 @@ static const struct TokenizerTestData
}
gs_testData[] =
{
{ _T(""), _T(" "), wxTOKEN_DEFAULT, 0 },
{ _T(""), _T(" "), wxTOKEN_RET_EMPTY, 0 },
{ _T(""), _T(" "), wxTOKEN_RET_EMPTY_ALL, 0 },
{ _T(""), _T(" "), wxTOKEN_RET_DELIMS, 0 },
{ _T(":"), _T(":"), wxTOKEN_RET_EMPTY, 1 },
{ _T(":"), _T(":"), wxTOKEN_RET_DELIMS, 1 },
{ _T(":"), _T(":"), wxTOKEN_RET_EMPTY_ALL, 2 },
{ _T("::"), _T(":"), wxTOKEN_RET_EMPTY, 1 },
{ _T("::"), _T(":"), wxTOKEN_RET_DELIMS, 1 },
{ _T("::"), _T(":"), wxTOKEN_RET_EMPTY_ALL, 3 },
{ wxT(""), wxT(" "), wxTOKEN_DEFAULT, 0 },
{ wxT(""), wxT(" "), wxTOKEN_RET_EMPTY, 0 },
{ wxT(""), wxT(" "), wxTOKEN_RET_EMPTY_ALL, 0 },
{ wxT(""), wxT(" "), wxTOKEN_RET_DELIMS, 0 },
{ wxT(":"), wxT(":"), wxTOKEN_RET_EMPTY, 1 },
{ wxT(":"), wxT(":"), wxTOKEN_RET_DELIMS, 1 },
{ wxT(":"), wxT(":"), wxTOKEN_RET_EMPTY_ALL, 2 },
{ wxT("::"), wxT(":"), wxTOKEN_RET_EMPTY, 1 },
{ wxT("::"), wxT(":"), wxTOKEN_RET_DELIMS, 1 },
{ wxT("::"), wxT(":"), wxTOKEN_RET_EMPTY_ALL, 3 },
{ _T("Hello, world"), _T(" "), wxTOKEN_DEFAULT, 2 },
{ _T("Hello, world "), _T(" "), wxTOKEN_DEFAULT, 2 },
{ _T("Hello, world"), _T(","), wxTOKEN_DEFAULT, 2 },
{ _T("Hello, world!"), _T(",!"), wxTOKEN_DEFAULT, 2 },
{ _T("Hello,, world!"), _T(",!"), wxTOKEN_DEFAULT, 3 },
{ _T("Hello,, world!"), _T(",!"), wxTOKEN_STRTOK, 2 },
{ _T("Hello, world!"), _T(",!"), wxTOKEN_RET_EMPTY_ALL, 3 },
{ wxT("Hello, world"), wxT(" "), wxTOKEN_DEFAULT, 2 },
{ wxT("Hello, world "), wxT(" "), wxTOKEN_DEFAULT, 2 },
{ wxT("Hello, world"), wxT(","), wxTOKEN_DEFAULT, 2 },
{ wxT("Hello, world!"), wxT(",!"), wxTOKEN_DEFAULT, 2 },
{ wxT("Hello,, world!"), wxT(",!"), wxTOKEN_DEFAULT, 3 },
{ wxT("Hello,, world!"), wxT(",!"), wxTOKEN_STRTOK, 2 },
{ wxT("Hello, world!"), wxT(",!"), wxTOKEN_RET_EMPTY_ALL, 3 },
{ _T("username:password:uid:gid:gecos:home:shell"),
_T(":"), wxTOKEN_DEFAULT, 7 },
{ wxT("username:password:uid:gid:gecos:home:shell"),
wxT(":"), wxTOKEN_DEFAULT, 7 },
{ _T("1:2::3:"), _T(":"), wxTOKEN_DEFAULT, 4 },
{ _T("1:2::3:"), _T(":"), wxTOKEN_RET_EMPTY, 4 },
{ _T("1:2::3:"), _T(":"), wxTOKEN_RET_EMPTY_ALL, 5 },
{ _T("1:2::3:"), _T(":"), wxTOKEN_RET_DELIMS, 4 },
{ _T("1:2::3:"), _T(":"), wxTOKEN_STRTOK, 3 },
{ wxT("1:2::3:"), wxT(":"), wxTOKEN_DEFAULT, 4 },
{ wxT("1:2::3:"), wxT(":"), wxTOKEN_RET_EMPTY, 4 },
{ wxT("1:2::3:"), wxT(":"), wxTOKEN_RET_EMPTY_ALL, 5 },
{ wxT("1:2::3:"), wxT(":"), wxTOKEN_RET_DELIMS, 4 },
{ wxT("1:2::3:"), wxT(":"), wxTOKEN_STRTOK, 3 },
{ _T("1:2::3::"), _T(":"), wxTOKEN_DEFAULT, 4 },
{ _T("1:2::3::"), _T(":"), wxTOKEN_RET_EMPTY, 4 },
{ _T("1:2::3::"), _T(":"), wxTOKEN_RET_EMPTY_ALL, 6 },
{ _T("1:2::3::"), _T(":"), wxTOKEN_RET_DELIMS, 4 },
{ _T("1:2::3::"), _T(":"), wxTOKEN_STRTOK, 3 },
{ wxT("1:2::3::"), wxT(":"), wxTOKEN_DEFAULT, 4 },
{ wxT("1:2::3::"), wxT(":"), wxTOKEN_RET_EMPTY, 4 },
{ wxT("1:2::3::"), wxT(":"), wxTOKEN_RET_EMPTY_ALL, 6 },
{ wxT("1:2::3::"), wxT(":"), wxTOKEN_RET_DELIMS, 4 },
{ wxT("1:2::3::"), wxT(":"), wxTOKEN_STRTOK, 3 },
{ _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_DEFAULT, 4 },
{ _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_STRTOK, 4 },
{ _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_RET_EMPTY, 6 },
{ _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_RET_EMPTY_ALL, 9 },
{ wxT("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_DEFAULT, 4 },
{ wxT("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_STRTOK, 4 },
{ wxT("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_RET_EMPTY, 6 },
{ wxT("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_RET_EMPTY_ALL, 9 },
{ _T("01/02/99"), _T("/-"), wxTOKEN_DEFAULT, 3 },
{ _T("01-02/99"), _T("/-"), wxTOKEN_RET_DELIMS, 3 },
{ wxT("01/02/99"), wxT("/-"), wxTOKEN_DEFAULT, 3 },
{ wxT("01-02/99"), wxT("/-"), wxTOKEN_RET_DELIMS, 3 },
};
// helper function returning the string showing the index for which the test
// fails in the diagnostic message
static std::string Nth(size_t n)
{
return std::string(wxString::Format(_T("for loop index %lu"),
return std::string(wxString::Format(wxT("for loop index %lu"),
(unsigned long)n).mb_str());
}
@@ -184,9 +184,9 @@ DoTestGetPosition(const wxChar *s, const wxChar *delims, int pos, ...)
void TokenizerTestCase::GetPosition()
{
DoTestGetPosition(_T("foo"), _T("_"), 3, 0);
DoTestGetPosition(_T("foo_bar"), _T("_"), 4, 7, 0);
DoTestGetPosition(_T("foo_bar_"), _T("_"), 4, 8, 0);
DoTestGetPosition(wxT("foo"), wxT("_"), 3, 0);
DoTestGetPosition(wxT("foo_bar"), wxT("_"), 4, 7, 0);
DoTestGetPosition(wxT("foo_bar_"), wxT("_"), 4, 8, 0);
}
// helper for GetString(): the parameters are the same as for DoTestGetPosition
@@ -221,26 +221,26 @@ DoTestGetString(const wxChar *s, const wxChar *delims, int pos, ...)
void TokenizerTestCase::GetString()
{
DoTestGetString(_T("foo"), _T("_"), 3, 0);
DoTestGetString(_T("foo_bar"), _T("_"), 4, 7, 0);
DoTestGetString(_T("foo_bar_"), _T("_"), 4, 8, 0);
DoTestGetString(wxT("foo"), wxT("_"), 3, 0);
DoTestGetString(wxT("foo_bar"), wxT("_"), 4, 7, 0);
DoTestGetString(wxT("foo_bar_"), wxT("_"), 4, 8, 0);
}
void TokenizerTestCase::LastDelimiter()
{
wxStringTokenizer tkz(_T("a+-b=c"), _T("+-="));
wxStringTokenizer tkz(wxT("a+-b=c"), wxT("+-="));
tkz.GetNextToken();
CPPUNIT_ASSERT_EQUAL( _T('+'), tkz.GetLastDelimiter() );
CPPUNIT_ASSERT_EQUAL( wxT('+'), tkz.GetLastDelimiter() );
tkz.GetNextToken();
CPPUNIT_ASSERT_EQUAL( _T('-'), tkz.GetLastDelimiter() );
CPPUNIT_ASSERT_EQUAL( wxT('-'), tkz.GetLastDelimiter() );
tkz.GetNextToken();
CPPUNIT_ASSERT_EQUAL( _T('='), tkz.GetLastDelimiter() );
CPPUNIT_ASSERT_EQUAL( wxT('='), tkz.GetLastDelimiter() );
tkz.GetNextToken();
CPPUNIT_ASSERT_EQUAL( _T('\0'), tkz.GetLastDelimiter() );
CPPUNIT_ASSERT_EQUAL( wxT('\0'), tkz.GetLastDelimiter() );
}
void TokenizerTestCase::StrtokCompat()

View File

@@ -62,51 +62,51 @@ void UniCharTestCase::CharCompare()
CPPUNIT_ASSERT( a == a );
CPPUNIT_ASSERT( a == 'a' );
CPPUNIT_ASSERT( a == _T('a') );
CPPUNIT_ASSERT( a == wxT('a') );
CPPUNIT_ASSERT( a == wxUniChar('a') );
CPPUNIT_ASSERT( a == wxUniChar(_T('a')) );
CPPUNIT_ASSERT( a == wxUniChar(wxT('a')) );
CPPUNIT_ASSERT( a != b );
CPPUNIT_ASSERT( a != 'b' );
CPPUNIT_ASSERT( a != _T('b') );
CPPUNIT_ASSERT( a != wxT('b') );
CPPUNIT_ASSERT( a != wxUniChar('b') );
CPPUNIT_ASSERT( a != wxUniChar(_T('b')) );
CPPUNIT_ASSERT( a != wxUniChar(wxT('b')) );
CPPUNIT_ASSERT( a < b );
CPPUNIT_ASSERT( a < 'b' );
CPPUNIT_ASSERT( a < _T('b') );
CPPUNIT_ASSERT( a < wxT('b') );
CPPUNIT_ASSERT( a < wxUniChar('b') );
CPPUNIT_ASSERT( a < wxUniChar(_T('b')) );
CPPUNIT_ASSERT( a < wxUniChar(wxT('b')) );
CPPUNIT_ASSERT( a <= b );
CPPUNIT_ASSERT( a <= 'b' );
CPPUNIT_ASSERT( a <= _T('b') );
CPPUNIT_ASSERT( a <= wxT('b') );
CPPUNIT_ASSERT( a <= wxUniChar('b') );
CPPUNIT_ASSERT( a <= wxUniChar(_T('b')) );
CPPUNIT_ASSERT( a <= wxUniChar(wxT('b')) );
CPPUNIT_ASSERT( a <= a );
CPPUNIT_ASSERT( a <= 'a' );
CPPUNIT_ASSERT( a <= _T('a') );
CPPUNIT_ASSERT( a <= wxT('a') );
CPPUNIT_ASSERT( a <= wxUniChar('a') );
CPPUNIT_ASSERT( a <= wxUniChar(_T('a')) );
CPPUNIT_ASSERT( a <= wxUniChar(wxT('a')) );
CPPUNIT_ASSERT( b > a );
CPPUNIT_ASSERT( b > 'a' );
CPPUNIT_ASSERT( b > _T('a') );
CPPUNIT_ASSERT( b > wxT('a') );
CPPUNIT_ASSERT( b > wxUniChar('a') );
CPPUNIT_ASSERT( b > wxUniChar(_T('a')) );
CPPUNIT_ASSERT( b > wxUniChar(wxT('a')) );
CPPUNIT_ASSERT( b >= a );
CPPUNIT_ASSERT( b >= 'a' );
CPPUNIT_ASSERT( b >= _T('a') );
CPPUNIT_ASSERT( b >= wxT('a') );
CPPUNIT_ASSERT( b >= wxUniChar('a') );
CPPUNIT_ASSERT( b >= wxUniChar(_T('a')) );
CPPUNIT_ASSERT( b >= wxUniChar(wxT('a')) );
CPPUNIT_ASSERT( b >= b );
CPPUNIT_ASSERT( b >= 'b' );
CPPUNIT_ASSERT( b >= _T('b') );
CPPUNIT_ASSERT( b >= wxT('b') );
CPPUNIT_ASSERT( b >= wxUniChar('b') );
CPPUNIT_ASSERT( b >= wxUniChar(_T('b')) );
CPPUNIT_ASSERT( b >= wxUniChar(wxT('b')) );
CPPUNIT_ASSERT( b - a == 1 );
CPPUNIT_ASSERT( a - b == -1 );
@@ -163,7 +163,7 @@ void UniCharTestCase::StringCompare()
wxString sa = "a";
const wxString sb = "b";
char c1 = 'a';
wchar_t c2 = _T('a');
wchar_t c2 = wxT('a');
wxUniChar c3 = 'a';
CPPUNIT_ASSERT( sa == 'a');

View File

@@ -333,7 +333,7 @@ void UnicodeTestCase::ConversionUTF8()
StringConversionData("\xc2", NULL),
};
wxCSConv conv(_T("utf-8"));
wxCSConv conv(wxT("utf-8"));
for ( size_t n = 0; n < WXSIZEOF(utf8data); n++ )
{
const StringConversionData& d = utf8data[n];

View File

@@ -68,33 +68,33 @@ void VarArgTestCase::StringPrintf()
// test passing literals:
s.Printf("%s %i", "foo", 42);
CPPUNIT_ASSERT( s == "foo 42" );
s.Printf("%s %s %i", _T("bar"), "=", 11);
s.Printf("%s %s %i", wxT("bar"), "=", 11);
// test passing c_str():
CPPUNIT_ASSERT( s == "bar = 11" );
s2.Printf("(%s)", s.c_str());
CPPUNIT_ASSERT( s2 == "(bar = 11)" );
s2.Printf(_T("[%s](%s)"), s.c_str(), "str");
s2.Printf(wxT("[%s](%s)"), s.c_str(), "str");
CPPUNIT_ASSERT( s2 == "[bar = 11](str)" );
s2.Printf("%s mailbox", wxString("Opening").c_str());
CPPUNIT_ASSERT( s2 == "Opening mailbox" );
// test passing wxString directly:
s2.Printf(_T("[%s](%s)"), s, "str");
s2.Printf(wxT("[%s](%s)"), s, "str");
CPPUNIT_ASSERT( s2 == "[bar = 11](str)" );
// test passing wxCharBufferType<T>:
s = "FooBar";
s2.Printf(_T("(%s)"), s.mb_str());
s2.Printf(wxT("(%s)"), s.mb_str());
CPPUNIT_ASSERT( s2 == "(FooBar)" );
s2.Printf(_T("value=%s;"), s.wc_str());
s2.Printf(wxT("value=%s;"), s.wc_str());
CPPUNIT_ASSERT( s2 == "value=FooBar;" );
// this tests correct passing of wxCStrData constructed from string
// literal:
bool cond = true;
s2.Printf(_T("foo %s"), !cond ? s.c_str() : _T("bar"));
s2.Printf(wxT("foo %s"), !cond ? s.c_str() : wxT("bar"));
}
void VarArgTestCase::CharPrintf()

View File

@@ -257,7 +257,7 @@ void VsnprintfTestCase::N()
{
int nchar;
wxSnprintf(buf, MAX_TEST_LEN, _T("%d %s%n\n"), 3, _T("bears"), &nchar);
wxSnprintf(buf, MAX_TEST_LEN, wxT("%d %s%n\n"), 3, wxT("bears"), &nchar);
CPPUNIT_ASSERT_EQUAL( 7, nchar );
}
@@ -497,7 +497,7 @@ void VsnprintfTestCase::DoBigToSmallBuffer(T *buffer, int size)
// format and gcc would warn about this otherwise
r = wxUnsafeSnprintf(buffer, size,
_T("unicode string/char: %ls/%lc -- ansi string/char: %hs/%hc"),
wxT("unicode string/char: %ls/%lc -- ansi string/char: %hs/%hc"),
L"unicode", L'U', "ansi", 'A');
wxString expected =
wxString(wxT("unicode string/char: unicode/U -- ansi string/char: ansi/A")).Left(size - 1);
@@ -556,10 +556,10 @@ void VsnprintfTestCase::DoMisc(
// Prepare messages so that it is possible to see from the error which
// test was running.
wxString errStr, overflowStr;
errStr << _T("No.: ") << ++count << _T(", expected: ") << expectedLen
<< _T(" '") << expectedString << _T("', result: ");
overflowStr << errStr << _T("buffer overflow");
errStr << n << _T(" '") << buf << _T("'");
errStr << wxT("No.: ") << ++count << wxT(", expected: ") << expectedLen
<< wxT(" '") << expectedString << wxT("', result: ");
overflowStr << errStr << wxT("buffer overflow");
errStr << n << wxT(" '") << buf << wxT("'");
// turn them into std::strings
std::string errMsg(errStr.mb_str());