TestData, TestDataStorage and UnitTestGroup class definitions. More...
Go to the source code of this file.
Classes | |
class | Mezzanine::Testing::TimedTest |
An easy way to get the time something took to execute. More... | |
Namespaces | |
Mezzanine | |
The bulk of the engine components go in this namspace. | |
Mezzanine::Testing | |
This contains all the items (except the tests themselves) that make the unit tests work. | |
Macros | |
#define | TEST(Cond, Name) Test( (Cond), (Name), Testing::Failed, Testing::Success, __func__, __FILE__, __LINE__ ); |
The easiest way to add a test to the currently running UnitTestGroup. This captures test location meta data and should be considered the default way to record tests. More... | |
#define | TEST_EQUAL_EPSILON(LeftValue, RightValue, Name) Test( CompareEqualityWithEpsilon(LeftValue, RightValue), (Name), Testing::Failed, Testing::Success, __func__, __FILE__, __LINE__ ); |
Compare types that might. More... | |
#define | TEST_EQUAL_MULTI_EPSILON(LeftValue, RightValue, Name, EpsilonFactor) Test( CompareEqualityWithEpsilon(LeftValue, RightValue, EpsilonFactor), (Name), Testing::Failed, Testing::Success, __func__, __FILE__, __LINE__ ); |
#define | TEST_NO_THROW(CodeThatMightThrow, Name) |
#define | TEST_RESULT(ExistingResult, Name) AddTestResult( TestData( (Name), (ExistingResult), __func__, __FILE__, __LINE__)) ; |
An easy way to add a test and associated data to the currently running UnitTestGroup This captures test location meta data and should be considered a good way to record tests that do not easily break down to a single conditional. More... | |
#define | TEST_THROW(ExpectThrown, CodeThatThrows, Name) |
An easy way to add a test whether or not a function/code snippet throws exceptions (or whatever) the way planned. More... | |
#define | TEST_TIMED(CodeToTime, ExpectedTime, Variance, Name) |
An easy way to add a test whether or not a function/code snippet takes the expected amount of time. More... | |
#define | TEST_WARN(Cond, Name) Test( (Cond), (Name), Testing::Warning, Testing::Success, __func__, __FILE__, __LINE__ ); |
Just like TEST but if the test fails only a warning is added. This captures test location meta data and should be considered the default way to record tests that warn instead of fail. More... | |
Functions | |
template<typename T > | |
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. More... | |
MaxInt | Mezzanine::Testing::Now () |
Get a timestamp, in microseconds. This will generally be some multiple of the GetTimeStampResolution return value. More... | |
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. More... | |
TestData, TestDataStorage and UnitTestGroup class definitions.
Definition in file testdatatools.h.
#define TEST | ( | Cond, | |
Name | |||
) | Test( (Cond), (Name), Testing::Failed, Testing::Success, __func__, __FILE__, __LINE__ ); |
The easiest way to add a test to the currently running UnitTestGroup. This captures test location meta data and should be considered the default way to record tests.
Cond | A boolean operand of some kind |
Name | The name of the current test |
Definition at line 67 of file testdatatools.h.
#define TEST_EQUAL_EPSILON | ( | LeftValue, | |
RightValue, | |||
Name | |||
) | Test( CompareEqualityWithEpsilon(LeftValue, RightValue), (Name), Testing::Failed, Testing::Success, __func__, __FILE__, __LINE__ ); |
Compare types that might.
LeftValue | One value to compare |
RightValue | One value to compare |
Name | The name of the current test |
Definition at line 97 of file testdatatools.h.
#define TEST_EQUAL_MULTI_EPSILON | ( | LeftValue, | |
RightValue, | |||
Name, | |||
EpsilonFactor | |||
) | Test( CompareEqualityWithEpsilon(LeftValue, RightValue, EpsilonFactor), (Name), Testing::Failed, Testing::Success, __func__, __FILE__, __LINE__ ); |
This is only rarely required. TEST_EQUAL_EPSILON should be prefferred as this can spuriously pass.
LeftValue | One value to compare |
RightValue | One value to compare |
EpsilonFactor | How many times rounding could occur that could round to the epsilon, so that it can be accounted for? |
Name | The name of the current test |
Definition at line 111 of file testdatatools.h.
#define TEST_NO_THROW | ( | CodeThatMightThrow, | |
Name | |||
) |
Definition at line 195 of file testdatatools.h.
#define TEST_RESULT | ( | ExistingResult, | |
Name | |||
) | AddTestResult( TestData( (Name), (ExistingResult), __func__, __FILE__, __LINE__)) ; |
An easy way to add a test and associated data to the currently running UnitTestGroup This captures test location meta data and should be considered a good way to record tests that do not easily break down to a single conditional.
ExistingResult | A TestResult To be added directy |
Name | The name of the current test |
Definition at line 141 of file testdatatools.h.
#define TEST_THROW | ( | ExpectThrown, | |
CodeThatThrows, | |||
Name | |||
) |
An easy way to add a test whether or not a function/code snippet throws exceptions (or whatever) the way planned.
This captures test location meta data and should be considered the default way to capture exception tests.
ExpectThrown | The type of the thing that should be thrown |
CodeThatThrows | A snippet of code that throws an exception |
Name | The name of the current test |
This captures test location meta data and should be considered the default way to capture exception tests
CodeThatMightThrow | The type of the thing that should be thrown |
Name | The name of the current test |
#define TEST_TIMED | ( | CodeToTime, | |
ExpectedTime, | |||
Variance, | |||
Name | |||
) |
An easy way to add a test whether or not a function/code snippet takes the expected amount of time.
This starts a timer just before the CodeToTime is execute and stops that time right after it finishes
CodeToTime | The code to time |
ExpectedTime | The Expected amount if time in microseconds. |
Variance | A fraction 0.00 of how far off, long or short, the execution time can be and still pass. For example .02 is 2% |
Name | The name of the current test |
Definition at line 256 of file testdatatools.h.
#define TEST_WARN | ( | Cond, | |
Name | |||
) | Test( (Cond), (Name), Testing::Warning, Testing::Success, __func__, __FILE__, __LINE__ ); |
Just like TEST but if the test fails only a warning is added. This captures test location meta data and should be considered the default way to record tests that warn instead of fail.
Cond | A boolean operand of some kind |
Name | The name of the current test |
Definition at line 126 of file testdatatools.h.