]> git.saurik.com Git - wxWidgets.git/blame_incremental - tests/strings/iostream.cpp
Query value from the model column given by col->GetModelColumn()
[wxWidgets.git] / tests / strings / iostream.cpp
... / ...
CommitLineData
1//////////////////////////////////////////////////////////////////////////////
2// Name: tests/strings/iostream.cpp
3// Purpose: unit test of wxString interaction with std::[io]stream
4// Author: Vadim Zeitlin
5// Created: 2007-10-09
6// RCS-ID: $Id$
7// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
8///////////////////////////////////////////////////////////////////////////////
9
10// ----------------------------------------------------------------------------
11// headers
12// ----------------------------------------------------------------------------
13
14#include "testprec.h"
15
16#ifdef __BORLANDC__
17 #pragma hdrstop
18#endif
19
20#ifndef WX_PRECOMP
21 #include "wx/string.h"
22#endif // WX_PRECOMP
23
24#include <sstream>
25
26#define ASSERT_OSTREAM_EQUAL(p, s) CPPUNIT_ASSERT_EQUAL(std::string(p), s.str())
27#define ASSERT_WOSTREAM_EQUAL(p, s) CPPUNIT_ASSERT_EQUAL(std::wstring(p), s.str())
28
29// ----------------------------------------------------------------------------
30// test class
31// ----------------------------------------------------------------------------
32
33class StringIostreamTestCase : public CppUnit::TestCase
34{
35public:
36 StringIostreamTestCase() { }
37
38private:
39 CPPUNIT_TEST_SUITE( StringIostreamTestCase );
40 CPPUNIT_TEST( Out );
41 CPPUNIT_TEST_SUITE_END();
42
43 void Out();
44};
45
46CPPUNIT_TEST_SUITE_REGISTRATION( StringIostreamTestCase );
47
48// also include in it's own registry so that these tests can be run alone
49CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( StringIostreamTestCase, "StringIostream" );
50
51void StringIostreamTestCase::Out()
52{
53 std::ostringstream s;
54 s << wxString("hello");
55 ASSERT_OSTREAM_EQUAL("hello", s);
56
57#ifndef __MINGW32__
58 std::wostringstream ws;
59 ws << wxString("bye");
60 ASSERT_WOSTREAM_EQUAL(L"bye", ws);
61#endif
62}
63