X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..2be6500137966bba13903b24204a44804f9e133a:/icuSources/test/intltest/strtest.cpp diff --git a/icuSources/test/intltest/strtest.cpp b/icuSources/test/intltest/strtest.cpp index 9ced1fd5..2081454d 100644 --- a/icuSources/test/intltest/strtest.cpp +++ b/icuSources/test/intltest/strtest.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation and + * Copyright (c) 1997-2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* file name: strtest.cpp @@ -94,7 +94,7 @@ U_STRING_DECL(ustringVar, "aZ0 -", 5); void StringTest::Test_U_STRING() { U_STRING_INIT(ustringVar, "aZ0 -", 5); - if( sizeof(ustringVar)/sizeof(*ustringVar)!=6 || + if( u_strlen(ustringVar)!=5 || ustringVar[0]!=0x61 || ustringVar[1]!=0x5a || ustringVar[2]!=0x30 || @@ -162,8 +162,6 @@ void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, ch TESTCASE_AUTO(Test_UNICODE_STRING_SIMPLE); TESTCASE_AUTO(Test_UTF8_COUNT_TRAIL_BYTES); TESTCASE_AUTO(TestSTLCompatibility); - TESTCASE_AUTO(TestStdNamespaceQualifier); - TESTCASE_AUTO(TestUsingStdNamespace); TESTCASE_AUTO(TestStringPiece); TESTCASE_AUTO(TestStringPieceComparisons); TESTCASE_AUTO(TestByteSink); @@ -173,36 +171,6 @@ void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, ch TESTCASE_AUTO_END; } -// Syntax check for the correct namespace qualifier for the standard string class. -void -StringTest::TestStdNamespaceQualifier() { -#if U_HAVE_STD_STRING - U_STD_NSQ string s="abc xyz"; - U_STD_NSQ string t="abc"; - t.append(" "); - t.append("xyz"); - if(s!=t) { - errln("standard string concatenation error: %s != %s", s.c_str(), t.c_str()); - } -#endif -} - -void -StringTest::TestUsingStdNamespace() { -#if U_HAVE_STD_STRING - // Now test that "using namespace std;" is defined correctly. - U_STD_NS_USE - - string s="abc xyz"; - string t="abc"; - t.append(" "); - t.append("xyz"); - if(s!=t) { - errln("standard string concatenation error: %s != %s", s.c_str(), t.c_str()); - } -#endif -} - void StringTest::TestStringPiece() { // Default constructor. @@ -229,7 +197,7 @@ StringTest::TestStringPiece() { } #if U_HAVE_STD_STRING // Construct from std::string. - U_STD_NSQ string uvwxyz_string("uvwxyz"); + std::string uvwxyz_string("uvwxyz"); StringPiece uvwxyz(uvwxyz_string); if(uvwxyz.empty() || uvwxyz.data()!=uvwxyz_string.data() || uvwxyz.length()!=6 || uvwxyz.size()!=6) { errln("StringPiece(uvwxyz_string) failed"); @@ -481,8 +449,8 @@ StringTest::TestStringByteSink() { #if U_HAVE_STD_STRING // Not much to test because only the constructor and Append() // are implemented, and trivially so. - U_STD_NSQ string result("abc"); // std::string - StringByteSink sink(&result); + std::string result("abc"); // std::string + StringByteSink sink(&result); sink.Append("def", 3); if(result != "abcdef") { errln("StringByteSink did not Append() as expected"); @@ -490,13 +458,13 @@ StringTest::TestStringByteSink() { #endif } -#if defined(U_WINDOWS) && defined(_MSC_VER) +#if defined(_MSC_VER) #include #endif void StringTest::TestSTLCompatibility() { -#if defined(U_WINDOWS) && defined(_MSC_VER) +#if defined(_MSC_VER) /* Just make sure that it compiles with STL's placement new usage. */ std::vector myvect; myvect.push_back(UnicodeString("blah"));