2 stupid test program to verify stringlib
7 #include "string-convert.hh"
8 #include "flower-test.hh"
13 cout << "constructors"<<endl;
19 String fromf(1.32e-2, "%g");
36 a.sort(String::compare_i);
37 cout << "compares: "<<endl;
38 for (int i=0; i < a.size(); i++)
46 String hay = "foobarbazblub";
51 cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
52 cout << "index_i('"<< c<<"') " << c << "= " << hay.index_i(c) <<endl;
53 cout << "last_index_i('"<< c<<"') " << c << "= " << hay.index_last_i(c) <<endl;
54 // cout << "last index of cstr " << c << ": " << hay.index_last_i(cstr) <<endl;
55 // cout << "index_last_i(\""<<set<<"\"): " << hay.index_last_i(set) <<endl;
56 cout << "index_i(\""<<set<<"\"): " << hay.index_i(set) <<endl;
57 cout << "index_any(\"" << set << "\"): " << cstr << ": " << hay.index_any_i(cstr) <<endl;
68 for (int i=-1; i < str.length_i()+2; i++) {
69 cout<<" left_str(" << i<<"): " << str.left_str( i ) << endl;
70 cout<<" right_str( "<<i<<"): " << str.right_str( i ) << endl;
74 cout << "mid(2,6)="<<str.mid_str(2,6)<<endl;
75 cout << "nomid(2,6)="<<str.nomid_str(2,6)<<endl;
79 test_empty_b( String str )
81 cout << "`" << str << "' is ";
83 if ( str == String( "" ) ) {
84 cout << "empty" << endl;
88 cout << "not empty" << endl;
101 cout << "left" << endl;
105 // str = String( "Hallo" ) + " daaR" + '!'; // no go on doze-s gcc2.7.2?
106 str = String( "Hallo" ) + " daaR" + "!";
109 cout << "up: " << str.upper_str() << " down: " << str.lower_str()<<endl;
111 if ( test_empty_b( str ) )
115 if ( !test_empty_b( fn ) )
121 delete fn.copy_byte_p();
122 delete str.copy_byte_p();
124 cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
125 cout << "-1:" << String_convert::i2hex_str( -1, 2, '0' );
131 ADD_TEST(stringtest);