|
feisty meow concerns codebase 2.140
|
#include <unit_base.h>
Inherits basis::nameable.
Inherited by application_example [virtual], application_example [virtual], cromp_client_tester [virtual], cromp_decoder [virtual], cromp_server_tester [virtual], many_cromp_tester [virtual], t_amorph [virtual], test_address [virtual], test_angle [virtual], test_array, test_bcast_spocket [virtual], test_bin [virtual], test_bit_vector [virtual], test_blowfish [virtual], test_boilerplate [virtual], test_break_signal [virtual], test_byte_filer [virtual], test_byte_format [virtual], test_callstack_tracker [virtual], test_ccri_angle_average [virtual], test_chaos [virtual], test_command_line [virtual], test_directory [virtual], test_directory_tree [virtual], test_double_plus [virtual], test_doubly_linked_list [virtual], test_earth_time [virtual], test_ellipse [virtual], test_entity [virtual], test_enum_adapaters [virtual], test_fcopy [virtual], test_file_info, test_file_time, test_file_transfer_tentacle [virtual], test_filename [virtual], test_geometric [virtual], test_hash_table [virtual], test_huge_file [virtual], test_ini_parser [virtual], test_int_hash [virtual], test_math_ops [virtual], test_matrix [virtual], test_memory_limiter [virtual], test_mutex [virtual], test_node [virtual], test_object_packing [virtual], test_octopus_identity [virtual], test_octopus_security [virtual], test_packable_tree, test_parsing_csv [virtual], test_point [virtual], test_rectangle_warper [virtual], test_rsa [virtual], test_section_manager [virtual], test_sequence_tracker [virtual], test_set [virtual], test_singly_linked_list [virtual], test_sorts [virtual], test_span_manager [virtual], test_splitter [virtual], test_spocket [virtual], test_stack [virtual], test_string, test_string_table [virtual], test_symbol_table [virtual], test_symbol_tree, test_system_preconditions [virtual], test_system_values [virtual], test_tokenizer [virtual], test_tree [virtual], test_twofish [virtual], test_ucast_spocket [virtual], test_unique_id [virtual], test_unpacker [virtual], test_version [virtual], test_xml_generator [virtual], time_stamp_tester [virtual], and timer_driver_tester [virtual].

