From: Christian P. <cp...@us...> - 2004-12-30 17:39:12
|
Update of /cvsroot/pclasses/pclasses2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4875/test Added Files: StringTest.cpp Log Message: Added StringTest.cpp --- NEW FILE: StringTest.cpp --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "Test.h" #include "pclasses/Unicode/String.h" namespace P { class StringTest: public UnitTest { public: void run() throw() { Unicode::String s1(2); //P_TEST(s1.empty()); s1 = L"ba"; print(s1); s1.insert(1, Unicode::Char('-')); print(s1); P_TEST(s1[0] == Unicode::Char('b')); P_TEST(s1[1] == Unicode::Char('-')); P_TEST(s1[2] == Unicode::Char('a')); } void print(const Unicode::String& str) { for(size_t i = 0; i < str.length(); i++) std::cout << str.at(i).latin1(); std::cout << std::endl; } }; } int main(int argc, char* argv[]) { P::StringTest st; st.run(); return 0; } |