00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <iostream>
00026 #include <string>
00027 #include <strstream>
00028 using namespace std;
00029
00030 #include "io.h"
00031
00032 int main( int argc, char** argv ) {
00033
00034 string expected;
00035 string returned;
00036
00037 {
00038
00039 strstream strstr;
00040 strstr << " now, is, the, time ";
00041 expected = " now, is, the, time ";
00042 suplib::getrecord( strstr, returned, suplib::READ_PHYS );
00043 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00044 }
00045
00046 {
00047
00048 strstream strstr;
00049 strstr << " now, is, the, time \n";
00050 expected = " now, is, the, time";
00051 suplib::getrecord( strstr, returned, suplib::READ_PHYS | suplib::STRIP );
00052 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00053 }
00054
00055 {
00056
00057 strstream strstr;
00058 strstr << " now, is, the, time \\ \n"
00059 << " now, is, the, time \\ \n"
00060 << " now, is, the, time ";
00061 expected = " now, is, the, time ";
00062 expected += " now, is, the, time ";
00063 expected += " now, is, the, time ";
00064 suplib::getrecord( strstr, returned, suplib::READ_LOGICAL );
00065 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00066 }
00067
00068 {
00069
00070 strstream strstr;
00071 strstr << " now, is, the, time \\ \n"
00072 << " now, is, the, time \\ \n"
00073 << " now, is, the, time ";
00074 expected = " now, is, the, time \\\n";
00075 expected += " now, is, the, time \\\n";
00076 expected += " now, is, the, time ";
00077 suplib::getrecord( strstr, returned, suplib::READ_LOGICAL | suplib::CLEAN );
00078 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00079 }
00080
00081 {
00082
00083 strstream strstr;
00084 strstr << " now, is, the, time \n";
00085 expected = " now, is, the, time";
00086 suplib::getrecord( strstr, returned, suplib::READ_LOGICAL | suplib::STRIP );
00087 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00088 }
00089
00090 {
00091
00092 strstream strstr;
00093 strstr << " now, is, the, time \\ \n"
00094 << " now, is, the, time \\ \n"
00095 << " now, is, the, time ";
00096 expected = " now, is, the, time ";
00097 expected += " now, is, the, time ";
00098 expected += " now, is, the, time";
00099 suplib::getrecord( strstr, returned, suplib::READ_LOGICAL | suplib::STRIP);
00100 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00101 }
00102
00103 {
00104
00105 strstream strstr;
00106 strstr << " now, is, the, time \\ \n"
00107 << " now, is, the, time \\ \n"
00108 << " now, is, the, time ";
00109 expected = " now, is, the, time \\\n";
00110 expected += " now, is, the, time \\\n";
00111 expected += " now, is, the, time";
00112 suplib::getrecord( strstr, returned, suplib::READ_LOGICAL | suplib::STRIP | suplib::CLEAN );
00113 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00114 }
00115
00116 {
00117
00118 strstream strstr;
00119 strstr << " now, is, the, time - \n"
00120 << " now, is, the, time - \n"
00121 << " now, is, the, time ";
00122 expected = " now, is, the, time ";
00123 expected += " now, is, the, time ";
00124 expected += " now, is, the, time ";
00125 suplib::getrecord( strstr, returned, suplib::READ_LOGICAL, '\n', '-' );
00126 cout << ( returned == expected ? "OK" : "NOT OK" ) << endl;
00127 }
00128
00129 return 0;
00130 }