diff options
author | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2006-12-13 13:52:35 (GMT) |
---|---|---|
committer | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2006-12-13 13:52:35 (GMT) |
commit | cc73abf7e74edf0d6bc12bf6b2ba4e61837c2a73 (patch) | |
tree | 8249c4289c596edf155a3cb6d97d26c4cc948edc /Source/kwsys/testIOS.cxx | |
parent | 7d1801beeea65394795bf4254e678bfc5d5631c2 (diff) | |
download | CMake-cc73abf7e74edf0d6bc12bf6b2ba4e61837c2a73.zip CMake-cc73abf7e74edf0d6bc12bf6b2ba4e61837c2a73.tar.gz CMake-cc73abf7e74edf0d6bc12bf6b2ba4e61837c2a73.tar.bz2 |
ENH: provide stringstream too. FIX: warning shadow var
Diffstat (limited to 'Source/kwsys/testIOS.cxx')
-rw-r--r-- | Source/kwsys/testIOS.cxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/kwsys/testIOS.cxx b/Source/kwsys/testIOS.cxx index d699ae5..b2c7142 100644 --- a/Source/kwsys/testIOS.cxx +++ b/Source/kwsys/testIOS.cxx @@ -13,8 +13,36 @@ int main() { + const char refstring[] = "Hello, World!"; kwsys_ios::ostringstream ostr; - ostr << "Hello, World!"; + ostr << refstring; kwsys_ios::cout << ostr.str() << kwsys_ios::endl; + if( ostr.str() != refstring ) + { + return 1; + } + + + kwsys_ios::istringstream istr; + istr.str( refstring ); + kwsys_ios::cout << istr.str() << kwsys_ios::endl; + if( istr.str() != refstring ) + { + return 1; + } + + + const int val = 12345; + const char valstr[] = "12345"; + kwsys_ios::stringstream sstr; + sstr << val; + int v = 0; + sstr >> v; + if(v != val || sstr.str() != valstr) + { + return 1; + } + kwsys_ios::cout << sstr.str() << kwsys_ios::endl; + return 0; } |