Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenostmit_test.cpp
Go to the documentation of this file.
00001 #include <iterator> 00002 #if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS) 00003 #include <string> 00004 #include <sstream> 00005 #include <algorithm> 00006 00007 #include "cppunit/cppunit_proxy.h" 00008 00009 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 00010 using namespace std; 00011 #endif 00012 00013 // 00014 // TestCase class 00015 // 00016 class OstreamIteratorTest : public CPPUNIT_NS::TestCase 00017 { 00018 CPPUNIT_TEST_SUITE(OstreamIteratorTest); 00019 CPPUNIT_TEST(ostmit0); 00020 CPPUNIT_TEST_SUITE_END(); 00021 00022 protected: 00023 void ostmit0(); 00024 }; 00025 00026 CPPUNIT_TEST_SUITE_REGISTRATION(OstreamIteratorTest); 00027 00028 // 00029 // tests implementation 00030 // 00031 void OstreamIteratorTest::ostmit0() 00032 { 00033 // not necessary, tested in copy_test 00034 int array [] = { 1, 5, 2, 4 }; 00035 00036 const char* text = "hello"; 00037 00038 ostringstream os; 00039 00040 ostream_iterator<char> iter(os); 00041 copy(text, text + 5, iter); 00042 CPPUNIT_ASSERT(os.good()); 00043 os << ' '; 00044 CPPUNIT_ASSERT(os.good()); 00045 00046 ostream_iterator<int> iter2(os); 00047 copy(array, array + 4, iter2); 00048 CPPUNIT_ASSERT(os.good()); 00049 CPPUNIT_ASSERT(os.str() == "hello 1524"); 00050 } 00051 00052 #endif Generated on Sun May 27 2012 04:35:39 for ReactOS by
1.7.6.1
|