1 ////////////////////////////////////////////////////////////////////////
3 ////////////////////////////////////////////////////////////////////////
5 #include <simgear/compiler.h>
8 #include "tabbed_values.hxx"
15 int main (int ac, char ** av)
17 const char* string1 = "Hello\tWorld\t34\tZ\t\tThere Is No Spoon";
19 SGTabbedValues tv(string1);
21 if (tv[0] != "Hello") {
22 cerr << "failed to read string at index 0" << endl;
26 if (tv[1] != "World") {
27 cerr << "failed to read string at index 1" << endl;
32 cerr << "failed to read string at index 2" << endl;
36 double dval = tv.getDoubleAt(2);
38 cerr << "failed to read double at index 2" << endl;
42 char cval = tv.getCharAt(3);
44 cerr << "failed to read char at index 3" << endl;
48 cval = tv.getCharAt(0);
50 cerr << "failed to read char at index 0" << endl;
54 if (tv.isValueAt(4)) {
55 cerr << "didn't identify skipped value correctly" << endl;
59 if (!tv.isValueAt(3)) {
60 cerr << "didn't identify present value correctly" << endl;
64 if (tv[5] != "There Is No Spoon") {
65 cerr << "failed to read string at index 5 (got [" << tv[5] << "]" << endl;
69 cout << "all tests passed successfully!" << endl;