44static void binary_read_test();
51 for (tokens=0; !
ts.eof(); tokens++)
68 s =
"This is a test.";
69 cout <<
"Test 1: " << quote_string(s) <<
endl;
74 s =
"This (is) a test.";
75 cout <<
"Test 2: " << quote_string(s) <<
endl;
80 s =
"This (is) a test.";
81 cout <<
"Test 3: " << quote_string(s) <<
endl;
82 ts.open_string(
"This (is) a test.");
83 ts.set_PrePunctuationSymbols(
"({[");
84 ts.set_PunctuationSymbols(EST_Token_Default_PunctuationSymbols);
88 s =
"This (is) a test.";
89 cout <<
"Test 4: " << quote_string(s) <<
endl;
91 ts.set_SingleCharSymbols(
"()");
92 ts.set_PunctuationSymbols(EST_Token_Default_PunctuationSymbols);
96 s =
"This \"is a\" te\\\"st.";
97 cout <<
"Test 5: " << quote_string(s) <<
endl;
99 ts.set_PrePunctuationSymbols(EST_Token_Default_PrePunctuationSymbols);
100 ts.set_PunctuationSymbols(EST_Token_Default_PunctuationSymbols);
104 s =
"This \"is a\" te\\\"st.";
105 cout <<
"Test 6: " << quote_string(s) <<
endl;
107 ts.set_quotes(
'"',
'\\');
113 cout <<
"Test 7: " << quote_string(s) <<
endl;
115 ts.set_quotes(
'"',
'\\');
138 if ((fd=
fopen(filename,
"w")) == NULL)
140 cerr <<
"Token_regression: failed to open " << filename <<
endl;
151static void binary_read_test()
163 tokbinbuf = make_tokbins(
"tmp/tokbin.dat");
167 cout <<
"Reading tokens and binary from string\n";
173 if (
ts.get() !=
"BINARY")
175 cout <<
"failed to read binary data, missing BINARY token." <<
endl;
178 ts.fread(b,
sizeof(
int),2);
185 cout <<
"Reading tokens and binary from file\n";
187 ts.open(
"tmp/tokbin.dat");
191 if (
ts.get() !=
"BINARY")
193 cout <<
"failed to read binary data, missing BINARY token." <<
endl;
196 ts.fread(b,
sizeof(
int),2);