owlps/owlps-positioner/tests/outputterminal_test.hh

42 lines
1.2 KiB
C++

/*
* This file is part of the Owl Positioning System (OwlPS) project.
* It is subject to the copyright notice and license terms in the
* COPYRIGHT.t2t file found in the top-level directory of this
* distribution and at
* https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t
* No part of the OwlPS Project, including this file, may be copied,
* modified, propagated, or distributed except according to the terms
* contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
* distributed along with this file, either separately or by replacing
* this notice by the COPYRIGHT.t2t file's contents.
*/
#include <cxxtest/TestSuite.h>
#include "outputterminal.hh"
#include "result.hh"
#include <sstream>
class OutputTerminal_test: public CxxTest::TestSuite
{
public:
void test_output(void)
{
std::ostringstream output_stream ;
OutputTerminal output(output_stream) ;
Result result ;
TS_ASSERT(output_stream.str().empty()) ;
output.write(result) ;
TS_ASSERT(! output_stream.str().empty()) ;
std::ostringstream result_stream ;
result_stream << result << '\n' ;
TS_ASSERT_EQUALS(output_stream.str(), result_stream.str()) ;
}
} ;