added a trivial test for wxString stream insertion operators

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-10-09 00:10:07 +00:00
parent ee8c79c13f
commit 99d8bc6593
8 changed files with 86 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ TEST_OBJECTS = \
test_regextest.o \
test_wxregextest.o \
test_scopeguardtest.o \
test_iostream.o \
test_strings.o \
test_stdstrings.o \
test_tokenizer.o \
@@ -378,6 +379,9 @@ test_wxregextest.o: $(srcdir)/regex/wxregextest.cpp $(TEST_ODEP)
test_scopeguardtest.o: $(srcdir)/scopeguard/scopeguardtest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/scopeguard/scopeguardtest.cpp
test_iostream.o: $(srcdir)/strings/iostream.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/strings/iostream.cpp
test_strings.o: $(srcdir)/strings/strings.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/strings/strings.cpp

View File

@@ -59,6 +59,7 @@ TEST_OBJECTS = \
$(OBJS)\test_regextest.obj \
$(OBJS)\test_wxregextest.obj \
$(OBJS)\test_scopeguardtest.obj \
$(OBJS)\test_iostream.obj \
$(OBJS)\test_strings.obj \
$(OBJS)\test_stdstrings.obj \
$(OBJS)\test_tokenizer.obj \
@@ -406,6 +407,9 @@ $(OBJS)\test_wxregextest.obj: .\regex\wxregextest.cpp
$(OBJS)\test_scopeguardtest.obj: .\scopeguard\scopeguardtest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_iostream.obj: .\strings\iostream.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_strings.obj: .\strings\strings.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**

View File

@@ -51,6 +51,7 @@ TEST_OBJECTS = \
$(OBJS)\test_regextest.o \
$(OBJS)\test_wxregextest.o \
$(OBJS)\test_scopeguardtest.o \
$(OBJS)\test_iostream.o \
$(OBJS)\test_strings.o \
$(OBJS)\test_stdstrings.o \
$(OBJS)\test_tokenizer.o \
@@ -384,6 +385,9 @@ $(OBJS)\test_wxregextest.o: ./regex/wxregextest.cpp
$(OBJS)\test_scopeguardtest.o: ./scopeguard/scopeguardtest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_iostream.o: ./strings/iostream.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_strings.o: ./strings/strings.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -52,6 +52,7 @@ TEST_OBJECTS = \
$(OBJS)\test_regextest.obj \
$(OBJS)\test_wxregextest.obj \
$(OBJS)\test_scopeguardtest.obj \
$(OBJS)\test_iostream.obj \
$(OBJS)\test_strings.obj \
$(OBJS)\test_stdstrings.obj \
$(OBJS)\test_tokenizer.obj \
@@ -491,6 +492,9 @@ $(OBJS)\test_wxregextest.obj: .\regex\wxregextest.cpp
$(OBJS)\test_scopeguardtest.obj: .\scopeguard\scopeguardtest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_iostream.obj: .\strings\iostream.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_strings.obj: .\strings\strings.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**

View File

@@ -256,6 +256,7 @@ TEST_OBJECTS = &
$(OBJS)\test_regextest.obj &
$(OBJS)\test_wxregextest.obj &
$(OBJS)\test_scopeguardtest.obj &
$(OBJS)\test_iostream.obj &
$(OBJS)\test_strings.obj &
$(OBJS)\test_stdstrings.obj &
$(OBJS)\test_tokenizer.obj &
@@ -439,6 +440,9 @@ $(OBJS)\test_wxregextest.obj : .AUTODEPEND .\regex\wxregextest.cpp
$(OBJS)\test_scopeguardtest.obj : .AUTODEPEND .\scopeguard\scopeguardtest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_iostream.obj : .AUTODEPEND .\strings\iostream.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_strings.obj : .AUTODEPEND .\strings\strings.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<

View File

@@ -0,0 +1,61 @@
//////////////////////////////////////////////////////////////////////////////
// Name: tests/strings/iostream.cpp
// Purpose: unit test of wxString interaction with std::[io]stream
// Author: Vadim Zeitlin
// Created: 2007-10-09
// RCS-ID: $Id$
// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/string.h"
#endif // WX_PRECOMP
#include <sstream>
#define ASSERT_OSTREAM_EQUAL(p, s) CPPUNIT_ASSERT_EQUAL(std::string(p), s.str())
#define ASSERT_WOSTREAM_EQUAL(p, s) CPPUNIT_ASSERT_EQUAL(std::wstring(p), s.str())
// ----------------------------------------------------------------------------
// test class
// ----------------------------------------------------------------------------
class StringIostreamTestCase : public CppUnit::TestCase
{
public:
StringIostreamTestCase() { }
private:
CPPUNIT_TEST_SUITE( StringIostreamTestCase );
CPPUNIT_TEST( Out );
CPPUNIT_TEST_SUITE_END();
void Out();
};
CPPUNIT_TEST_SUITE_REGISTRATION( StringIostreamTestCase );
// also include in it's own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( StringIostreamTestCase, "StringIostream" );
void StringIostreamTestCase::Out()
{
std::ostringstream s;
s << wxString("hello");
ASSERT_OSTREAM_EQUAL("hello", s);
std::wostringstream ws;
ws << wxString("bye");
ASSERT_WOSTREAM_EQUAL(L"bye", ws);
}

View File

@@ -45,6 +45,7 @@
regex/regextest.cpp
regex/wxregextest.cpp
scopeguard/scopeguardtest.cpp
strings/iostream.cpp
strings/strings.cpp
strings/stdstrings.cpp
strings/tokenizer.cpp

View File

@@ -521,6 +521,10 @@ SOURCE=.\intl\intltest.cpp
# End Source File
# Begin Source File
SOURCE=.\strings\iostream.cpp
# End Source File
# Begin Source File
SOURCE=.\streams\largefile.cpp
# End Source File
# Begin Source File