ReactOS  0.4.14-dev-854-gb9426a3
ostmit_test.cpp
Go to the documentation of this file.
1 #include <iterator>
2 #if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
3 #include <string>
4 #include <sstream>
5 #include <algorithm>
6 
8 
9 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
10 using namespace std;
11 #endif
12 
13 //
14 // TestCase class
15 //
16 class OstreamIteratorTest : public CPPUNIT_NS::TestCase
17 {
19  CPPUNIT_TEST(ostmit0);
21 
22 protected:
23  void ostmit0();
24 };
25 
27 
28 //
29 // tests implementation
30 //
32 {
33  // not necessary, tested in copy_test
34  int array [] = { 1, 5, 2, 4 };
35 
36  const char* text = "hello";
37 
38  ostringstream os;
39 
40  ostream_iterator<char> iter(os);
41  copy(text, text + 5, iter);
42  CPPUNIT_ASSERT(os.good());
43  os << ' ';
44  CPPUNIT_ASSERT(os.good());
45 
46  ostream_iterator<int> iter2(os);
47  copy(array, array + 4, iter2);
48  CPPUNIT_ASSERT(os.good());
49  CPPUNIT_ASSERT(os.str() == "hello 1524");
50 }
51 
52 #endif
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
Definition: _iosfwd.h:127
const WCHAR * text
Definition: package.c:1827
#define CPPUNIT_TEST_SUITE(X)
Definition: cppunit_mini.h:142
#define CPPUNIT_TEST(X)
Definition: cppunit_mini.h:182
Definition: features.h:417
CPPUNIT_TEST_SUITE_REGISTRATION(OstreamIteratorTest)
#define CPPUNIT_TEST_SUITE_END()
Definition: cppunit_mini.h:191
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51