1//
2// NullStreamTest.cpp
3//
4// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
5// and Contributors.
6//
7// SPDX-License-Identifier: BSL-1.0
8//
9
10
11#include "NullStreamTest.h"
12#include "Poco/CppUnit/TestCaller.h"
13#include "Poco/CppUnit/TestSuite.h"
14#include "Poco/NullStream.h"
15
16
17using Poco::NullInputStream;
18using Poco::NullOutputStream;
19
20
21NullStreamTest::NullStreamTest(const std::string& rName): CppUnit::TestCase(rName)
22{
23}
24
25
26NullStreamTest::~NullStreamTest()
27{
28}
29
30
31void NullStreamTest::testInput()
32{
33 NullInputStream istr;
34 assertTrue (istr.good());
35 assertTrue (!istr.eof());
36 int c = istr.get();
37 assertTrue (c == -1);
38 assertTrue (istr.eof());
39}
40
41
42void NullStreamTest::testOutput()
43{
44 NullOutputStream ostr;
45 assertTrue (ostr.good());
46 ostr << "Hello, world!";
47 assertTrue (ostr.good());
48}
49
50
51void NullStreamTest::setUp()
52{
53}
54
55
56void NullStreamTest::tearDown()
57{
58}
59
60
61CppUnit::Test* NullStreamTest::suite()
62{
63 CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("NullStreamTest");
64
65 CppUnit_addTest(pSuite, NullStreamTest, testInput);
66 CppUnit_addTest(pSuite, NullStreamTest, testOutput);
67
68 return pSuite;
69}
70