Chaste  Release::2018.1
CommandLineArgumentsMocker Class Reference

#include <CommandLineArgumentsMocker.hpp>

+ Collaboration diagram for CommandLineArgumentsMocker:

Public Member Functions

 CommandLineArgumentsMocker (std::string newArguments)
 
 ~CommandLineArgumentsMocker ()
 

Private Attributes

int mNumArgs
 
char ** mpArgs
 
int * mpNumOldArgs
 
char *** mpOldArgs
 

Detailed Description

This is a little helper wrapper for CommandLineArguments that allows a test to replace ALL of the command line arguments by calling the constructor.

It is useful for allowing more tests on code that reads CommandLineArguments without resorting to acceptance tests of executables.

Definition at line 48 of file CommandLineArgumentsMocker.hpp.

Constructor & Destructor Documentation

CommandLineArgumentsMocker::CommandLineArgumentsMocker ( std::string  newArguments)

Only available constructor. This replaces all of the command line arguments that were being used (but remembers them).

Parameters
newArgumentsa string of command line arguments to put into the singleton CommandLineArguments class.

Definition at line 42 of file CommandLineArgumentsMocker.cpp.

References CommandLineArguments::Instance(), mNumArgs, mpArgs, mpNumOldArgs, mpOldArgs, CommandLineArguments::p_argc, and CommandLineArguments::p_argv.

CommandLineArgumentsMocker::~CommandLineArgumentsMocker ( )

Destructor.

Cleans up memory and restores the original CommandLineArguments.

Definition at line 73 of file CommandLineArgumentsMocker.cpp.

References CommandLineArguments::Instance(), mNumArgs, mpArgs, mpNumOldArgs, mpOldArgs, CommandLineArguments::p_argc, and CommandLineArguments::p_argv.

Member Data Documentation

int CommandLineArgumentsMocker::mNumArgs
private

The new number of arguments

Definition at line 69 of file CommandLineArgumentsMocker.hpp.

Referenced by CommandLineArgumentsMocker(), and ~CommandLineArgumentsMocker().

char** CommandLineArgumentsMocker::mpArgs
private

The new arguments

Definition at line 71 of file CommandLineArgumentsMocker.hpp.

Referenced by CommandLineArgumentsMocker(), and ~CommandLineArgumentsMocker().

int* CommandLineArgumentsMocker::mpNumOldArgs
private

The location of the old number of arguments

Definition at line 74 of file CommandLineArgumentsMocker.hpp.

Referenced by CommandLineArgumentsMocker(), and ~CommandLineArgumentsMocker().

char*** CommandLineArgumentsMocker::mpOldArgs
private

The location of the old arguments

Definition at line 76 of file CommandLineArgumentsMocker.hpp.

Referenced by CommandLineArgumentsMocker(), and ~CommandLineArgumentsMocker().


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