Public Member Functions | |
| unit_base () | |
| virtual | ~unit_base () |
| DEFINE_CLASS_NAME ("unit_base") | |
| int | total_tests () const |
| the total count of tests that have been run. | |
| int | passed_tests () const |
| count of successful tests run. | |
| int | failed_tests () const |
| count of number of failed tests. | |
| bool | failures_are_critical () const |
| void | set_failures_are_critial (bool are_failures_critical) |
| void | assert_equal (const basis::hoople_standard &a, const basis::hoople_standard &b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that the objects a and b are equal. | |
| void | assert_not_equal (const basis::hoople_standard &a, const basis::hoople_standard &b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that objects a and b are NOT equal. | |
| void | assert_equal (const basis::byte_array &a, const basis::byte_array &b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that the byte_arrays a and b are equal. | |
| void | assert_not_equal (const basis::byte_array &a, const basis::byte_array &b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that the byte_arrays a and b are not equal. | |
| void | assert_equal (int a, int b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that integers a and b are equal. | |
| void | assert_not_equal (int a, int b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that integers a and b are NOT equal. | |
| void | assert_equal (double a, double b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that doubles a and b are equal. | |
| void | assert_not_equal (double a, double b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that doubles a and b are NOT equal. | |
| void | assert_equal (const void *a, const void *b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that void pointers a and b are equal. | |
| void | assert_not_equal (const void *a, const void *b, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that void pointers a and b are NOT equal. | |
| void | assert_true (bool result, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that the "result" is a true boolean. | |
| void | assert_false (bool result, const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| tests that the "result" is a false boolean. | |
| void | record_pass (const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| very general recording of a successful test; better to use asserts. | |
| void | record_fail (const basis::astring &class_name, const basis::astring &test_name, const basis::astring &diagnostic_info) |
| very general recording of a failed test; better to use asserts. | |
| int | final_report () |
| generates a report of the total number of tests that succeeded. | |
Public Member Functions inherited from basis::nameable | |
| virtual const char * | class_name () const =0 |
| Returns the bare name of this class as a constant character pointer. | |
Definition at line 58 of file unit_base.h.
| unit_test::unit_base::unit_base | ( | ) |
Definition at line 42 of file unit_base.cpp.
|
virtual |
Definition at line 52 of file unit_base.cpp.
| void unit_test::unit_base::assert_equal | ( | const basis::byte_array & | a, |
| const basis::byte_array & | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that the byte_arrays a and b are equal.
Definition at line 176 of file unit_base.cpp.
References unit_test::byte_array_phrase, basis::nameable::class_name(), FUNCDEF, basis::array< contents >::length(), and test_name.
| void unit_test::unit_base::assert_equal | ( | const basis::hoople_standard & | a, |
| const basis::hoople_standard & | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that the objects a and b are equal.
Definition at line 156 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_equal | ( | const void * | a, |
| const void * | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that void pointers a and b are equal.
note that you can use this to compare any two pointers as long as you cast them to (void *) first. this reports whether the two have the same address in memory, but nothing about their contents.
Definition at line 235 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_equal | ( | double | a, |
| double | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that doubles a and b are equal.
Definition at line 218 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_equal | ( | int | a, |
| int | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that integers a and b are equal.
Definition at line 202 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_false | ( | bool | result, |
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that the "result" is a false boolean.
Definition at line 260 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_not_equal | ( | const basis::byte_array & | a, |
| const basis::byte_array & | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that the byte_arrays a and b are not equal.
Definition at line 189 of file unit_base.cpp.
References unit_test::byte_array_phrase, basis::nameable::class_name(), FUNCDEF, basis::array< contents >::length(), and test_name.
| void unit_test::unit_base::assert_not_equal | ( | const basis::hoople_standard & | a, |
| const basis::hoople_standard & | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that objects a and b are NOT equal.
Definition at line 165 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_not_equal | ( | const void * | a, |
| const void * | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that void pointers a and b are NOT equal.
Definition at line 244 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_not_equal | ( | double | a, |
| double | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that doubles a and b are NOT equal.
Definition at line 226 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_not_equal | ( | int | a, |
| int | b, | ||
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that integers a and b are NOT equal.
Definition at line 210 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| void unit_test::unit_base::assert_true | ( | bool | result, |
| const basis::astring & | class_name, | ||
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
tests that the "result" is a true boolean.
Definition at line 253 of file unit_base.cpp.
References basis::nameable::class_name(), FUNCDEF, and test_name.
| unit_test::unit_base::DEFINE_CLASS_NAME | ( | "unit_base" | ) |
| int unit_test::unit_base::failed_tests | ( | ) | const |
count of number of failed tests.
Definition at line 58 of file unit_base.cpp.
|
inline |
report whether we consider test errors to be a critical failure. if true, then any error causes a non-zero exit return from the unit test. if false, then the successful zero exit occurs instead. this allows a test which is known to fail to not break the build (ahem, borked blowfish!).
Definition at line 70 of file unit_base.h.
| int unit_test::unit_base::final_report | ( | ) |
generates a report of the total number of tests that succeeded.
the return value of this can be used as the exit value of the overall test. if there are any failures, then a failure result is returned (non-zero). otherwise the successful exit status of zero is returned.
Definition at line 267 of file unit_base.cpp.
References configuration::application_configuration::application_name(), BASE_LOG, filesystem::filename::basename(), filesystem::filename::raw(), and structures::symbol_table< contents >::symbols().
| int unit_test::unit_base::passed_tests | ( | ) | const |
count of successful tests run.
Definition at line 56 of file unit_base.cpp.
| void unit_test::unit_base::record_fail | ( | const basis::astring & | class_name, |
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
very general recording of a failed test; better to use asserts.
Definition at line 94 of file unit_base.cpp.
References BASE_LOG, basis::nameable::class_name(), and test_name.
| void unit_test::unit_base::record_pass | ( | const basis::astring & | class_name, |
| const basis::astring & | test_name, | ||
| const basis::astring & | diagnostic_info | ||
| ) |
very general recording of a successful test; better to use asserts.
Definition at line 71 of file unit_base.cpp.
References BASE_LOG, basis::nameable::class_name(), and test_name.
|
inline |
Definition at line 77 of file unit_base.h.
| int unit_test::unit_base::total_tests | ( | ) | const |
the total count of tests that have been run.
Definition at line 54 of file unit_base.cpp.