1 #include "kwsysPrivate.h"
2 #include KWSYS_HEADER(stl/vector)
3 #include KWSYS_HEADER(ios/sstream)
4 #include KWSYS_HEADER(ios/iostream)
6 // Work-around CMake dependency scanning limitation. This must
7 // duplicate the above list of headers.
9 # include "kwsys_stl_string.hxx.in"
10 # include "kwsys_stl_vector.h.in"
11 # include "kwsys_ios_sstream.h.in"
12 # include "kwsys_ios_iostream.h.in"
15 int testIOS(int, char*[])
17 kwsys_ios::ostringstream ostr
;
19 if(ostr
.str() != "hello")
21 kwsys_ios::cerr
<< "failed to write hello to ostr" << kwsys_ios::endl
;
24 kwsys_ios::istringstream
istr(" 10 20 str ");
31 kwsys_ios::cerr
<< "x != 10" << kwsys_ios::endl
;
37 kwsys_ios::cerr
<< "Failed to read 10 from istr" << kwsys_ios::endl
;
44 kwsys_ios::cerr
<< "x != 20" << kwsys_ios::endl
;
50 kwsys_ios::cerr
<< "Failed to read 20 from istr" << kwsys_ios::endl
;
57 kwsys_ios::cerr
<< "s != \"str\"" << kwsys_ios::endl
;
63 kwsys_ios::cerr
<< "Failed to read str from istr" << kwsys_ios::endl
;
68 kwsys_ios::cerr
<< "Able to read past end of stream" << kwsys_ios::endl
;
74 istr
.clear(istr
.rdstate() & ~kwsys_ios::ios::eofbit
);
75 istr
.clear(istr
.rdstate() & ~kwsys_ios::ios::failbit
);
82 kwsys_ios::cerr
<< "x != 30" << kwsys_ios::endl
;
88 kwsys_ios::cerr
<< "Failed to read 30 from istr" << kwsys_ios::endl
;
92 kwsys_ios::stringstream sstr
;
98 kwsys_ios::cerr
<< "x != 40" << kwsys_ios::endl
;
104 kwsys_ios::cerr
<< "Failed to read 40 from sstr" << kwsys_ios::endl
;
111 kwsys_ios::cerr
<< "s != \"str2\"" << kwsys_ios::endl
;
117 kwsys_ios::cerr
<< "Failed to read str2 from sstr" << kwsys_ios::endl
;
121 kwsys_ios::cout
<< "IOS tests passed" << kwsys_ios::endl
;