From: Christian P. <cp...@us...> - 2005-05-20 14:23:40
|
Update of /cvsroot/pclasses/pclasses2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9621/test Modified Files: StringTest.cpp Log Message: - Started StringTest Index: StringTest.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/test/StringTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- StringTest.cpp 30 Dec 2004 17:39:01 -0000 1.1 +++ StringTest.cpp 20 May 2005 14:23:25 -0000 1.2 @@ -20,33 +20,35 @@ #include "Test.h" #include "pclasses/Unicode/String.h" +#include <string> namespace P { +using namespace Unicode; + class StringTest: public UnitTest { public: void run() throw() { - Unicode::String s1(2); + std::string s2 = "blablasuelz"; + String s1 = s2; + //P_TEST(s1.empty()); - s1 = L"ba"; - print(s1); - - s1.insert(1, Unicode::Char('-')); - print(s1); + P_TEST(s2.size() == s1.size()); + P_TEST(s2.find("bla") == s1.find("bla")); + P_TEST(s2.find_first_of("bla") == s1.find_first_of("bla")); + P_TEST(s2.rfind("bla") == s1.rfind("bla")); + P_TEST(s2.find_last_of("bla") == s1.find_last_of("bla")); - P_TEST(s1[0] == Unicode::Char('b')); - P_TEST(s1[1] == Unicode::Char('-')); - P_TEST(s1[2] == Unicode::Char('a')); + std::cout << s2.find_last_of("bla") << std::endl; + + print(s1); } - void print(const Unicode::String& str) + void print(const String& str) { - for(size_t i = 0; i < str.length(); i++) - std::cout << str.at(i).latin1(); - - std::cout << std::endl; + std::cout << str << std::endl; } }; |