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

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

Public Member Functions

 StandardOutputCheck (const string &expectedOutput)
 Redirects standard output to an internal buffer. More...
 
 StandardOutputCheck (string &&expectedOutput, string &&alternativeOutput)
 Redirects standard output to an internal buffer. More...
 
 StandardOutputCheck (function< void(const string &output)> &&customCheck)
 
 ~StandardOutputCheck ()
 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.

Remarks
Only works for output printed via std::cout.
Todo:
Could be generalized and moved to testutils.h.

Definition at line 33 of file argumentparsertests.cpp.

Constructor & Destructor Documentation

◆ StandardOutputCheck() [1/3]

StandardOutputCheck::StandardOutputCheck ( const string &  expectedOutput)

Redirects standard output to an internal buffer.

Definition at line 51 of file argumentparsertests.cpp.

◆ StandardOutputCheck() [2/3]

StandardOutputCheck::StandardOutputCheck ( string &&  expectedOutput,
string &&  alternativeOutput 
)

Redirects standard output to an internal buffer.

Definition at line 61 of file argumentparsertests.cpp.

◆ StandardOutputCheck() [3/3]

StandardOutputCheck::StandardOutputCheck ( function< void(const string &output)> &&  customCheck)

◆ ~StandardOutputCheck()

StandardOutputCheck::~StandardOutputCheck ( )

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

Definition at line 82 of file argumentparsertests.cpp.


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