Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/test.h>
Public Member Functions | |
TestCase (CString name) | |
void | initialize (void) |
virtual | ~TestCase (void) |
cstring | name (void) |
void | test (CString file, int line, CString text) |
void | failed (void) |
void | succeeded (void) |
void | check (CString file, int line, CString text, bool result) |
bool | require (CString file, int line, CString text, bool result) |
template<class T , class U > | |
void | check_equal (CString file, int line, CString text, const T &result, const U &reference) |
void | prepare (void) |
void | complete (void) |
void | perform (void) |
bool | isSuccessful (void) const |
bool | hasFailed (void) const |
bool | isFullPath () const |
void | setFullPath (bool x) |
Protected Member Functions | |
virtual void | execute (void) |
Protected Attributes | |
TestCase & | __case |
bool | full_path |
This class is used for implementing macro for unit tests.
@seealso TestSet, CHECK, TEST_BEGIN, CHECK_BEGIN
Check if a test has returned true.
file | Source file containing the test. |
line | Line in the source file of the test. |
text | Explanation about the test. |
result | Result of the test. |
References TestCase::failed(), TestCase::succeeded(), and TestCase::test().
Referenced by TestCase::check_equal(), and TestCase::require().
|
inline |
References TestCase::check(), elm::cout, and TestCase::test().
Final display of the test case.
References elm::cout, elm::io::endl, and elm::io::PLAIN.
Referenced by TestCase::perform().
Actual actions of the test.
Referenced by TestCase::perform().
Inform that the current test has failed.
References elm::cout, and elm::io::endl.
Referenced by TestCase::check().
For internal work only. Don't call it.
References TestSet::def.
|
inline |
Test if the source paths are fully displayed. Otherwise, only the name of the source is display.
References TestCase::full_path.
Referenced by TestCase::prepare().
Execute the test case.
References TestCase::complete(), TestCase::execute(), and TestCase::prepare().
Perform the display before the test execution.
References elm::cout, elm::io::endl, and TestCase::name().
Referenced by TestCase::perform().
Same as check but also returns value and specific message for ending the test due to main failure.
file | File containing the test source. |
line | Line where the test is implemented. |
text | Text describing the test. |
result | Result of the test. |
References TestCase::check(), elm::cout, elm::io::endl, and elm::io::PLAIN.
Set the full source option.
x | True to enable full path display. |
References TestCase::full_path.
Inform that the current test has succeeded.
References elm::cout, and elm::io::endl.
Referenced by TestCase::check().
Prepare to do a test.
file | Source file. |
line | Source line. |
text | Code text to test. |
References elm::cout, TestCase::full_path, and Path::namePart().
Referenced by TestCase::check(), and TestCase::check_equal().
|
protected |
|
protected |
Referenced by TestCase::isFullPath(), TestCase::setFullPath(), and TestCase::test().