This contains all the items (except the tests themselves) that make the unit tests work. More...
Classes | |
class | OutputCaptureManager |
Used to aplly RAII to Stdout and STDERR buffers/streams. More... | |
struct | TestData |
The information about a test and how to easily find it in the filesystem. More... | |
class | TimedTest |
An easy way to get the time something took to execute. More... | |
class | UnitTestGroup |
A single group of tests, suitable for being all the tests of a small subsystem or single class. More... | |
Typedefs | |
typedef std::map< Mezzanine::String, UnitTestGroup * > | CoreTestGroup |
A group of testnames and the Actual test that implement those test(s). | |
typedef std::set< TestData > | TestDataStorage |
Just a map to store the content of TestData, incidentally it will lexographically sort the list of tests. | |
Enumerations | |
enum | ExitCodes { ExitSuccess = 0, ExitInvalidArguments = 1, ExitFailure = 2 } |
Possible ways to exit the UnitTestGroup Program. More... | |
enum | OverWriteResults { OverWriteIfLessSuccessful, OverWriteIfMoreSuccessful, OverWrite, DoNotOverWrite } |
This is used to control the behavior of the function UnitTestGroup::AddTestResult() More... | |
enum | TestResult { Success = 0, Warning = 1, Skipped = 2, Cancelled = 3, Inconclusive = 4, Failed = 5, Unknown = 6, NotApplicable = 7 } |
Return values from tests. More... | |
Functions | |
char * | AllLower (char *StringToConvert) |
Makes a c style stron all lowercase with respect to the current locale. More... | |
String | AllLower (String StringToConvert) |
Mezzanine::String | BoolToString (bool i) |
Get a String Corresponding to a passed bool. More... | |
const Mezzanine::String | CancelledString ("Cancelled") |
Corresponds to TestResult::Cancelled. | |
template<typename T > | |
bool | CompareEqualityWithEpsilon (const T &Left, const T &Right, size_t EpsilonFactor=1) |
Calculate if an assumption is close enough to be considered equal. More... | |
const Mezzanine::String | FailedString ("Failed") |
Corresponds to TestResult::Failed. | |
String | GetCommandResults (String Command) |
Execute a command in a process, piping its standard output to a file. More... | |
TestResult | GetTestAnswerFromStdin (Mezzanine::String Question, Boole FailStatusOnIncorrect=true) |
Asked the user a question on the std output and get a TestResult as an answer. More... | |
const Mezzanine::String | InconclusiveString ("Inconclusive") |
Corresponds to TestResult::Inconclusive. | |
String | MakePadding (Mezzanine::String Leader, unsigned int Column) |
Creates some blank spaces, useful for controlling the vertical location of console text. More... | |
const Mezzanine::String | NotApplicableString ("NotApplicable") |
Corresponds to TestResult::NotApplicable. | |
MaxInt | Now () |
Get a timestamp, in microseconds. This will generally be some multiple of the GetTimeStampResolution return value. More... | |
Whole | NowResolution () |
Get the resolution of the timestamp in microseconds. This is the smallest amount of time that the GetTimeStamp can accurately track. More... | |
int | PrintList (CoreTestGroup &TestGroups) |
Print all the groups that exist in a given CoreTestGroup. More... | |
String | rtrim (const Mezzanine::String &t) |
Take the whitespace off the end of a String. More... | |
const Mezzanine::String | SkippedString ("Skipped") |
Corresponds to TestResult::Skipped. | |
void | sleep_for (UInt32 MicroSeconds) |
Sleeps the current thread for an amount of microseconds. More... | |
TestData | StringToTestData (Mezzanine::String Line) |
Trim the whitespace from a line of text and try to interpret the remains as TestResults and a testname. More... | |
TestResult | StringToTestResult (Mezzanine::String Text) |
Roughly convert a String to a TestResult. More... | |
const Mezzanine::String | SuccessString ("Success") |
Corresponds to TestResult::Success. | |
Mezzanine::String | TestResultToString (TestResult Convertable) |
This converts A test result enum value into a String matching the identifier name. More... | |
const Mezzanine::String | UnknownString ("Unknown") |
Corresponds to TestResult::Unknown. | |
int | Usage (Mezzanine::String ThisName, CoreTestGroup &TestGroups) |
Print a message for the user onf the standard output that briefly describes hwo to use this. More... | |
const Mezzanine::String | WarningString ("Warning") |
Corresponds to TestResult::Warning. | |
This contains all the items (except the tests themselves) that make the unit tests work.
Possible ways to exit the UnitTestGroup Program.
Definition at line 53 of file testenumerations.h.
This is used to control the behavior of the function UnitTestGroup::AddTestResult()
This can optionally be passedto prioritize whether newer vs older or successful vs failing results are more important
Definition at line 107 of file testenumerations.h.
Return values from tests.
These are loosely order from best to worse, in terms of what we want to see from our tests. This takes the midset that knowing about a failure is better than not knowing about it.
Definition at line 64 of file testenumerations.h.
char * Mezzanine::Testing::AllLower | ( | char * | StringToConvert | ) |
Makes a c style stron all lowercase with respect to the current locale.
StringToConvert | This string is actually changed. |
Definition at line 78 of file consolestringmanipulation.cpp.
Mezzanine::String Mezzanine::Testing::BoolToString | ( | bool | i | ) |
Get a String Corresponding to a passed bool.
i | A bool |
Definition at line 98 of file consolestringmanipulation.cpp.
bool Mezzanine::Testing::CompareEqualityWithEpsilon | ( | const T & | Left, |
const T & | Right, | ||
size_t | EpsilonFactor = 1 |
||
) |
Calculate if an assumption is close enough to be considered equal.
this uses std::numeric_limits<T>::epsilon() to get the amount of round that is acceptable. This all the Epsilon to be included multiple times if required generally once is the right amount to include. However, sometimes an operation can cause rounding multiple times, if this is case, then an EpsilonFactor can be passed and set to the number of times rounding can be expected.
Left | One value to check for equality. |
Right | The other value to check. |
EpsilonFactor | How many times should the epsilon be included. |
Definition at line 80 of file testdatatools.h.
Execute a command in a process, piping its standard output to a file.
Definition at line 173 of file consolelogic.cpp.
TestResult Mezzanine::Testing::GetTestAnswerFromStdin | ( | Mezzanine::String | Question, |
Boole | FailStatusOnIncorrect = true |
||
) |
Asked the user a question on the std output and get a TestResult as an answer.
Question | The question to ask the user. |
FailStatusOnIncorrect | Defaults to true,FailStatusOnIncorrect if true False answers with return Fail Status otherwise they will return Warnings. |
The following strings provide the following results.
Definition at line 135 of file consolelogic.cpp.
Mezzanine::String Mezzanine::Testing::MakePadding | ( | Mezzanine::String | Leader, |
unsigned int | Column | ||
) |
Creates some blank spaces, useful for controlling the vertical location of console text.
Leader | The string on the beginning of the line. |
Column | The desired column that the padding should lead toward |
Definition at line 70 of file consolestringmanipulation.cpp.
MaxInt Mezzanine::Testing::Now | ( | ) |
Get a timestamp, in microseconds. This will generally be some multiple of the GetTimeStampResolution return value.
Definition at line 99 of file testdatatools.cpp.
Whole Mezzanine::Testing::NowResolution | ( | ) |
Get the resolution of the timestamp in microseconds. This is the smallest amount of time that the GetTimeStamp can accurately track.
Definition at line 106 of file testdatatools.cpp.
int Mezzanine::Testing::PrintList | ( | CoreTestGroup & | TestGroups | ) |
Print all the groups that exist in a given CoreTestGroup.
TestGroups | The group whose constents names with be printed |
Definition at line 93 of file testdata.cpp.
Mezzanine::String Mezzanine::Testing::rtrim | ( | const Mezzanine::String & | t | ) |
Take the whitespace off the end of a String.
t | The Text to clean up. |
If | " asdf " is passed " asdf" is returned. Also removes carriage returns, newlines and tabs. Does not use the locale. |
Definition at line 56 of file consolestringmanipulation.cpp.
void Mezzanine::Testing::sleep_for | ( | UInt32 | MicroSeconds | ) |
Sleeps the current thread for an amount of microseconds.
Blocks the calling thread for a period of time.
MicroSeconds | the amount of micro seconds. |
Definition at line 181 of file consolelogic.cpp.
TestData Mezzanine::Testing::StringToTestData | ( | Mezzanine::String | Line | ) |
Trim the whitespace from a line of text and try to interpret the remains as TestResults and a testname.
Line | A line of Test that starts with whitespace, then a TestResult String, then has a whitesapce delimiter and a ends with the name of test. |
Definition at line 100 of file testdata.cpp.
TestResult Mezzanine::Testing::StringToTestResult | ( | Mezzanine::String | Text | ) |
Roughly convert a String to a TestResult.
Text | If this matches a word like "Success", "Skipped", "Cancelled", "Inconclusive", "Failed", "Unknown" or "N/A" exactly as returned by TestResultToString then a valid result can be returned. |
If | the string passed in does not match a valid TestResult then this will throw a PARAMETERS_EXCEPTION |
Definition at line 81 of file testenumerations.cpp.
Mezzanine::String Mezzanine::Testing::TestResultToString | ( | TestResult | Convertable | ) |
This converts A test result enum value into a String matching the identifier name.
Convertable | A TestResult inclusively between Success and NotApplicable. |
If | an int not in the valid range of TestResult is passed in then this will throw a PARAMETERS_EXCEPTION |
Definition at line 56 of file testenumerations.cpp.
int Mezzanine::Testing::Usage | ( | Mezzanine::String | ThisName, |
CoreTestGroup & | TestGroups | ||
) |
Print a message for the user onf the standard output that briefly describes hwo to use this.
ThisName | The name of the current executable |
TestGroups | This is searched for the current list of valid test names. |
Definition at line 74 of file consolelogic.cpp.