2 stupid test program to verify stringlib
7 #include "string-convert.hh"
8 #include "flower-test.hh"
13 cout << "constructors"<<endl;
22 {String fromf (1.32e-2, "%g");
40 String right(path.right_str (1));
41 cout << "cmp ('', '/'): " << String::compare_i (sep,right) << endl;
49 a.sort (String::compare_i);
50 cout << "compares: "<<endl;
51 for (int i=0; i < a.size (); i++)
59 String hay = "foobarbazblub";
64 cout << "hay = \"" << hay << "\" len="<< hay.length_i ()<<endl;
65 cout << "index_i ('"<< c<<"') " << c << "= " << hay.index_i (c) <<endl;
66 cout << "last_index_i ('"<< c<<"') " << c << "= " << hay.index_last_i (c) <<endl;
67 // cout << "last index of cstr " << c << ": " << hay.index_last_i (cstr) <<endl;
68 // cout << "index_last_i (\""<<set<<"\"): " << hay.index_last_i (set) <<endl;
69 cout << "index_i (\""<<set<<"\"): " << hay.index_i (set) <<endl;
70 cout << "index_any (\"" << set << "\"): " << cstr << ": " << hay.index_any_i (cstr) <<endl;
81 for (int i=-1; i < str.length_i ()+2; i++) {
82 cout<<" left_str (" << i<<"): " << str.left_str (i) << endl;
83 cout<<" right_str ("<<i<<"): " << str.right_str (i) << endl;
87 cout << "mid (2,6)="<<str.cut (2,6)<<endl;
88 cout << "nomid (2,6)="<<str.nomid_str (2,6)<<endl;
92 test_empty_b (String str)
94 cout << "`" << str << "' is ";
96 if (str == String ("")) {
97 cout << "empty" << endl;
101 cout << "not empty" << endl;
114 cout << "left" << endl;
118 // str = String ("Hallo") + " daaR" + '!'; // no go on doze-s gcc2.7.2?
119 str = String ("Hallo") + " daaR" + "!";
122 cout << "up: " << str.upper_str () << " down: " << str.lower_str ()<<endl;
124 if (test_empty_b (str))
128 if (!test_empty_b (fn))
134 delete fn.copy_byte_p ();
135 delete str.copy_byte_p ();
137 cout << String_convert::bin2hex_str (String ( (char)0xff)) << endl;
138 cout << "-1:" << String_convert::i2hex_str (-1, 2, '0');
144 ADD_TEST (stringtest);