Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
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::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::~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

◆ mNumArgs

int CommandLineArgumentsMocker::mNumArgs
private

The new number of arguments

Definition at line 69 of file CommandLineArgumentsMocker.hpp.

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

◆ mpArgs

char** CommandLineArgumentsMocker::mpArgs
private

The new arguments

Definition at line 71 of file CommandLineArgumentsMocker.hpp.

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

◆ mpNumOldArgs

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().

◆ mpOldArgs

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: