Gromacs  2016.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::test::InteractiveTestHelper Class Reference

#include <testutils/interactivetest.h>

Description

Helper class for testing interactive sessions.

The calling test can set the user input using setInputLines() (and possibly setLastNewline()), pass the streams from inputStream() and outputStream() to the code that executes the interactive session, and then call checkSession() after the session is finished. The input is provided from the array set with setInputLines(), and all output is checked using the reference data framework. The reference XML data can be viewed with the XSLT stylesheet to show exactly how the session went.

Public Member Functions

 InteractiveTestHelper (gmx::test::TestReferenceChecker checker)
 Initializes the helper. More...
 
void setLastNewline (bool bInclude)
 Sets whether the last input line contains a newline (by default, it does).
 
void setInputLines (const ConstArrayRef< const char * > &inputLines)
 Sets the input lines for the interactive session. More...
 
TextInputStreaminputStream ()
 Returns the input stream for the session.
 
TextOutputStreamoutputStream ()
 Returns the output stream for the session.
 
void checkSession ()
 Finalizes the checking for the session. More...
 

Constructor & Destructor Documentation

gmx::test::InteractiveTestHelper::InteractiveTestHelper ( gmx::test::TestReferenceChecker  checker)
explicit

Initializes the helper.

Parameters
[in]checkerParent reference checker to use.

The helper creates a compound item under checker for the interactive session it tests.

Member Function Documentation

void gmx::test::InteractiveTestHelper::checkSession ( )

Finalizes the checking for the session.

This must be called after all input and output from a session has occurred, as the helper will not otherwise know when output after the last input has finished. This method also checks that the required number of input lines were read in the session.

void gmx::test::InteractiveTestHelper::setInputLines ( const ConstArrayRef< const char * > &  inputLines)

Sets the input lines for the interactive session.

Calls to TextInputStream::readLine() will return strings from this array in sequence. Newlines are added at the end automatically (except for the last line if setLastNewLine(false) has been called). If there are more readLine() calls than there are input lines, the remaining calls return end-of-input.


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