C++ Utilities  4.11.0
Common C++ classes and routines used by my applications such as argument parser, IO and conversion utilities
Public Member Functions | List of all members
TestUtilities::OutputCheck Class Reference

The StandardOutputCheck class asserts whether the (standard) output written in the enclosing code block matches the expected output. More...

#include <outputcheck.h>

Public Member Functions

 OutputCheck (const std::string &expectedOutput, std::ostream &os=std::cout)
 Redirects standard output to an internal buffer. More...
 
 OutputCheck (std::string &&expectedOutput, std::string &&alternativeOutput, std::ostream &os=std::cout)
 Redirects standard output to an internal buffer. More...
 
 OutputCheck (std::function< void(const std::string &output)> &&customCheck, std::ostream &os=std::cout)
 
 ~OutputCheck ()
 Asserts the buffered standard output and restores the regular behaviour of std::cout. More...
 

Detailed Description

The StandardOutputCheck class asserts whether the (standard) output written in the enclosing code block matches the expected output.

Definition at line 19 of file outputcheck.h.

Constructor & Destructor Documentation

◆ OutputCheck() [1/3]

TestUtilities::OutputCheck::OutputCheck ( const std::string &  expectedOutput,
std::ostream &  os = std::cout 
)
inline

Redirects standard output to an internal buffer.

Definition at line 38 of file outputcheck.h.

◆ OutputCheck() [2/3]

TestUtilities::OutputCheck::OutputCheck ( std::string &&  expectedOutput,
std::string &&  alternativeOutput,
std::ostream &  os = std::cout 
)
inline

Redirects standard output to an internal buffer.

Definition at line 49 of file outputcheck.h.

◆ OutputCheck() [3/3]

TestUtilities::OutputCheck::OutputCheck ( std::function< void(const std::string &output)> &&  customCheck,
std::ostream &  os = std::cout 
)

◆ ~OutputCheck()

TestUtilities::OutputCheck::~OutputCheck ( )
inline

Asserts the buffered standard output and restores the regular behaviour of std::cout.

Definition at line 72 of file outputcheck.h.


The documentation for this class was generated from the following file: