#include <UnitTesting.h>
Public Member Functions | |
UnitTesting (void) | |
virtual | ~UnitTesting (void) |
int | get_tests_count (void) |
int | get_tests_passed_count (void) |
int | get_tests_failed_count (void) |
std::string & | get_message (void) |
bool | get_display (void) |
void | set_tests_count (int) |
void | set_tests_passed_count (int) |
void | set_tests_failed_count (int) |
void | set_message (const std::string &) |
void | set_display (bool) |
void | assert_true (bool, const std::string &) |
void | assert_false (bool, const std::string &) |
virtual void | run_test_case (void)=0 |
void | print_results (void) |
Protected Attributes | |
int | tests_count |
int | tests_passed_count |
int | tests_failed_count |
std::string | message |
bool | display |
Definition at line 29 of file UnitTesting.h.
Flood::UnitTesting::UnitTesting | ( | void | ) | [explicit] |
General constructor. It constructs a test case with default values:
Definition at line 38 of file UnitTesting.cpp.
Flood::UnitTesting::~UnitTesting | ( | void | ) | [virtual] |
void Flood::UnitTesting::assert_false | ( | bool | condition, | |
const std::string & | error_message | |||
) |
This method checks that a condition is false. It increases the number of tests by one. It increases the number of tests passed by one if the condition is false. It increases the number of tests failed by one if the condition is true. It appends to the information message an error message is the condition is not satisfied.
condition | Expression of the condition to be tested. | |
error_message | Error message to be appended to the information message, typically the file name and the line where the condition has been tested. |
Definition at line 243 of file UnitTesting.cpp.
void Flood::UnitTesting::assert_true | ( | bool | condition, | |
const std::string & | error_message | |||
) |
This method checks that a condition is true. It increases the number of tests by one. It increases the number of tests passed by one if the condition is true. It increases the number of tests failed by one if the condition is false. It appends to the information message an error message is the condition is not satisfied.
condition | Expression of the condition to be tested. | |
error_message | Error message to be appended to the information message, typically the file name and the line where the condition has been tested. |
Definition at line 215 of file UnitTesting.cpp.
bool Flood::UnitTesting::get_display | ( | void | ) |
This method returns the display messages to the screen value of this object.
Definition at line 105 of file UnitTesting.cpp.
std::string & Flood::UnitTesting::get_message | ( | void | ) |
This method returns a reference to the test case information message.
Definition at line 95 of file UnitTesting.cpp.
int Flood::UnitTesting::get_tests_count | ( | void | ) |
This method returns the number of tests which have been performed by the test case.
Definition at line 65 of file UnitTesting.cpp.
int Flood::UnitTesting::get_tests_failed_count | ( | void | ) |
This method returns the number of tests which have failed the test case.
Definition at line 85 of file UnitTesting.cpp.
int Flood::UnitTesting::get_tests_passed_count | ( | void | ) |
This method returns the number of tests which have passed the test case.
Definition at line 75 of file UnitTesting.cpp.
void Flood::UnitTesting::print_results | ( | void | ) |
This method prints the test case results to the screen:
Definition at line 271 of file UnitTesting.cpp.
virtual void Flood::UnitTesting::run_test_case | ( | void | ) | [pure virtual] |
This method runs all the methods contained in the test case.
void Flood::UnitTesting::set_display | ( | bool | new_display | ) |
This method sets a new display value to this object.
new_display | Display value. |
Definition at line 198 of file UnitTesting.cpp.
void Flood::UnitTesting::set_message | ( | const std::string & | new_message | ) |
This method sets a new test case information message.
new_message | Information message. |
Definition at line 187 of file UnitTesting.cpp.
void Flood::UnitTesting::set_tests_count | ( | int | new_tests_count | ) |
This method sets a new value for the number of tests performed by the test case.
new_tests_count | Number of tests performed. |
Definition at line 116 of file UnitTesting.cpp.
void Flood::UnitTesting::set_tests_failed_count | ( | int | new_tests_failed_count | ) |
This method sets a new value for the number of tests which have failed the test case.
new_tests_failed_count | Number of tests failed. |
Definition at line 164 of file UnitTesting.cpp.
void Flood::UnitTesting::set_tests_passed_count | ( | int | new_tests_passed_count | ) |
This method sets a new value for the number of tests which have passed the test case.
new_tests_passed_count | Number of tests passed. |
Definition at line 140 of file UnitTesting.cpp.
bool Flood::UnitTesting::display [protected] |
True if messages from this class are to be displayed, false otherwise.
Definition at line 97 of file UnitTesting.h.
std::string Flood::UnitTesting::message [protected] |
int Flood::UnitTesting::tests_count [protected] |
int Flood::UnitTesting::tests_failed_count [protected] |
int Flood::UnitTesting::tests_passed_count [protected] |