85 const String& FuncName =
"",
111 typedef std::map<Mezzanine::String, UnitTestGroup*>
CoreTestGroup;
116 int PrintList(CoreTestGroup &TestGroups);
263 virtual void DisplayResults(std::ostream& Output=std::cout, std::ostream& Error=std::cerr,
bool Summary =
true,
bool FullOutput =
true,
bool HeaderOutput =
true);
276 virtual void Test(
bool TestCondition,
280 const String& FuncName =
"",
String LaunchSubProcessTest(const String &Argument=String(""))
Tests should use this to launch things that need sheltering from segfaults and similar faults...
int32_t Int32
An 32-bit integer.
void LaunchAutomaticTest()
This launches all the automated tests on the derived class if the flag is set to run them otherwise i...
virtual void Test(bool TestCondition, const String &TestName, TestResult IfFalse=Testing::Failed, TestResult IfTrue=Testing::Success, const String &FuncName="", const String &File="", Mezzanine::Whole Line=0)
Interpret Boolean value as a test result. Also Prepends the name of the current test, as returned by Name() + "::", to ease test scoping.
std::streambuf * CoutStreamBuf
Used to store the buffer connected to the stdout while it is being redirected.
Enumerations and constant values associated with the Unit tests.
Used to aplly RAII to Stdout and STDERR buffers/streams.
virtual bool HasAutomaticTests() const
Used only to report skipped tests.
std::map< Mezzanine::String, UnitTestGroup * > CoreTestGroup
A group of testnames and the Actual test that implement those test(s).
virtual void ShouldRunAutomaticTests()
Sets a flag that indicatesz that is the process that should run this subprocess.
~OutputCaptureManager()
Restores original output buffers on creation.
This is the default behavior, because it is presumed failures should be visible so they can be fixed...
All the definitions for datatypes as well as some basic conversion functions are defined here...
void CaptureOutputBuffers()
This will direct any output that would have gone to an external process via cout to TestOutput Instea...
void LaunchInteractiveTest()
This launches all the interactice tests on the derived class if the flag is set to run them otherwise...
unsigned int LongestNameLength
Some basic variable for tracking simple statistics.
Mezzanine::String FileName
The File The test happened in.
virtual void RunSubprocessTest(const Mezzanine::String &Arg)
Does nothing by default, tests which need to run code in a subprocess should override this...
Mezzanine::Whole LineNumber
What line in the file this test occurred when the test was compiled.
bool DoSubProcessTest
Set to false if subprocess tests should not be executed. True if they should.
virtual void RunTests()
This will call RunAutomaticTests based on the values passed.
bool DoInteractiveTest
Sets the flag to run interactive tests.
std::streambuf * CerrStreamBuf
Used to store the buffer connected to the stderr while it is being redirected.
bool operator<(const TestData &Rhs) const
Used to sort TestData in std::std and other sorted containers, by TestName.
A single group of tests, suitable for being all the tests of a small subsystem or single class...
int PrintList(CoreTestGroup &TestGroups)
Print all the groups that exist in a given CoreTestGroup.
Int32 Completed
Used while running a test to see if.
OverWriteResults
This is used to control the behavior of the function UnitTestGroup::AddTestResult() ...
The information about a test and how to easily find it in the filesystem.
TestResult Results
How did the test turn out.
virtual void ShouldRunSubProcessTests()
Sets a flag that indicatesz that is the process that should run this subprocess.
std::set< TestData > TestDataStorage
Just a map to store the content of TestData, incidentally it will lexographically sort the list of te...
bool DoAutomaticTest
Set the flag to run automatic tests.
TestResult
Return values from tests.
OutputCaptureManager(UnitTestGroup *RAIITarget)
Captures Output buffers and configures test outputs on creation.
String GetAsXML() const
Get the Whole UnitTestGroup as a valid XML document.
const UnitTestGroup & operator+=(const UnitTestGroup &rhs)
Add all the items in another UnitTestGroup to this one.
void RestoreOutputBuffers()
This will direct any error messages that would have gone to an external process via cerr to TestOutpu...
virtual void ShouldRunInteractiveTests()
Sets a flag that indicatesz that is the process that should run this subprocess.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
virtual bool HasInteractiveTests() const
Used only to report skipped tests.
TestData StringToTestData(Mezzanine::String Line)
Trim the whitespace from a line of text and try to interpret the remains as TestResults and a testnam...
UnitTestGroup()
Default constructor.
virtual Mezzanine::String Name()
Get Name of this UnitTestGroup.
TestData(const String &Name="", TestResult Result=Testing::Success, const String &FuncName="", const String &File="", Mezzanine::Whole Line=0)
Create a TestData.
Test was ran and appeared to work.
virtual void RunAutomaticTests()
This should be overloaded to run all tests that do require not user interaction.
virtual void DisplayResults(std::ostream &Output=std::cout, std::ostream &Error=std::cerr, bool Summary=true, bool FullOutput=true, bool HeaderOutput=true)
Print the results or save them to a file.
std::stringstream TestError
A destination for errors.
Mezzanine::String FunctionName
The function the test was called from.
std::stringstream TestOutput
A destination for all normal ouput in the tests.
String GetAsXML() const
Return a snippet of xml describing this TestData.
std::string String
A datatype used to a series of characters.
void AddTestsFromXML(pugi::xml_node Node)
Create and add all the tests in a given piece of parsed xml.
To allow this test harness to be used without the mezzanine it uses pugixml for xml parsing and this ...
void AddTestResult(TestData CurrentTest, OverWriteResults Behavior=OverWriteIfLessSuccessful)
Its expected that tests will be inserted using this.
Mezzanine::String TestName
The name of a given test.
virtual bool HasSubprocessTest() const
If this returns false then the test suite treats it like any other test, if true then it enables some...
virtual void RunInteractiveTests()
This should be overloaded to run all tests require user interaction.