feisty meow concerns codebase  2.140
unit_test::unit_base Class Reference

#include <unit_base.h>

Inherits basis::nameable.

Inherited by application_example [virtual], application_example [virtual], t_amorph [virtual], test_address [virtual], test_angle [virtual], test_array, test_bcast_spocket [virtual], test_bit_vector [virtual], test_blowfish [virtual], test_boilerplate [virtual], test_byte_filer [virtual], test_byte_format [virtual], test_ccri_angle_average [virtual], test_chaos [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_enum_adapaters [virtual], test_file_info, test_file_time, test_filename [virtual], test_geometric [virtual], test_hash_table [virtual], test_huge_file [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_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_tokenizer [virtual], test_tree [virtual], test_ucast_spocket [virtual], test_unique_id [virtual], test_version [virtual], and test_xml_generator [virtual].

Collaboration diagram for unit_test::unit_base:

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. More...
 
int passed_tests () const
 count of successful tests run. More...
 
int failed_tests () const
 count of number of failed tests. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int final_report ()
 generates a report of the total number of tests that succeeded. More...
 
- 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. More...
 

Detailed Description

Definition at line 58 of file unit_base.h.

Constructor & Destructor Documentation

◆ unit_base()

unit_test::unit_base::unit_base ( )

Definition at line 42 of file unit_base.cpp.

◆ ~unit_base()

unit_test::unit_base::~unit_base ( )
virtual

Definition at line 51 of file unit_base.cpp.

Member Function Documentation

◆ assert_equal() [1/5]

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 175 of file unit_base.cpp.

References unit_test::byte_array_phrase, basis::nameable::class_name(), FUNCDEF, basis::array< contents >::length(), and test_name.

◆ assert_equal() [2/5]

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 155 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_equal() [3/5]

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 234 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_equal() [4/5]

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 217 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_equal() [5/5]

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 201 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_false()

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 259 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_not_equal() [1/5]

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 188 of file unit_base.cpp.

References unit_test::byte_array_phrase, basis::nameable::class_name(), FUNCDEF, basis::array< contents >::length(), and test_name.

◆ assert_not_equal() [2/5]

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 164 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_not_equal() [3/5]

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 243 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_not_equal() [4/5]

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 225 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_not_equal() [5/5]

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 209 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ assert_true()

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 252 of file unit_base.cpp.

References basis::nameable::class_name(), FUNCDEF, and test_name.

◆ DEFINE_CLASS_NAME()

unit_test::unit_base::DEFINE_CLASS_NAME ( "unit_base"  )

◆ failed_tests()

int unit_test::unit_base::failed_tests ( ) const

count of number of failed tests.

Definition at line 57 of file unit_base.cpp.

◆ final_report()

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 266 of file unit_base.cpp.

References BASE_LOG, filesystem::filename::basename(), filesystem::filename::raw(), and structures::symbol_table< contents >::symbols().

◆ passed_tests()

int unit_test::unit_base::passed_tests ( ) const

count of successful tests run.

Definition at line 55 of file unit_base.cpp.

◆ record_fail()

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 93 of file unit_base.cpp.

References BASE_LOG, basis::nameable::class_name(), and test_name.

◆ record_pass()

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 70 of file unit_base.cpp.

References BASE_LOG, basis::nameable::class_name(), and test_name.

◆ total_tests()

int unit_test::unit_base::total_tests ( ) const

the total count of tests that have been run.

Definition at line 53 of file unit_base.cpp.


The documentation for this class was generated from the following files: