Public Member Functions | |
virtual | ~UnitTesting () |
Destructor. More... | |
Index | get_tests_count () const |
Returns the number of tests which have been performed by the test case. More... | |
Index | get_tests_passed_count () const |
Returns the number of tests which have passed the test case. More... | |
Index | get_tests_failed_count () const |
Returns the number of tests which have failed the test case. More... | |
Index | get_random_tests_number () const |
Returns the number of iterations for loops of random tests. More... | |
const bool & | get_display () const |
Returns the display messages to the screen value of this object. More... | |
void | set_tests_count (const Index &) |
void | set_tests_passed_count (const Index &) |
void | set_tests_failed_count (const Index &) |
void | set_random_tests_number (const Index &) |
void | set_message (const string &) |
void | set_display (const bool &) |
void | assert_true (const bool &, const string &) |
void | assert_false (const bool &, const string &) |
virtual void | run_test_case ()=0 |
This method runs all the methods contained in the test case. | |
void | print_results () |
Protected Attributes | |
Index | tests_count |
Number of performed tests. More... | |
Index | tests_passed_count |
Number of tests which have passed the test case. More... | |
Index | tests_failed_count |
Number of tests which have failed the test case. More... | |
Index | random_tests_number |
Number of iterations in random tests loops. More... | |
bool | display = true |
True if messages from this class are to be displayed, false otherwise. More... | |
const int | n = omp_get_max_threads() |
ThreadPool * | thread_pool = new ThreadPool(n) |
ThreadPoolDevice * | thread_pool_device = new ThreadPoolDevice(thread_pool, n) |
Definition at line 29 of file unit_testing.h.
|
explicit |
Definition at line 11 of file unit_testing.cpp.
|
virtual |
Destructor.
Definition at line 23 of file unit_testing.cpp.
void assert_false | ( | const bool & | condition, |
const string & | error_message | ||
) |
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 148 of file unit_testing.cpp.
void assert_true | ( | const bool & | condition, |
const string & | error_message | ||
) |
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 122 of file unit_testing.cpp.
const bool & get_display | ( | ) | const |
Returns the display messages to the screen value of this object.
Definition at line 62 of file unit_testing.cpp.
Index get_random_tests_number | ( | ) | const |
Returns the number of iterations for loops of random tests.
Definition at line 54 of file unit_testing.cpp.
Index get_tests_count | ( | ) | const |
Returns the number of tests which have been performed by the test case.
Definition at line 30 of file unit_testing.cpp.
Index get_tests_failed_count | ( | ) | const |
Returns the number of tests which have failed the test case.
Definition at line 46 of file unit_testing.cpp.
Index get_tests_passed_count | ( | ) | const |
Returns the number of tests which have passed the test case.
Definition at line 38 of file unit_testing.cpp.
void print_results | ( | ) |
Prints the test case results to the screen:
Definition at line 174 of file unit_testing.cpp.
void set_display | ( | const bool & | new_display | ) |
Sets a new display value to this object.
new_display | Display value. |
Definition at line 107 of file unit_testing.cpp.
void set_random_tests_number | ( | const Index & | new_random_tests_number | ) |
Sets a new value for the number of iterations in loops of random tests.
new_random_tests_number | Number of random tests in each loop. |
Definition at line 98 of file unit_testing.cpp.
void set_tests_count | ( | const Index & | new_tests_count | ) |
Sets a new value for the number of tests performed by the test case.
new_tests_count | Number of tests performed. |
Definition at line 71 of file unit_testing.cpp.
void set_tests_failed_count | ( | const Index & | new_tests_failed_count | ) |
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 89 of file unit_testing.cpp.
void set_tests_passed_count | ( | const Index & | new_tests_passed_count | ) |
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 80 of file unit_testing.cpp.
|
protected |
True if messages from this class are to be displayed, false otherwise.
Definition at line 93 of file unit_testing.h.
|
protected |
Definition at line 95 of file unit_testing.h.
|
protected |
Number of iterations in random tests loops.
Definition at line 89 of file unit_testing.h.
|
protected |
Number of performed tests.
Definition at line 77 of file unit_testing.h.
|
protected |
Number of tests which have failed the test case.
Definition at line 85 of file unit_testing.h.
|
protected |
Number of tests which have passed the test case.
Definition at line 81 of file unit_testing.h.
|
protected |
Definition at line 96 of file unit_testing.h.
|
protected |
Definition at line 97 of file unit_testing.h.