This file is the entry point for the unit test framework. More...
#include "autodetect.h"
#include "datatypes.h"
#include "mezztest.h"
#include <cstdlib>
#include <fstream>
#include <vector>
#include <stdexcept>
Go to the source code of this file.
Classes | |
class | AllUnitTestGroups |
This aggregates the results of all the other test groups. More... | |
Functions | |
void | ClearTempFile () |
Empty the file specified by TempFile. More... | |
void | DeleteTempFile () |
Attempts to delete TempFile. Silently fails if not possible. | |
ProcessDepth | GetCurrentProcessDepth () |
Indicates what this test might attempt to do, based on what it thinks the process depth is. More... | |
Mezzanine::String | GetExecutableName () |
Get the command/executable name used to invoke this at the command prompt. More... | |
int | GetMainArgumentCount () |
Get the argument count as it was passed into Main. More... | |
char ** | GetMainArgumentVector () |
Get the argument vector as it was passed into Main. More... | |
UnitTestGroup | GetResultsFromTempFile () |
This will open then parse the contents of the file specified by TempFile and interpret any test results located. More... | |
Mezzanine::String | GetSubSubProcessArgument () |
If a test needs to pass a string to a subsubprocess it will get stored here. More... | |
void | HandleSingleArgument (Mezzanine::String Arg) |
Handles one argument at a time for main. More... | |
int | main (int argc, char **argv) |
This is the entry point for the unit test executable. More... | |
void | WriteTempFile (const UnitTestGroup &TestsToWrite) |
Write the passed UnitTestGroup to an XML temp file. More... | |
Variables | |
int | ArgC |
ArgC as it was passed into Main. More... | |
char ** | ArgV |
ArgC as it was passed into Main. More... | |
Mezzanine::String | CommandName |
This will store the name of the command that launched this executable at run time. More... | |
ProcessDepth | Depth |
The current process depth as interpretted by Main. More... | |
Mezzanine::String | SubSubProcessArgument |
A string intended for use by any subsubprocess test. More... | |
This file is the entry point for the unit test framework.
If you need to change the nature of the executable this is the file to change. This is where the simple (but robust) sub process mechanism is implemented. Very little of the rest of the code in the unit test frame work makes calls to this file, and everything that does does so through the UnitTestGroup class via polymorphism.
Definition in file mezztest.cpp.
void ClearTempFile | ( | ) |
Empty the file specified by TempFile.
This | can throw any exception that the C++ filestream classes can throw. |
Definition at line 137 of file mezztest.cpp.
ProcessDepth GetCurrentProcessDepth | ( | ) |
Indicates what this test might attempt to do, based on what it thinks the process depth is.
Definition at line 83 of file mezztest.cpp.
Mezzanine::String GetExecutableName | ( | ) |
Get the command/executable name used to invoke this at the command prompt.
Definition at line 77 of file mezztest.cpp.
int GetMainArgumentCount | ( | ) |
Get the argument count as it was passed into Main.
Definition at line 63 of file mezztest.cpp.
char** GetMainArgumentVector | ( | ) |
Get the argument vector as it was passed into Main.
Definition at line 71 of file mezztest.cpp.
UnitTestGroup GetResultsFromTempFile | ( | ) |
This will open then parse the contents of the file specified by TempFile and interpret any test results located.
This | can throw any exception that the C++ filestream classes can throw. |
Definition at line 109 of file mezztest.cpp.
Mezzanine::String GetSubSubProcessArgument | ( | ) |
If a test needs to pass a string to a subsubprocess it will get stored here.
Definition at line 89 of file mezztest.cpp.
void HandleSingleArgument | ( | Mezzanine::String | Arg | ) |
Handles one argument at a time for main.
This should be the only place that configures global state in the test suite everywhere else should access global state through the accessors in mezztest.h
Arg | The argument |
Definition at line 312 of file mezztest.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
This is the entry point for the unit test executable.
This will contruct an AllUnitTestGroups with the listing of unit tests available from autodetect.h. It will then interpret any command line arguments and direct the created AllUnitTestGroups about which tests to run and how to run them. In addition to sending the results to the standard output a copy of the test results will be written to TestResults.txt, if not configure not to.
If no arguments are passed this will add all the tests to the AllUnitTestGroups and execute all tests that are not interactive. Print out a default report of them.
argc | Is interpretted as the amount of passed arguments |
argv | Is interpretted as the arguments passed in from the launching shell. |
Definition at line 332 of file mezztest.cpp.
void WriteTempFile | ( | const UnitTestGroup & | TestsToWrite | ) |
Write the passed UnitTestGroup to an XML temp file.
TestsToWrite | Teh group of tests to write. |
Definition at line 95 of file mezztest.cpp.
int ArgC |
ArgC as it was passed into Main.
This cannot be set statically, it must wait for main(int, char**) to be initialized
Definition at line 62 of file mezztest.cpp.
char** ArgV |
ArgC as it was passed into Main.
This cannot be set statically, it must wait for main(int, char**) to be initialized
Definition at line 70 of file mezztest.cpp.
Mezzanine::String CommandName |
This will store the name of the command that launched this executable at run time.
Definition at line 76 of file mezztest.cpp.
ProcessDepth Depth |
The current process depth as interpretted by Main.
Definition at line 82 of file mezztest.cpp.
Mezzanine::String SubSubProcessArgument |
A string intended for use by any subsubprocess test.
Definition at line 88 of file mezztest.cpp.