mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-07 13:27:13 +01:00
4a6bfc086c
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
75 lines
1.3 KiB
C++
75 lines
1.3 KiB
C++
//
|
|
// TeeStreamTest.cpp
|
|
//
|
|
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#include "TeeStreamTest.h"
|
|
#include "CppUnit/TestCaller.h"
|
|
#include "CppUnit/TestSuite.h"
|
|
#include "Poco/TeeStream.h"
|
|
#include <sstream>
|
|
|
|
|
|
using Poco::TeeInputStream;
|
|
using Poco::TeeOutputStream;
|
|
|
|
|
|
TeeStreamTest::TeeStreamTest(const std::string& name): CppUnit::TestCase(name)
|
|
{
|
|
}
|
|
|
|
|
|
TeeStreamTest::~TeeStreamTest()
|
|
{
|
|
}
|
|
|
|
|
|
void TeeStreamTest::testTeeInputStream()
|
|
{
|
|
std::istringstream istr("foo");
|
|
std::ostringstream ostr;
|
|
TeeInputStream tis(istr);
|
|
tis.addStream(ostr);
|
|
std::string s;
|
|
tis >> s;
|
|
assertTrue (ostr.str() == "foo");
|
|
}
|
|
|
|
|
|
void TeeStreamTest::testTeeOutputStream()
|
|
{
|
|
std::ostringstream ostr1;
|
|
std::ostringstream ostr2;
|
|
TeeOutputStream tos(ostr1);
|
|
tos.addStream(ostr2);
|
|
tos << "bar" << std::flush;
|
|
assertTrue (ostr1.str() == "bar");
|
|
assertTrue (ostr2.str() == "bar");
|
|
}
|
|
|
|
|
|
void TeeStreamTest::setUp()
|
|
{
|
|
}
|
|
|
|
|
|
void TeeStreamTest::tearDown()
|
|
{
|
|
}
|
|
|
|
|
|
CppUnit::Test* TeeStreamTest::suite()
|
|
{
|
|
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("TeeStreamTest");
|
|
|
|
CppUnit_addTest(pSuite, TeeStreamTest, testTeeInputStream);
|
|
CppUnit_addTest(pSuite, TeeStreamTest, testTeeOutputStream);
|
|
|
|
return pSuite;
|
|
}
|