1 #ifndef UNIT_BASE_GROUP
2 #define UNIT_BASE_GROUP
35 #define UNIT_BASE_THIS_OBJECT (*this)
38 #define ASSERT_EQUAL(a, b, test_name) { \
39 BASE_FUNCTION(func); \
40 UNIT_BASE_THIS_OBJECT.assert_equal(a, b, function_name, test_name, basis::astring(#a) + " must be equal to " + #b); \
42 #define ASSERT_INEQUAL(a, b, test_name) { \
43 BASE_FUNCTION(func); \
44 UNIT_BASE_THIS_OBJECT.assert_not_equal(a, b, function_name, test_name, basis::astring(#a) + " must be inequal to " + #b); \
46 #define ASSERT_TRUE(a, test_name) { \
47 BASE_FUNCTION(func); \
48 UNIT_BASE_THIS_OBJECT.assert_true(a, function_name, test_name, basis::astring(#a) + " must be true"); \
50 #define ASSERT_FALSE(a, test_name) { \
51 BASE_FUNCTION(func); \
52 UNIT_BASE_THIS_OBJECT.assert_false(a, function_name, test_name, basis::astring(#a) + " must be false"); \
55 #define ASSERT_NULL(x, y) ASSERT_FALSE(x, y)
56 #define ASSERT_NON_NULL(x, y) ASSERT_TRUE(x, y)
153 void write_cppunit_xml();
169 void record_failed_int_compare(
int a,
int b,
172 void record_failed_double_compare(
double a,
double b,
175 void record_failed_tf_assertion(
bool result,
bool expected_result,
178 void record_failed_pointer_compare(
const void *a,
const void *b,
Provides a dynamically resizable ASCII character string.
A very common template for a dynamic array of bytes.
the base class of the most easily used and tested objects in the library.
Root object for any class that knows its own name.
virtual const char * class_name() const =0
Returns the bare name of this class as a constant character pointer.
Provides a symbol_table that holds strings as the content.
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.
int total_tests() const
the total count of tests that have been run.
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.
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.
int passed_tests() const
count of successful tests run.
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::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.
DEFINE_CLASS_NAME("unit_base")
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.
int final_report()
generates a report of the total number of tests that succeeded.
int failed_tests() const
count of number of failed tests.
Useful support functions for unit testing, especially within hoople.