libcester
|
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <setjmp.h>
Go to the source code of this file.
Classes | |
struct | captured_stream |
struct | test_instance |
struct | test_case |
struct | allocated_memory |
struct | cester_array_struct |
struct | super_test_instance |
Macros | |
#define | __CESTER_INLINE__ |
#define | __CESTER_LONG_LONG__ long |
#define | __CESTER_LONG_LONG_FORMAT__ "%ld" |
#define | __CESTER_FUNCTION__ "<unknown>" |
#define | CESTER_NULL 0L |
#define | inline |
#define | __CESTER_CAST_CHAR_ARRAY__ |
#define | cester_meta_free(x) free(x); x = CESTER_NULL |
#define | EXOTICTYPES_WINDLLEXPORT 0 |
#define | EXOTIC_API extern |
#define | CESTER_RESET_TERMINAL "\x1B[0m" |
#define | CESTER_BOLD "\x1B[1m" |
#define | CESTER_FOREGROUND_BLACK "\x1B[30m" |
#define | CESTER_FOREGROUND_RED "\x1B[31m" |
#define | CESTER_FOREGROUND_GREEN "\x1B[32m" |
#define | CESTER_FOREGROUND_YELLOW "\x1B[33m" |
#define | CESTER_FOREGROUND_BLUE "\x1B[34m" |
#define | CESTER_FOREGROUND_MAGENTA "\x1B[35m" |
#define | CESTER_FOREGROUND_CYAN "\x1B[36m" |
#define | CESTER_FOREGROUND_WHITE "\x1B[37m" |
#define | CESTER_FOREGROUND_GRAY "\x1B[90m" |
#define | CESTER_BACKGROUND_BLACK "\x1B[40m" |
#define | CESTER_BACKGROUND_RED "\x1B[41m" |
#define | CESTER_BACKGROUND_GREEN "\x1B[42m" |
#define | CESTER_BACKGROUND_YELLOW "\x1B[43m" |
#define | CESTER_BACKGROUND_BLUE "\x1B[44m" |
#define | CESTER_BACKGROUND_MAGENTA "\x1B[45m" |
#define | CESTER_BACKGROUND_CYAN "\x1B[46m" |
#define | CESTER_BACKGROUND_GRAY "\x1B[100m" |
#define | CESTER_BACKGROUND_WHITE "\x1B[47m" |
#define | CESTER_RESET_TERMINAL_ATTR() ; |
#define | CESTER_VERSION "0.4" |
#define | CESTER_VERSION_NUM 0.4 |
#define | CESTER_LICENSE "MIT License" |
#define | CESTER_AUTHOR "Adewale Azeez and other contributors" |
#define | CESTER_HASH_SIGN # |
#define | CESTER_CONCAT(x, y) x y |
#define | CESTER_ARRAY_INITIAL_CAPACITY 30 |
#define | CESTER_ARRAY_MAX_CAPACITY ((size_t) - 5) |
#define | CESTER_ARRAY_FOREACH(w, x, y, z) |
#define | cester_sprintf(x, y, z, a, b) sprintf(x, z, a, b); |
#define | cester_sprintf1(x, y, z, a) sprintf(x, z, a) |
#define | cester_sprintf2(x, y, z, a, b) sprintf(x, z, a, b) |
#define | cester_sprintf3(x, y, z, a, b, c) sprintf(x, z, a, b, c) |
#define | CESTER_CHANGE_STREAM(x) { cester_ptr_to_str(&(superTestInstance.output_stream_str), x); superTestInstance.output_stream_address = *x; } (superTestInstance.output_stream = x) |
#define | CESTER_NOCOLOR() (superTestInstance.no_color = 1) |
#define | CESTER_PRINT_ERROR_ONLY(x) (superTestInstance.print_error_only = x) |
#define | CESTER_MINIMAL() (superTestInstance.verbose_level = 0) |
#define | CESTER_VERBOSE() (superTestInstance.verbose_level = 10); (superTestInstance.print_error_only = 0) |
#define | CESTER_DEBUG_LEVEL(x) (superTestInstance.verbose_level = x) |
#define | CESTER_VERBOSE_LEVEL(x) (superTestInstance.verbose_level = x) |
#define | CESTER_PRINT_VERSION() (superTestInstance.print_version = 1) |
#define | CESTER_SINGLE_OUPUT_ONLY() (superTestInstance.single_output_only = 1) |
#define | CESTER_NO_ISOLATION() (superTestInstance.isolate_tests = 0) |
#define | CESTER_NO_MEMTEST() (superTestInstance.mem_test_active = 0) |
#define | CESTER_DO_MEMTEST() (superTestInstance.mem_test_active = 1) |
#define | CESTER_NO_STREAMCAPTURE() (superTestInstance.stream_capture_active = 0) |
#define | CESTER_DO_STREAMCAPTURE() (superTestInstance.stream_capture_active = 1) |
#define | CESTER_OUTPUT_TEXT() superTestInstance.output_format = (char*) "text" |
#define | CESTER_OUTPUT_JUNITXML() superTestInstance.output_format = (char*) "junitxml" |
#define | CESTER_OUTPUT_TAP() superTestInstance.output_format = (char*) "tap" |
#define | CESTER_OUTPUT_TAPV13() superTestInstance.output_format = (char*) "tapV13" |
#define | CESTER_FORMAT_TESTNAME() superTestInstance.format_test_name = 1; |
#define | CESTER_DONT_FORMAT_TESTNAME() superTestInstance.format_test_name = 0; |
#define | CESTER_TOTAL_TESTS_COUNT (superTestInstance.total_tests_count) |
#define | CESTER_TOTAL_TESTS_RAN (superTestInstance.total_tests_ran) |
#define | CESTER_TOTAL_FAILED_TESTS_COUNT (superTestInstance.total_failed_tests_count) |
#define | CESTER_TOTAL_TEST_ERRORS_COUNT (superTestInstance.total_test_errors_count) |
#define | CESTER_TOTAL_TESTS_SKIPPED (superTestInstance.skipped_test_count) |
#define | CESTER_TOTAL_PASSED_TESTS_COUNT (superTestInstance.total_passed_tests_count) |
#define | CESTER_TOTAL_TODO_TESTS (superTestInstance.todo_tests_count) |
#define | CESTER_RUN_ALL_TESTS(x, y) cester_run_all_test(x,y) |
#define | CESTER_REPORT_SUCCESS_REGARDLESS() (superTestInstance.report_failure_regardless = 0); (superTestInstance.report_success_regardless = 1) |
#define | CESTER_REPORT_FAILURE_REGARDLESS() (superTestInstance.report_success_regardless = 0); (superTestInstance.report_failure_regardless = 1) |
#define | CESTER_SELECTCOLOR(x) (superTestInstance.no_color == 1 ? "" : x) |
#define | CESTER_GET_RESULT_AGGR (superTestInstance.total_failed_tests_count == 0 ? "SUCCESS" : "FAILURE") |
#define | CESTER_GET_RESULT_AGGR_COLOR (superTestInstance.total_failed_tests_count == 0 ? (CESTER_FOREGROUND_GREEN) : (CESTER_FOREGROUND_RED)) |
#define | CESTER_DELEGATE_FPRINT(y) fprintf(superTestInstance.output_stream, "%s", y) |
#define | CESTER_DELEGATE_FPRINT_STR(x, y) fprintf(superTestInstance.output_stream, "%s%s%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define | CESTER_DELEGATE_FPRINT_PTR(x, y) fprintf(superTestInstance.output_stream, "%s%p%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define | CESTER_DELEGATE_FPRINT_INT(x, y) fprintf(superTestInstance.output_stream, "%s%d%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define | CESTER_DELEGATE_FPRINT_UINT(x, y) fprintf(superTestInstance.output_stream, "%s%u%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define | CESTER_DELEGATE_FPRINT_DOUBLE(x, y) fprintf(superTestInstance.output_stream, "%s%f%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define | CESTER_DELEGATE_FPRINT_DOUBLE_2(x, y) fprintf(superTestInstance.output_stream, "%s%.2f%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define | cester_assert_nothing() |
#define | cester_swallow(param) |
#define | cester_assert_cmp_msg(w, x, y, z) cester_evaluate_expression(w x y, z, __FILE__, __LINE__) |
#define | cester_assert_cmp(x, y, z) cester_assert_cmp_msg(x, y, z, "(" #x " " #y " " #z ")") |
#define | cester_assert_true(x) cester_assert_cmp_msg(x, ==, 1, "(" #x ")") |
#define | cester_assert_true_msg(x, y) cester_assert_cmp_msg(x, ==, 1, y) |
#define | cester_assert_false(x) cester_assert_cmp_msg(x, ==, 0, "(" #x ")") |
#define | cester_assert_false_msg(x, y) cester_assert_cmp_msg(x, ==, 0, y) |
#define | cester_assert_null(x) cester_assert_cmp_msg(x, ==, CESTER_NULL, "(" #x ")") |
#define | cester_assert_not_null(x) cester_assert_cmp_msg(x, !=, CESTER_NULL, "!(" #x ")") |
#define | cester_assert_equal(x, y) cester_evaluate_expect_actual(x==y, 1, #x, #y, __FILE__, __LINE__) |
#define | cester_assert_not_equal(x, y) cester_evaluate_expect_actual(x!=y, 0, #x, #y, __FILE__, __LINE__) |
#define | cester_assert_str_equal(x, y) cester_evaluate_expect_actual_str(x, y, #x, #y, 1, __FILE__, __LINE__) |
#define | cester_assert_str_eq cester_assert_str_equal |
#define | cester_assert_str_not_equal(x, y) cester_evaluate_expect_actual_str(x, y, #x, #y, 0, __FILE__, __LINE__) |
#define | cester_assert_str_ne cester_assert_str_not_equal |
#define | cester_assert_ptr_equal(x, y) cester_evaluate_expect_actual_ptr(x, y, #x, #y, 1, __FILE__, __LINE__) |
#define | cester_assert_ptr_eq cester_assert_ptr_equal |
#define | cester_assert_ptr_not_equal(x, y) cester_evaluate_expect_actual_ptr(x, y, #x, #y, 0, __FILE__, __LINE__) |
#define | cester_assert_ptr_ne cester_assert_ptr_not_equal |
#define | __internal_cester_assert_cmp(w, x, y, z) (w x y, z, w, y, #x, __FILE__, __LINE__) |
#define | __internal_cester_assert_eq(x, y, z) (CESTER_COMPARATOR_EQUAL, "expected " #z ",%s received " #z, y, x, "", __FILE__, __LINE__) |
#define | __internal_cester_assert_ne(x, y, z) (CESTER_COMPARATOR_NOT_EQUAL, "not expecting " #z ",%s found " #z, x, y, "", __FILE__, __LINE__) |
#define | __internal_cester_assert_gt(x, y, z) (CESTER_COMPARATOR_GREATER_THAN, "expected value to be greater than " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define | __internal_cester_assert_ge(x, y, z) (CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL, "expected value to be greater than or equal to " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define | __internal_cester_assert_lt(x, y, z) (CESTER_COMPARATOR_LESSER_THAN, "expected value to be lesser than " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define | __internal_cester_assert_le(x, y, z) (CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL, "expected value to be lesser than or equal to " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define | cester_assert_cmp_char(w, x, y, z) CESTER_CONCAT(cester_compare_char_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_char_eq(x, y) CESTER_CONCAT(cester_compare_char, __internal_cester_assert_eq(x,y,%c)) |
#define | cester_assert_char_ne(x, y) CESTER_CONCAT(cester_compare_char, __internal_cester_assert_ne(x,y,%c)) |
#define | cester_assert_char_gt(x, y) CESTER_CONCAT(cester_compare_char, __internal_cester_assert_gt(x,y,%c)) |
#define | cester_assert_char_ge(x, y) CESTER_CONCAT(cester_compare_char, __internal_cester_assert_ge(x,y,%c)) |
#define | cester_assert_char_lt(x, y) CESTER_CONCAT(cester_compare_char, __internal_cester_assert_lt(x,y,%c)) |
#define | cester_assert_char_le(x, y) CESTER_CONCAT(cester_compare_char, __internal_cester_assert_le(x,y,%c)) |
#define | cester_assert_cmp_uchar(w, x, y, z) CESTER_CONCAT(cester_compare_uchar_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_uchar_eq(x, y) CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_eq(x,y,%c)) |
#define | cester_assert_uchar_ne(x, y) CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_ne(x,y,%c)) |
#define | cester_assert_uchar_gt(x, y) CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_gt(x,y,%c)) |
#define | cester_assert_uchar_ge(x, y) CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_ge(x,y,%c)) |
#define | cester_assert_uchar_lt(x, y) CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_lt(x,y,%c)) |
#define | cester_assert_uchar_le(x, y) CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_le(x,y,%c)) |
#define | cester_assert_cmp_short(w, x, y, z) CESTER_CONCAT(cester_compare_short_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_short_eq(x, y) CESTER_CONCAT(cester_compare_short, __internal_cester_assert_eq(x,y,%hi)) |
#define | cester_assert_short_ne(x, y) CESTER_CONCAT(cester_compare_short, __internal_cester_assert_ne(x,y,%hi)) |
#define | cester_assert_short_gt(x, y) CESTER_CONCAT(cester_compare_short, __internal_cester_assert_gt(x,y,%hi)) |
#define | cester_assert_short_ge(x, y) CESTER_CONCAT(cester_compare_short, __internal_cester_assert_ge(x,y,%hi)) |
#define | cester_assert_short_lt(x, y) CESTER_CONCAT(cester_compare_short, __internal_cester_assert_lt(x,y,%hi)) |
#define | cester_assert_short_le(x, y) CESTER_CONCAT(cester_compare_short, __internal_cester_assert_le(x,y,%hi)) |
#define | cester_assert_cmp_ushort(w, x, y, z) CESTER_CONCAT(cester_compare_ushort_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_ushort_eq(x, y) CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_eq(x,y,%hu)) |
#define | cester_assert_ushort_ne(x, y) CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_ne(x,y,%hu)) |
#define | cester_assert_ushort_gt(x, y) CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_gt(x,y,%hu)) |
#define | cester_assert_ushort_ge(x, y) CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_ge(x,y,%hu)) |
#define | cester_assert_ushort_lt(x, y) CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_lt(x,y,%hu)) |
#define | cester_assert_ushort_le(x, y) CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_le(x,y,%hu)) |
#define | cester_assert_cmp_int(w, x, y, z) CESTER_CONCAT(cester_compare_int_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_int_eq(x, y) CESTER_CONCAT(cester_compare_int, __internal_cester_assert_eq(x,y,%d)) |
#define | cester_assert_int_ne(x, y) CESTER_CONCAT(cester_compare_int, __internal_cester_assert_ne(x,y,%d)) |
#define | cester_assert_int_gt(x, y) CESTER_CONCAT(cester_compare_int, __internal_cester_assert_gt(x,y,%d)) |
#define | cester_assert_int_ge(x, y) CESTER_CONCAT(cester_compare_int, __internal_cester_assert_ge(x,y,%d)) |
#define | cester_assert_int_lt(x, y) CESTER_CONCAT(cester_compare_int, __internal_cester_assert_lt(x,y,%d)) |
#define | cester_assert_int_le(x, y) CESTER_CONCAT(cester_compare_int, __internal_cester_assert_le(x,y,%d)) |
#define | cester_assert_cmp_uint(w, x, y, z) CESTER_CONCAT(cester_compare_uint_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_uint_eq(x, y) CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_eq(x,y,%u)) |
#define | cester_assert_uint_ne(x, y) CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_ne(x,y,%u)) |
#define | cester_assert_uint_gt(x, y) CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_gt(x,y,%u)) |
#define | cester_assert_uint_ge(x, y) CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_ge(x,y,%u)) |
#define | cester_assert_uint_lt(x, y) CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_lt(x,y,%u)) |
#define | cester_assert_uint_le(x, y) CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_le(x,y,%u)) |
#define | cester_assert_cmp_long(w, x, y, z) CESTER_CONCAT(cester_compare_long_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_long_eq(x, y) CESTER_CONCAT(cester_compare_long, __internal_cester_assert_eq(x,y,%li)) |
#define | cester_assert_long_ne(x, y) CESTER_CONCAT(cester_compare_long, __internal_cester_assert_ne(x,y,%li)) |
#define | cester_assert_long_gt(x, y) CESTER_CONCAT(cester_compare_long, __internal_cester_assert_gt(x,y,%li)) |
#define | cester_assert_long_ge(x, y) CESTER_CONCAT(cester_compare_long, __internal_cester_assert_ge(x,y,%li)) |
#define | cester_assert_long_lt(x, y) CESTER_CONCAT(cester_compare_long, __internal_cester_assert_lt(x,y,%li)) |
#define | cester_assert_long_le(x, y) CESTER_CONCAT(cester_compare_long, __internal_cester_assert_le(x,y,%li)) |
#define | cester_assert_cmp_ulong(w, x, y, z) CESTER_CONCAT(cester_compare_ulong_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_ulong_eq(x, y) CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_eq(x,y,%lu)) |
#define | cester_assert_ulong_ne(x, y) CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_ne(x,y,%lu)) |
#define | cester_assert_ulong_gt(x, y) CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_gt(x,y,%lu)) |
#define | cester_assert_ulong_ge(x, y) CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_ge(x,y,%lu)) |
#define | cester_assert_ulong_lt(x, y) CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_lt(x,y,%lu)) |
#define | cester_assert_ulong_le(x, y) CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_le(x,y,%lu)) |
#define | cester_assert_cmp_llong(w, x, y, z) CESTER_CONCAT(cester_compare_llong_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_llong_eq(x, y) CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_eq(x,y,%li)) |
#define | cester_assert_llong_ne(x, y) CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_ne(x,y,%li)) |
#define | cester_assert_llong_gt(x, y) CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_gt(x,y,%li)) |
#define | cester_assert_llong_ge(x, y) CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_ge(x,y,%li)) |
#define | cester_assert_llong_lt(x, y) CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_lt(x,y,%li)) |
#define | cester_assert_llong_le(x, y) CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_ge(x,y,%li)) |
#define | cester_assert_cmp_ullong(w, x, y, z) CESTER_CONCAT(cester_compare_ullong_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_ullong_eq(x, y) CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_eq(x,y,%llu)) |
#define | cester_assert_ullong_ne(x, y) CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_ne(x,y,%llu)) |
#define | cester_assert_ullong_gt(x, y) CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_gt(x,y,%llu)) |
#define | cester_assert_ullong_ge(x, y) CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_ge(x,y,%llu)) |
#define | cester_assert_ullong_lt(x, y) CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_lt(x,y,%llu)) |
#define | cester_assert_ullong_le(x, y) CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_le(x,y,%llu)) |
#define | cester_assert_cmp_float(w, x, y, z) CESTER_CONCAT(cester_compare_float_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_float_eq(x, y) CESTER_CONCAT(cester_compare_float, __internal_cester_assert_eq(x,y,%f)) |
#define | cester_assert_float_ne(x, y) CESTER_CONCAT(cester_compare_float, __internal_cester_assert_ne(x,y,%f)) |
#define | cester_assert_float_gt(x, y) CESTER_CONCAT(cester_compare_float, __internal_cester_assert_gt(x,y,%f)) |
#define | cester_assert_float_ge(x, y) CESTER_CONCAT(cester_compare_float, __internal_cester_assert_ge(x,y,%f)) |
#define | cester_assert_float_lt(x, y) CESTER_CONCAT(cester_compare_float, __internal_cester_assert_lt(x,y,%f)) |
#define | cester_assert_float_le(x, y) CESTER_CONCAT(cester_compare_float, __internal_cester_assert_le(x,y,%f)) |
#define | cester_assert_cmp_double(w, x, y, z) CESTER_CONCAT(cester_compare_double_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_double_eq(x, y) CESTER_CONCAT(cester_compare_double, __internal_cester_assert_eq(x,y,%lf)) |
#define | cester_assert_double_ne(x, y) CESTER_CONCAT(cester_compare_double, __internal_cester_assert_ne(x,y,%lf)) |
#define | cester_assert_double_gt(x, y) CESTER_CONCAT(cester_compare_double, __internal_cester_assert_gt(x,y,%lf)) |
#define | cester_assert_double_ge(x, y) CESTER_CONCAT(cester_compare_double, __internal_cester_assert_ge(x,y,%lf)) |
#define | cester_assert_double_lt(x, y) CESTER_CONCAT(cester_compare_double, __internal_cester_assert_lt(x,y,%lf)) |
#define | cester_assert_double_le(x, y) CESTER_CONCAT(cester_compare_double, __internal_cester_assert_le(x,y,%lf)) |
#define | cester_assert_cmp_ldouble(w, x, y, z) CESTER_CONCAT(cester_compare_ldouble_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
#define | cester_assert_ldouble_eq(x, y) CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_eq(x,y,%e)) |
#define | cester_assert_ldouble_ne(x, y) CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_ne(x,y,%e)) |
#define | cester_assert_ldouble_gt(x, y) CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_gt(x,y,%e)) |
#define | cester_assert_ldouble_ge(x, y) CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_ge(x,y,%e)) |
#define | cester_assert_ldouble_lt(x, y) CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_lt(x,y,%e)) |
#define | cester_assert_ldouble_le(x, y) CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_le(x,y,%e)) |
#define | CESTER_INTERNAL_EVALUATE(comparator_type, x, y, result) |
#define | CESTER_TEST(x, y, z) static void cester_test_##x(TestInstance* y); |
#define | CESTER_TODO_TEST(x, y, z) static void cester_test_##x(TestInstance* y); |
#define | CESTER_SKIP_TEST(x, y, z) static void cester_test_##x(TestInstance* y); |
#define | CESTER_BEFORE_ALL(x, y) void cester_before_all_test(TestInstance* x); |
#define | CESTER_BEFORE_EACH(w, x, y, z) void cester_before_each_test(TestInstance* w, char * const x, unsigned y); |
#define | CESTER_AFTER_ALL(x, y) void cester_after_all_test(TestInstance* x); |
#define | CESTER_AFTER_EACH(w, x, y, z) void cester_after_each_test(TestInstance* w, char * const x, unsigned y); |
#define | CESTER_OPTIONS(x) void cester_options_before_main(void); |
#define | CESTER_BODY(x) |
#define | CESTER_COMMENT(x) void cester_test_file_comment_function(void); |
#define | CESTER_MOCK_SIMPLE_FUNCTION(x, y, z) __attribute__((weak)) y x; y __real_##x; |
#define | CESTER_MOCK_FUNCTION(x, y, z) __attribute__((weak)) y x; extern y __real_##x; |
#define | CESTER_TEST(x, y, z) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) #x, (cester_test_##x), CESTER_NULL, CESTER_NULL, CESTER_NORMAL_TEST }, |
#define | CESTER_TODO_TEST(x, y, z) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) #x, (cester_test_##x), CESTER_NULL, CESTER_NULL, CESTER_NORMAL_TODO_TEST }, |
#define | CESTER_SKIP_TEST(x, y, z) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) #x, (cester_test_##x), CESTER_NULL, CESTER_NULL, CESTER_NORMAL_SKIP_TEST }, |
#define | CESTER_BEFORE_ALL(x, y) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_before_all_test", (cester_before_all_test), CESTER_NULL, CESTER_NULL, CESTER_BEFORE_ALL_TEST }, |
#define | CESTER_BEFORE_EACH(w, x, y, z) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) (char*) "", (char*) "cester_before_each_test", CESTER_NULL, (cester_before_each_test), CESTER_NULL, CESTER_BEFORE_EACH_TEST }, |
#define | CESTER_AFTER_ALL(x, y) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_after_all_test", (cester_after_all_test), CESTER_NULL, CESTER_NULL, CESTER_AFTER_ALL_TEST }, |
#define | CESTER_AFTER_EACH(w, x, y, z) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_after_each_test", CESTER_NULL, (cester_after_each_test), CESTER_NULL, CESTER_AFTER_EACH_TEST }, |
#define | CESTER_OPTIONS(x) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_options_before_main", CESTER_NULL, CESTER_NULL, (cester_options_before_main), CESTER_OPTIONS_FUNCTION }, |
#define | CESTER_COMMENT(x) { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_test_file_comment_function", CESTER_NULL, CESTER_NULL, (cester_test_file_comment_function), CESTER_TEST_FILE_COMMENT }, |
#define | CESTER_BODY(x) |
#define | CESTER_MOCK_SIMPLE_FUNCTION(x, y, z) |
#define | CESTER_MOCK_FUNCTION(x, y, z) |
#define | CESTER_TEST(x, y, z) static void cester_test_##x(TestInstance* y) { z } |
#define | CESTER_TODO_TEST(x, y, z) static void cester_test_##x(TestInstance* y) { } |
#define | CESTER_SKIP_TEST(x, y, z) static void cester_test_##x(TestInstance* y) { z } |
#define | CESTER_BEFORE_ALL(x, y) void cester_before_all_test(TestInstance* x) { y CESTER_NO_ISOLATION(); } |
#define | CESTER_BEFORE_EACH(w, x, y, z) void cester_before_each_test(TestInstance* w, char * const x, unsigned y) { z CESTER_NO_ISOLATION(); } |
#define | CESTER_AFTER_ALL(x, y) void cester_after_all_test(TestInstance* x) { y CESTER_NO_ISOLATION(); } |
#define | CESTER_AFTER_EACH(w, x, y, z) void cester_after_each_test(TestInstance* w, char * const x, unsigned y) { z CESTER_NO_ISOLATION(); } |
#define | CESTER_OPTIONS(x) void cester_options_before_main(void) { x } |
#define | CESTER_BODY(x) x |
#define | CESTER_COMMENT(x) void cester_test_file_comment_function(void) { if (cester_string_equals(superTestInstance.output_format, (char*) "text") == 1) { CESTER_DELEGATE_FPRINT_STR((cester_default_color), "\n"); CESTER_DELEGATE_FPRINT_STR((cester_default_color), #x); CESTER_DELEGATE_FPRINT_STR((cester_default_color), "\n"); } } |
#define | CESTER_MOCK_SIMPLE_FUNCTION(x, y, z) y __wrap_##x { return z; } |
#define | CESTER_MOCK_FUNCTION(x, y, z) y __wrap_##x { z } |
#define | CESTER_REGISTER_TEST(x) cester_register_test((char*)#x, (cester_test_##x), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_NORMAL_TEST) |
#define | CESTER_REGISTER_SKIP_TEST(x) cester_register_test((char*)#x, (cester_test_##x), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_NORMAL_SKIP_TEST) |
#define | CESTER_REGISTER_TODO_TEST(x) cester_register_test((char*)#x, (cester_test_##x), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_NORMAL_TODO_TEST) |
#define | CESTER_REGISTER_BEFORE_ALL() cester_register_test("cester_before_all_test", (cester_before_all_test), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_BEFORE_ALL_TEST) |
#define | CESTER_REGISTER_BEFORE_EACH() cester_register_test("cester_before_each_test", CESTER_NULL, (cester_before_each_test), CESTER_NULL, __LINE__, CESTER_BEFORE_EACH_TEST) |
#define | CESTER_REGISTER_AFTER_ALL() cester_register_test("cester_after_all_test", (cester_after_all_test), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_AFTER_ALL_TEST) |
#define | CESTER_REGISTER_AFTER_EACH() cester_register_test("cester_after_each_test", CESTER_NULL, (cester_after_each_test), CESTER_NULL, __LINE__, CESTER_AFTER_EACH_TEST) |
#define | CESTER_REGISTER_OPTIONS() cester_register_test("cester_options_before_main", CESTER_NULL, CESTER_NULL, (cester_options_before_main), __LINE__, CESTER_OPTIONS_FUNCTION) |
#define | CESTER_REGISTER_COMMENT() cester_register_test("cester_test_file_comment_function", CESTER_NULL, CESTER_NULL, (cester_test_file_comment_function), __LINE__, CESTER_OPTIONS_FUNCTION) |
#define | CESTER_TEST_SHOULD(x, y) cester_expected_test_result(#x, y); |
#define | CESTER_TEST_SHOULD_SEGFAULT(x) CESTER_TEST_SHOULD(x, CESTER_RESULT_SEGFAULT); |
#define | CESTER_TEST_SHOULD_FAIL(x) CESTER_TEST_SHOULD(x, CESTER_RESULT_FAILURE); |
#define | CESTER_TEST_SHOULD_BE_TERMINATED(x) CESTER_TEST_SHOULD(x, CESTER_RESULT_TERMINATED); |
#define | CESTER_TEST_SHOULD_NOT_RELEASE_STREAM(x) CESTER_TEST_SHOULD(x, CESTER_RESULT_UNRELEASED_STREAM); |
#define | CESTER_TEST_SHOULD_LEAK_MEMORY(x) CESTER_TEST_SHOULD(x, CESTER_RESULT_MEMORY_LEAK); |
#define | CESTER_CHANGE_STREAM_CAPTURE_TM_FOLDER(x) cester_set_captured_streams_tmp_folder(x, CESTER_NULL) |
#define | CESTER_CAPTURE_STREAM(x) cester_capture_stream(x, __FILE__, __LINE__) |
#define | CESTER_STREAM_CONTENT(x) cester_stream_content(x, __FILE__, __LINE__) |
#define | CESTER_RESET_STREAM(x) cester_reset_stream(x, __FILE__, __LINE__) |
#define | CESTER_RELEASE_STREAM(x) cester_release_stream(x, __FILE__, __LINE__) |
#define | CESTER_CAPTURE_STDIN() CESTER_CAPTURE_STREAM(stdin) |
#define | CESTER_STDIN_CONTENT() CESTER_STREAM_CONTENT(stdin) |
#define | CESTER_RESET_STDIN() CESTER_RESET_STREAM(stdin) |
#define | CESTER_RELEASE_STDIN() CESTER_RELEASE_STREAM(stdin) |
#define | CESTER_CAPTURE_STDOUT() CESTER_CAPTURE_STREAM(stdout) |
#define | CESTER_STDOUT_CONTENT() CESTER_STREAM_CONTENT(stdout) |
#define | CESTER_RESET_STDOUT() CESTER_RESET_STREAM(stdout) |
#define | CESTER_RELEASE_STDOUT() CESTER_RELEASE_STREAM(stdout) |
#define | CESTER_CAPTURE_STDERR() CESTER_CAPTURE_STREAM(stderr) |
#define | CESTER_STDERR_CONTENT() CESTER_STREAM_CONTENT(stderr) |
#define | CESTER_RESET_STDERR() CESTER_RESET_STREAM(stderr) |
#define | CESTER_RELEASE_STDERR() CESTER_RELEASE_STREAM(stderr) |
#define | cester_assert_stream_content_equal(x, y) cester_assert_str_equal(CESTER_STREAM_CONTENT(x), y) |
#define | cester_assert_stream_content_contain(x, y) cester_assert_true(cester_string_contains(CESTER_STREAM_CONTENT(x), y)) |
#define | cester_assert_stream_content_not_equal(x, y) cester_assert_str_not_equal(CESTER_STREAM_CONTENT(x), y) |
#define | cester_assert_stream_content_not_contain(x, y) cester_assert_false(cester_string_contains(CESTER_STREAM_CONTENT(x), y)) |
#define | cester_assert_stdin_stream_content_equal(y) cester_assert_str_equal(CESTER_STDIN_CONTENT(), y) |
#define | cester_assert_stdin_stream_content_contain(y) cester_assert_true(cester_string_contains(CESTER_STDIN_CONTENT(), y)) |
#define | cester_assert_stdin_stream_content_not_equal(y) cester_assert_str_not_equal(CESTER_STDIN_CONTENT(), y) |
#define | cester_assert_stdin_stream_content_not_contain(y) cester_assert_false(cester_string_contains(CESTER_STDIN_CONTENT(), y)) |
#define | cester_assert_stdout_stream_content_equal(y) cester_assert_str_equal(CESTER_STDOUT_CONTENT(), y) |
#define | cester_assert_printf_equal cester_assert_stdout_stream_content_equal |
#define | cester_assert_stdout_stream_content_contain(y) cester_assert_true(cester_string_contains(CESTER_STDOUT_CONTENT(), y)) |
#define | cester_assert_printf_contain cester_assert_stdout_stream_content_contain |
#define | cester_assert_stdout_stream_content_not_equal(y) cester_assert_str_not_equal(CESTER_STDOUT_CONTENT(), y) |
#define | cester_assert_printf_not_equal cester_assert_stdout_stream_content_not_equal |
#define | cester_assert_stdout_stream_content_not_contain(y) cester_assert_false(cester_string_contains(CESTER_STDOUT_CONTENT(), y)) |
#define | cester_assert_printf_not_contain cester_assert_stdout_stream_content_not_contain |
#define | cester_assert_stderr_stream_content_equal(y) cester_assert_str_equal(CESTER_STDERR_CONTENT(), y) |
#define | cester_assert_stderr_stream_content_contain(y) cester_assert_true(cester_string_contains(CESTER_STDERR_CONTENT(), y)) |
#define | cester_assert_stderr_stream_content_not_equal(y) cester_assert_str_not_equal(CESTER_STDERR_CONTENT(), y) |
#define | cester_assert_stderr_stream_content_not_contain(y) cester_assert_false(cester_string_contains(CESTER_STDERR_CONTENT(), y)) |
#define | CESTER_TEST_FUNTION_TYPE_TO_STRING(test_type) |
#define | CESTER_PRINT_TEST_FUNCTION(tab, text_prefix, test_case) |
#define | malloc(x) cester_allocator( 0, x, 0, __FILE__, __LINE__, __CESTER_FUNCTION__) |
#define | calloc(x, y) cester_allocator( x, y, 1, __FILE__, __LINE__, __CESTER_FUNCTION__) |
#define | free(x) cester_free( x, __FILE__, __LINE__, __CESTER_FUNCTION__) |
Typedefs | |
typedef enum cester_test_type | TestType |
typedef struct captured_stream | CapturedStream |
typedef struct test_instance | TestInstance |
typedef void(* | cester_test) (TestInstance *) |
typedef void(* | cester_before_after_each) (TestInstance *, char *const, unsigned) |
typedef void(* | cester_void) (void) |
typedef struct test_case | TestCase |
typedef struct allocated_memory | AllocatedMemory |
typedef struct cester_array_struct | CesterArray |
typedef struct super_test_instance | SuperTestInstance |
Functions | |
void | cester_capture_signals (void) |
void | cester_recover_on_signal (int sig_num) |
int | main (int argc, char **argv) |
Variables | |
jmp_buf | buf |
SuperTestInstance | superTestInstance |
const char * | cester_default_color = CESTER_RESET_TERMINAL |
Cester is a header only unit testing framework for C. The header file can be downloaded and placed in a project folder or can be used as part of libopen library by including it in the projects like <libopen/cester.h>
.
A single test file is considered a test suite in cester, a single test file should contain related tests functions only.
#define __CESTER_CAST_CHAR_ARRAY__ |
#define __CESTER_FUNCTION__ "<unknown>" |
#define __CESTER_INLINE__ |
The inline keyword to optimize the function. In C89 and C90 the inline keyword semantic is different from current C standard semantic hence for compilation targeting C89 or C99 the inline keyword is ommited.
#define __CESTER_LONG_LONG__ long |
#define __CESTER_LONG_LONG_FORMAT__ "%ld" |
#define __internal_cester_assert_cmp | ( | w, | |
x, | |||
y, | |||
z | |||
) | (w x y, z, w, y, #x, __FILE__, __LINE__) |
#define __internal_cester_assert_eq | ( | x, | |
y, | |||
z | |||
) | (CESTER_COMPARATOR_EQUAL, "expected " #z ",%s received " #z, y, x, "", __FILE__, __LINE__) |
#define __internal_cester_assert_ge | ( | x, | |
y, | |||
z | |||
) | (CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL, "expected value to be greater than or equal to " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define __internal_cester_assert_gt | ( | x, | |
y, | |||
z | |||
) | (CESTER_COMPARATOR_GREATER_THAN, "expected value to be greater than " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define __internal_cester_assert_le | ( | x, | |
y, | |||
z | |||
) | (CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL, "expected value to be lesser than or equal to " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define __internal_cester_assert_lt | ( | x, | |
y, | |||
z | |||
) | (CESTER_COMPARATOR_LESSER_THAN, "expected value to be lesser than " #z ",%s received " #z, x, y, "", __FILE__, __LINE__) |
#define __internal_cester_assert_ne | ( | x, | |
y, | |||
z | |||
) | (CESTER_COMPARATOR_NOT_EQUAL, "not expecting " #z ",%s found " #z, x, y, "", __FILE__, __LINE__) |
#define calloc | ( | x, | |
y | |||
) | cester_allocator( x, y, 1, __FILE__, __LINE__, __CESTER_FUNCTION__) |
Override the default malloc function for mem test
#define CESTER_AFTER_ALL | ( | x, | |
y | |||
) | void cester_after_all_test(TestInstance* x); |
The function that would be invoked once after running all the tests in the test file. You can only have one of this function in a test file.
#define CESTER_AFTER_ALL | ( | x, | |
y | |||
) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_after_all_test", (cester_after_all_test), CESTER_NULL, CESTER_NULL, CESTER_AFTER_ALL_TEST }, |
The function that would be invoked once after running all the tests in the test file. You can only have one of this function in a test file.
#define CESTER_AFTER_ALL | ( | x, | |
y | |||
) | void cester_after_all_test(TestInstance* x) { y CESTER_NO_ISOLATION(); } |
The function that would be invoked once after running all the tests in the test file. You can only have one of this function in a test file.
#define CESTER_AFTER_EACH | ( | w, | |
x, | |||
y, | |||
z | |||
) | void cester_after_each_test(TestInstance* w, char * const x, unsigned y); |
The functions that would be invoked after each test is ran. You can only have one of this function in a test file.
#define CESTER_AFTER_EACH | ( | w, | |
x, | |||
y, | |||
z | |||
) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_after_each_test", CESTER_NULL, (cester_after_each_test), CESTER_NULL, CESTER_AFTER_EACH_TEST }, |
The functions that would be invoked after each test is ran. You can only have one of this function in a test file.
#define CESTER_AFTER_EACH | ( | w, | |
x, | |||
y, | |||
z | |||
) | void cester_after_each_test(TestInstance* w, char * const x, unsigned y) { z CESTER_NO_ISOLATION(); } |
The functions that would be invoked after each test is ran. You can only have one of this function in a test file.
#define CESTER_ARRAY_FOREACH | ( | w, | |
x, | |||
y, | |||
z | |||
) |
#define CESTER_ARRAY_INITIAL_CAPACITY 30 |
The initial amount of item the CesterArray can accept the first time it initialized.
#define CESTER_ARRAY_MAX_CAPACITY ((size_t) - 5) |
The maximum number of item the CesterArray can contain, in case of the Memory manager array reaching this max capacity continous mem test will be disabled.
#define cester_assert_char_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_char, __internal_cester_assert_eq(x,y,%c)) |
Check if the two characters are the same. This macro prints out the actual values of the two characters.
x | a char |
y | another char |
#define cester_assert_char_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_char, __internal_cester_assert_ge(x,y,%c)) |
Check if the a char is greater than or equal to the other. This macro prints out the actual values of the two chars.
x | a char |
y | another char |
#define cester_assert_char_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_char, __internal_cester_assert_gt(x,y,%c)) |
Check if the a char is greater than the other. This macro prints out the actual values of the two chars.
x | a char |
y | another char |
#define cester_assert_char_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_char, __internal_cester_assert_le(x,y,%c)) |
Check if the a char is lesser than or equal to the other. This macro prints out the actual values of the two chars.
x | a char |
y | another char |
#define cester_assert_char_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_char, __internal_cester_assert_lt(x,y,%c)) |
Check if the a char is lesser than the other. This macro prints out the actual values of the two chars.
x | a char |
y | another char |
#define cester_assert_char_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_char, __internal_cester_assert_ne(x,y,%c)) |
Check if the two char are not the same. This macro prints out the actual values of the two chars.
x | a char |
y | another char |
#define cester_assert_cmp | ( | x, | |
y, | |||
z | |||
) | cester_assert_cmp_msg(x, y, z, "(" #x " " #y " " #z ")") |
Compare two argument using the provided operator Prints the expression as in the source code
x | a value to compare to z |
y | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
z | a value to compare to x |
#define cester_assert_cmp_char | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_char_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two char using the provided operator This macro prints out the actual values of the two chars.
w | a char |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another char |
z | the string formated for output |
#define cester_assert_cmp_double | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_double_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two double using the provided operator This macro prints out the actual values of the two double.
w | a double |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another double |
z | the string formated for output |
#define cester_assert_cmp_float | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_float_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two float using the provided operator This macro prints out the actual values of the two float.
w | a float |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another float |
z | the string formated for output |
#define cester_assert_cmp_int | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_int_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two int using the provided operator This macro prints out the actual values of the two int.
w | an int |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another int |
z | the string formated for output |
#define cester_assert_cmp_ldouble | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_ldouble_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two long double using the provided operator This macro prints out the actual values of the two long double.
w | a long double |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another long double |
z | the string formated for output |
#define cester_assert_cmp_llong | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_llong_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two long long using the provided operator This macro prints out the actual values of the two long long.
w | a long long |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another long long |
z | the string formated for output |
#define cester_assert_cmp_long | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_long_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two long using the provided operator This macro prints out the actual values of the two long.
w | a long |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another long |
z | the string formated for output |
#define cester_assert_cmp_msg | ( | w, | |
x, | |||
y, | |||
z | |||
) | cester_evaluate_expression(w x y, z, __FILE__, __LINE__) |
Compare two argument using the provided operator Prints the expression as in the source code
w | a value to compare to y |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | a value to compare to w |
z | the expression to print in output |
#define cester_assert_cmp_short | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_short_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two short using the provided operator This macro prints out the actual values of the two short.
w | a short |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another short |
z | the string formated for output |
#define cester_assert_cmp_uchar | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_uchar_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two unsigned char using the provided operator This macro prints out the actual values of the two unsigned char.
w | an unsigned char |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another unsigned char |
z | the string formated for output |
#define cester_assert_cmp_uint | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_uint_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two unsigned int using the provided operator This macro prints out the actual values of the two unsigned int.
w | an unsigned int |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another unsigned int |
z | the string formated for output |
#define cester_assert_cmp_ullong | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_ullong_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two unsigned long long using the provided operator This macro prints out the actual values of the two unsigned long long.
w | a unsigned long long |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another unsigned long long |
z | the string formated for output |
#define cester_assert_cmp_ulong | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_ulong_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two unsigned long using the provided operator This macro prints out the actual values of the two unsigned long.
w | a unsigned long |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another unsigned long |
z | the string formated for output |
#define cester_assert_cmp_ushort | ( | w, | |
x, | |||
y, | |||
z | |||
) | CESTER_CONCAT(cester_compare_ushort_pre_evaluated, __internal_cester_assert_cmp(w,x,y,z)) |
Compare two unsigned short using the provided operator This macro prints out the actual values of the two unsigned short.
w | an unsigned short |
x | the operator to use for the comparison. One of ==, !=, <, >, <=, >= |
y | another unsigned short |
z | the string formated for output |
#define cester_assert_double_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_double, __internal_cester_assert_eq(x,y,%lf)) |
Check if the two double are the same. This macro prints out the actual values of the two double.
x | a double |
y | another double |
#define cester_assert_double_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_double, __internal_cester_assert_ge(x,y,%lf)) |
Check if the a double is greater than or equal to the other. This macro prints out the actual values of the two double.
x | a double |
y | another double |
#define cester_assert_double_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_double, __internal_cester_assert_gt(x,y,%lf)) |
Check if the a double is greater than the other. This macro prints out the actual values of the two double.
x | a double |
y | another double |
#define cester_assert_double_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_double, __internal_cester_assert_le(x,y,%lf)) |
Check if the a double is lesser than or equal to the other. This macro prints out the actual values of the two double.
x | a double |
y | another double |
#define cester_assert_double_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_double, __internal_cester_assert_lt(x,y,%lf)) |
Check if the a double is lesser than the other. This macro prints out the actual values of the two double.
x | a double |
y | another double |
#define cester_assert_double_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_double, __internal_cester_assert_ne(x,y,%lf)) |
Check if the two double are not the same. This macro prints out the actual values of the two double.
x | a double |
y | another double |
#define cester_assert_equal | ( | x, | |
y | |||
) | cester_evaluate_expect_actual(x==y, 1, #x, #y, __FILE__, __LINE__) |
Assertion macro that passes if the two expression is equal. Prints the expression as in the source code
x | the first expression to compare |
y | the second expression to compare to the first expression |
#define cester_assert_false | ( | x | ) | cester_assert_cmp_msg(x, ==, 0, "(" #x ")") |
Check if the expression evaluates to false. Prints the expression as in the source code.
x | the expression to check if false |
#define cester_assert_false_msg | ( | x, | |
y | |||
) | cester_assert_cmp_msg(x, ==, 0, y) |
Check if the expression evaluates to false. Prints the second argument to the macro as the expression in output.
x | the expression to check if false |
y | the text to print out in output |
#define cester_assert_float_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_float, __internal_cester_assert_eq(x,y,%f)) |
Check if the two float are the same. This macro prints out the actual values of the two float.
x | a float |
y | another float |
#define cester_assert_float_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_float, __internal_cester_assert_ge(x,y,%f)) |
Check if the a float is greater than or equal to the other. This macro prints out the actual values of the two float.
x | a float |
y | another float |
#define cester_assert_float_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_float, __internal_cester_assert_gt(x,y,%f)) |
Check if the a float is greater than the other. This macro prints out the actual values of the two float.
x | a float |
y | another float |
#define cester_assert_float_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_float, __internal_cester_assert_le(x,y,%f)) |
Check if the a float is lesser than or equal to the other. This macro prints out the actual values of the two float.
x | a float |
y | another float |
#define cester_assert_float_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_float, __internal_cester_assert_lt(x,y,%f)) |
Check if the a float is lesser than the other. This macro prints out the actual values of the two float.
x | a float |
y | another float |
#define cester_assert_float_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_float, __internal_cester_assert_ne(x,y,%f)) |
Check if the two float are not the same. This macro prints out the actual values of the two float.
x | a float |
y | another float |
#define cester_assert_int_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_int, __internal_cester_assert_eq(x,y,%d)) |
Check if the two int are the same. This macro prints out the actual values of the two int.
x | an int |
y | another int |
#define cester_assert_int_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_int, __internal_cester_assert_ge(x,y,%d)) |
Check if the a int is greater than or equal to the other. This macro prints out the actual values of the two int.
x | an int |
y | another int |
#define cester_assert_int_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_int, __internal_cester_assert_gt(x,y,%d)) |
Check if the a int is greater than the other. This macro prints out the actual values of the two int.
x | an int |
y | another int |
#define cester_assert_int_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_int, __internal_cester_assert_le(x,y,%d)) |
Check if the a int is lesser than or equal to the other. This macro prints out the actual values of the two int.
x | an int |
y | another int |
#define cester_assert_int_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_int, __internal_cester_assert_lt(x,y,%d)) |
Check if the a int is lesser than the other. This macro prints out the actual values of the two int.
x | an int |
y | another int |
#define cester_assert_int_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_int, __internal_cester_assert_ne(x,y,%d)) |
Check if the two int are not the same. This macro prints out the actual values of the two int.
x | an int |
y | another int |
#define cester_assert_ldouble_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_eq(x,y,%e)) |
Check if the two long double are the same. This macro prints out the actual values of the two long double.
x | a long double |
y | another long double |
#define cester_assert_ldouble_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_ge(x,y,%e)) |
Check if the a long double is greater than or equal to the other. This macro prints out the actual values of the two long double.
x | a long double |
y | another long double |
#define cester_assert_ldouble_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_gt(x,y,%e)) |
Check if the a long double is greater than the other. This macro prints out the actual values of the two long double.
x | a long double |
y | another long double |
#define cester_assert_ldouble_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_le(x,y,%e)) |
Check if the a long double is lesser than or equal to the other. This macro prints out the actual values of the two long double.
x | a long double |
y | another long double |
#define cester_assert_ldouble_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_lt(x,y,%e)) |
Check if the a long double is lesser than the other. This macro prints out the actual values of the two long double.
x | a long double |
y | another long double |
#define cester_assert_ldouble_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ldouble, __internal_cester_assert_ne(x,y,%e)) |
Check if the two long double are not the same. This macro prints out the actual values of the two long double.
x | a long double |
y | another long double |
#define cester_assert_llong_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_eq(x,y,%li)) |
Check if the two long long are the same. This macro prints out the actual values of the two long long.
x | a long long |
y | another long long |
#define cester_assert_llong_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_ge(x,y,%li)) |
Check if the a long long is greater than or equal to the other. This macro prints out the actual values of the two long long.
x | a long long |
y | another long long |
#define cester_assert_llong_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_gt(x,y,%li)) |
Check if the a long long is greater than the other. This macro prints out the actual values of the two long long.
x | a long long |
y | another long long |
#define cester_assert_llong_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_ge(x,y,%li)) |
Check if the a long long is lesser than or equal to the other. This macro prints out the actual values of the two long long.
x | a long long |
y | another long long |
#define cester_assert_llong_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_lt(x,y,%li)) |
Check if the a long long is lesser than the other. This macro prints out the actual values of the two long long.
x | a long long |
y | another long long |
#define cester_assert_llong_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_llong, __internal_cester_assert_ne(x,y,%li)) |
Check if the two long long are not the same. This macro prints out the actual values of the two long long.
x | a long long |
y | another long long |
#define cester_assert_long_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_long, __internal_cester_assert_eq(x,y,%li)) |
Check if the two long are the same. This macro prints out the actual values of the two long.
x | a long |
y | another long |
#define cester_assert_long_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_long, __internal_cester_assert_ge(x,y,%li)) |
Check if the a long is greater than or equal to the other. This macro prints out the actual values of the two long.
x | a long |
y | another long |
#define cester_assert_long_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_long, __internal_cester_assert_gt(x,y,%li)) |
Check if the a long is greater than the other. This macro prints out the actual values of the two long.
x | a long |
y | another long |
#define cester_assert_long_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_long, __internal_cester_assert_le(x,y,%li)) |
Check if the a long is lesser than or equal to the other. This macro prints out the actual values of the two long.
x | a long |
y | another long |
#define cester_assert_long_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_long, __internal_cester_assert_lt(x,y,%li)) |
Check if the a long is lesser than the other. This macro prints out the actual values of the two long.
x | a long |
y | another long |
#define cester_assert_long_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_long, __internal_cester_assert_ne(x,y,%li)) |
Check if the two long are not the same. This macro prints out the actual values of the two long.
x | a long |
y | another long |
#define cester_assert_not_equal | ( | x, | |
y | |||
) | cester_evaluate_expect_actual(x!=y, 0, #x, #y, __FILE__, __LINE__) |
Assertion macro that passes if the two expression is not equal. Prints the expression as in the source code
x | the first expression to compare |
y | the second expression to compare to the first expression |
#define cester_assert_not_null | ( | x | ) | cester_assert_cmp_msg(x, !=, CESTER_NULL, "!(" #x ")") |
Assertion macro that passes if an expression is not CESTER_NULL. Prints the expression as in the source code.
x | the expression to check if it not CESTER_NULL. |
#define cester_assert_nothing | ( | ) |
Does nothing just an empty placeholder. Can be used in the CESTER_SKIP_TEST and CESTER_TODO_TEST when compiling with -ansi and -pedantic-errors flag
#define cester_assert_null | ( | x | ) | cester_assert_cmp_msg(x, ==, CESTER_NULL, "(" #x ")") |
Assertion macro that passes if an expression is CESTER_NULL. Prints the expression as in the source code.
x | the expression to check if it CESTER_NULL. |
#define cester_assert_printf_contain cester_assert_stdout_stream_content_contain |
Alias for cester_assert_stdout_stream_content_contain
#define cester_assert_printf_equal cester_assert_stdout_stream_content_equal |
Alias for cester_assert_stdout_stream_content_equal
#define cester_assert_printf_not_contain cester_assert_stdout_stream_content_not_contain |
Alias for cester_assert_stdout_stream_content_not_contain
#define cester_assert_printf_not_equal cester_assert_stdout_stream_content_not_equal |
Alias for cester_assert_stdout_stream_content_not_equal
#define cester_assert_ptr_eq cester_assert_ptr_equal |
alias for cester_assert_ptr_equal
#define cester_assert_ptr_equal | ( | x, | |
y | |||
) | cester_evaluate_expect_actual_ptr(x, y, #x, #y, 1, __FILE__, __LINE__) |
Compare two pointers. If the comparison fails the test case is marked as failed. The advantage of this macro is that it display the actual values of the two pointers.
x | a pointer to compare |
y | another pointer to compare with the first pointer |
#define cester_assert_ptr_ne cester_assert_ptr_not_equal |
alias for cester_assert_ptr_not_equal
#define cester_assert_ptr_not_equal | ( | x, | |
y | |||
) | cester_evaluate_expect_actual_ptr(x, y, #x, #y, 0, __FILE__, __LINE__) |
Compare two pointers. If the comparison passes the test case is marked as failed. The advantage of this macro is that it display the actual values of the two pointers.
x | a pointer to compare |
y | another pointer to compare with the first pointer |
#define cester_assert_short_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_short, __internal_cester_assert_eq(x,y,%hi)) |
Check if the two short are the same. This macro prints out the actual values of the two short.
x | a short |
y | another short |
#define cester_assert_short_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_short, __internal_cester_assert_ge(x,y,%hi)) |
Check if the a short is greater than or equal to the other. This macro prints out the actual values of the two short.
x | a short |
y | another short |
#define cester_assert_short_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_short, __internal_cester_assert_gt(x,y,%hi)) |
Check if the a short is greater than the other. This macro prints out the actual values of the two short.
x | a short |
y | another short |
#define cester_assert_short_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_short, __internal_cester_assert_le(x,y,%hi)) |
Check if the a short is lesser than or equal to the other. This macro prints out the actual values of the two short.
x | a short |
y | another short |
#define cester_assert_short_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_short, __internal_cester_assert_lt(x,y,%hi)) |
Check if the a short is lesser than the other. This macro prints out the actual values of the two short.
x | a short |
y | another short |
#define cester_assert_short_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_short, __internal_cester_assert_ne(x,y,%hi)) |
Check if the two short are not the same. This macro prints out the actual values of the two short.
x | a short |
y | another short |
#define cester_assert_stderr_stream_content_contain | ( | y | ) | cester_assert_true(cester_string_contains(CESTER_STDERR_CONTENT(), y)) |
Check whether the content of stderr stream contains a value
#define cester_assert_stderr_stream_content_equal | ( | y | ) | cester_assert_str_equal(CESTER_STDERR_CONTENT(), y) |
Check whether the content of stderr stream equals a value
#define cester_assert_stderr_stream_content_not_contain | ( | y | ) | cester_assert_false(cester_string_contains(CESTER_STDERR_CONTENT(), y)) |
Check whether the content of stderr stream does not contains a value
#define cester_assert_stderr_stream_content_not_equal | ( | y | ) | cester_assert_str_not_equal(CESTER_STDERR_CONTENT(), y) |
Check whether the content of stderr stream does not equals a value
#define cester_assert_stdin_stream_content_contain | ( | y | ) | cester_assert_true(cester_string_contains(CESTER_STDIN_CONTENT(), y)) |
Check whether the content of stdin stream contains a value
#define cester_assert_stdin_stream_content_equal | ( | y | ) | cester_assert_str_equal(CESTER_STDIN_CONTENT(), y) |
Check whether the content of stdin stream equals a value
#define cester_assert_stdin_stream_content_not_contain | ( | y | ) | cester_assert_false(cester_string_contains(CESTER_STDIN_CONTENT(), y)) |
Check whether the content of stdin stream does not contains a value
#define cester_assert_stdin_stream_content_not_equal | ( | y | ) | cester_assert_str_not_equal(CESTER_STDIN_CONTENT(), y) |
Check whether the content of stdin stream does not equals a value
#define cester_assert_stdout_stream_content_contain | ( | y | ) | cester_assert_true(cester_string_contains(CESTER_STDOUT_CONTENT(), y)) |
Check whether the content of stdout stream contains a value
#define cester_assert_stdout_stream_content_equal | ( | y | ) | cester_assert_str_equal(CESTER_STDOUT_CONTENT(), y) |
Check whether the content of stdout stream equals a value
#define cester_assert_stdout_stream_content_not_contain | ( | y | ) | cester_assert_false(cester_string_contains(CESTER_STDOUT_CONTENT(), y)) |
Check whether the content of stdout stream does not contains a value
#define cester_assert_stdout_stream_content_not_equal | ( | y | ) | cester_assert_str_not_equal(CESTER_STDOUT_CONTENT(), y) |
Check whether the content of stdout stream does not equals a value
#define cester_assert_str_eq cester_assert_str_equal |
alias for cester_assert_str_equal
#define cester_assert_str_equal | ( | x, | |
y | |||
) | cester_evaluate_expect_actual_str(x, y, #x, #y, 1, __FILE__, __LINE__) |
Compare two strings. If the comparison fails the test case is marked as failed. The advantage of this macro is that it display the actual values of the two strings.
x | a string to compare |
y | another string to compare with the first string |
#define cester_assert_str_ne cester_assert_str_not_equal |
alias for cester_assert_ptr_not_equal
#define cester_assert_str_not_equal | ( | x, | |
y | |||
) | cester_evaluate_expect_actual_str(x, y, #x, #y, 0, __FILE__, __LINE__) |
Compare two strings. If the comparison passes the test case is marked as failed. The advantage of this macro is that it display the actual values of the two strings.
x | a string to compare |
y | another string to compare with the first string |
#define cester_assert_stream_content_contain | ( | x, | |
y | |||
) | cester_assert_true(cester_string_contains(CESTER_STREAM_CONTENT(x), y)) |
Check whether the content of a stream contains a value
x | the stream |
y | the string to check if it present as the stream content |
#define cester_assert_stream_content_equal | ( | x, | |
y | |||
) | cester_assert_str_equal(CESTER_STREAM_CONTENT(x), y) |
Check whether the content of a stream equals a value
x | the stream |
y | the string to check if it same as the stream content |
#define cester_assert_stream_content_not_contain | ( | x, | |
y | |||
) | cester_assert_false(cester_string_contains(CESTER_STREAM_CONTENT(x), y)) |
Check whether the content of a stream does not contains a value
x | the stream |
y | the string to check if it not present as the stream content |
#define cester_assert_stream_content_not_equal | ( | x, | |
y | |||
) | cester_assert_str_not_equal(CESTER_STREAM_CONTENT(x), y) |
Check whether the content of a stream does not equal a value
x | the stream |
y | the string to check if it not same as the stream content |
#define cester_assert_true | ( | x | ) | cester_assert_cmp_msg(x, ==, 1, "(" #x ")") |
Check if the expression evaluates to true. Prints the expression as in the source code.
x | the expression to check if true |
#define cester_assert_true_msg | ( | x, | |
y | |||
) | cester_assert_cmp_msg(x, ==, 1, y) |
Check if the expression evaluates to true. Prints the second argument to the macro as the expression in output.
x | the expression to check if true |
y | the text to print out in output |
#define cester_assert_uchar_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_eq(x,y,%c)) |
Check if the two unsigned char are the same. This macro prints out the actual values of the two unsigned char.
x | an unsigned char |
y | another unsigned char |
#define cester_assert_uchar_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_ge(x,y,%c)) |
Check if the a unsigned char is greater than or equal to the other. This macro prints out the actual values of the two unsigned char.
x | an unsigned char |
y | another unsigned char |
#define cester_assert_uchar_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_gt(x,y,%c)) |
Check if the a unsigned char is greater than the other. This macro prints out the actual values of the two unsigned char.
x | an unsigned char |
y | another unsigned char |
#define cester_assert_uchar_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_le(x,y,%c)) |
Check if the a unsigned char is lesser than or equal to the other. This macro prints out the actual values of the two unsigned char.
x | an unsigned char |
y | another unsigned char |
#define cester_assert_uchar_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_lt(x,y,%c)) |
Check if the a unsigned char is lesser than the other. This macro prints out the actual values of the two unsigned char.
x | an unsigned char |
y | another unsigned char |
#define cester_assert_uchar_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uchar, __internal_cester_assert_ne(x,y,%c)) |
Check if the two unsigned char are not the same. This macro prints out the actual values of the two unsigned char.
x | an unsigned char |
y | another unsigned char |
#define cester_assert_uint_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_eq(x,y,%u)) |
Check if the two unsigned int are the same. This macro prints out the actual values of the two unsigned int.
x | an unsigned int |
y | another unsigned int |
#define cester_assert_uint_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_ge(x,y,%u)) |
Check if the a unsigned int is greater than or equal to the other. This macro prints out the actual values of the two unsigned int.
x | an unsigned int |
y | another unsigned int |
#define cester_assert_uint_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_gt(x,y,%u)) |
Check if the a unsigned int is greater than the other. This macro prints out the actual values of the two unsigned int.
x | an unsigned int |
y | another unsigned int |
#define cester_assert_uint_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_le(x,y,%u)) |
Check if the a unsigned int is lesser than or equal to the other. This macro prints out the actual values of the two unsigned int.
x | an unsigned int |
y | another unsigned int |
#define cester_assert_uint_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_lt(x,y,%u)) |
Check if the a unsigned int is lesser than the other. This macro prints out the actual values of the two unsigned int.
x | an unsigned int |
y | another unsigned int |
#define cester_assert_uint_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_uint, __internal_cester_assert_ne(x,y,%u)) |
Check if the two unsigned int are not the same. This macro prints out the actual values of the two unsigned int.
x | an unsigned int |
y | another unsigned int |
#define cester_assert_ullong_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_eq(x,y,%llu)) |
Check if the two unsigned long long are the same. This macro prints out the actual values of the two unsigned long long.
x | a unsigned long long |
y | another unsigned long long |
#define cester_assert_ullong_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_ge(x,y,%llu)) |
Check if the a unsigned long long is greater than or equal to the other. This macro prints out the actual values of the two unsigned long long.
x | a unsigned long long |
y | another unsigned long long |
#define cester_assert_ullong_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_gt(x,y,%llu)) |
Check if the a unsigned long long is greater than the other. This macro prints out the actual values of the two unsigned long long.
x | a unsigned long long |
y | another unsigned long long |
#define cester_assert_ullong_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_le(x,y,%llu)) |
Check if the a unsigned long long is lesser than or equal to the other. This macro prints out the actual values of the two unsigned long long.
x | a unsigned long long |
y | another unsigned long long |
#define cester_assert_ullong_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_lt(x,y,%llu)) |
Check if the a unsigned long long is lesser than the other. This macro prints out the actual values of the two unsigned long long.
x | a unsigned long long |
y | another unsigned long long |
#define cester_assert_ullong_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ullong, __internal_cester_assert_ne(x,y,%llu)) |
Check if the two unsigned long long are not the same. This macro prints out the actual values of the two unsigned long long.
x | a unsigned long long |
y | another unsigned long long |
#define cester_assert_ulong_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_eq(x,y,%lu)) |
Check if the two unsigned long are the same. This macro prints out the actual values of the two unsigned long.
x | a unsigned long |
y | another unsigned long |
#define cester_assert_ulong_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_ge(x,y,%lu)) |
Check if the a unsigned long is greater than or equal to the other. This macro prints out the actual values of the two unsigned long.
x | a unsigned long |
y | another unsigned long |
#define cester_assert_ulong_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_gt(x,y,%lu)) |
Check if the a unsigned long is greater than the other. This macro prints out the actual values of the two unsigned long.
x | a unsigned long |
y | another unsigned long |
#define cester_assert_ulong_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_le(x,y,%lu)) |
Check if the a unsigned long is lesser than or equal to the other. This macro prints out the actual values of the two unsigned long.
x | a unsigned long |
y | another unsigned long |
#define cester_assert_ulong_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_lt(x,y,%lu)) |
Check if the a unsigned long is lesser than the other. This macro prints out the actual values of the two unsigned long.
x | a unsigned long |
y | another unsigned long |
#define cester_assert_ulong_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ulong, __internal_cester_assert_ne(x,y,%lu)) |
Check if the two unsigned long are not the same. This macro prints out the actual values of the two unsigned long.
x | a unsigned long |
y | another unsigned long |
#define cester_assert_ushort_eq | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_eq(x,y,%hu)) |
Check if the two unsigned short are the same. This macro prints out the actual values of the two unsigned short.
x | an unsigned short |
y | another unsigned short |
#define cester_assert_ushort_ge | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_ge(x,y,%hu)) |
Check if the a unsigned short is greater than or equal to the other. This macro prints out the actual values of the two unsigned short.
x | an unsigned short |
y | another unsigned short |
#define cester_assert_ushort_gt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_gt(x,y,%hu)) |
Check if the a unsigned short is greater than the other. This macro prints out the actual values of the two unsigned short.
x | an unsigned short |
y | another unsigned short |
#define cester_assert_ushort_le | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_le(x,y,%hu)) |
Check if the a unsigned short is lesser than or equal to the other. This macro prints out the actual values of the two unsigned short.
x | an unsigned short |
y | another unsigned short |
#define cester_assert_ushort_lt | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_lt(x,y,%hu)) |
Check if the a unsigned short is lesser than the other. This macro prints out the actual values of the two unsigned short.
x | an unsigned short |
y | another unsigned short |
#define cester_assert_ushort_ne | ( | x, | |
y | |||
) | CESTER_CONCAT(cester_compare_ushort, __internal_cester_assert_ne(x,y,%hu)) |
Check if the two unsigned short are not the same. This macro prints out the actual values of the two unsigned short.
x | an unsigned short |
y | another unsigned short |
#define CESTER_AUTHOR "Adewale Azeez and other contributors" |
Cester Authors
#define CESTER_BACKGROUND_BLACK "\x1B[40m" |
black terminal background color
#define CESTER_BACKGROUND_BLUE "\x1B[44m" |
blue terminal background color
#define CESTER_BACKGROUND_CYAN "\x1B[46m" |
cyan terminal background color
#define CESTER_BACKGROUND_GRAY "\x1B[100m" |
gray terminal background color
#define CESTER_BACKGROUND_GREEN "\x1B[42m" |
green terminal background color
#define CESTER_BACKGROUND_MAGENTA "\x1B[45m" |
magenta terminal background color
#define CESTER_BACKGROUND_RED "\x1B[41m" |
red terminal background color
#define CESTER_BACKGROUND_WHITE "\x1B[47m" |
gray terminal background color
#define CESTER_BACKGROUND_YELLOW "\x1B[43m" |
yellow terminal background color
#define CESTER_BEFORE_ALL | ( | x, | |
y | |||
) | void cester_before_all_test(TestInstance* x); |
The function that would be invoked once before running any test in the test file. You can only have one of this function in a test file.
#define CESTER_BEFORE_ALL | ( | x, | |
y | |||
) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_before_all_test", (cester_before_all_test), CESTER_NULL, CESTER_NULL, CESTER_BEFORE_ALL_TEST }, |
The function that would be invoked once before running any test in the test file. You can only have one of this function in a test file.
#define CESTER_BEFORE_ALL | ( | x, | |
y | |||
) | void cester_before_all_test(TestInstance* x) { y CESTER_NO_ISOLATION(); } |
The function that would be invoked once before running any test in the test file. You can only have one of this function in a test file.
#define CESTER_BEFORE_EACH | ( | w, | |
x, | |||
y, | |||
z | |||
) | void cester_before_each_test(TestInstance* w, char * const x, unsigned y); |
The function that would be invoked before each test. You can only have one of this function in a test file.
#define CESTER_BEFORE_EACH | ( | w, | |
x, | |||
y, | |||
z | |||
) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) (char*) "", (char*) "cester_before_each_test", CESTER_NULL, (cester_before_each_test), CESTER_NULL, CESTER_BEFORE_EACH_TEST }, |
The function that would be invoked before each test. You can only have one of this function in a test file.
#define CESTER_BEFORE_EACH | ( | w, | |
x, | |||
y, | |||
z | |||
) | void cester_before_each_test(TestInstance* w, char * const x, unsigned y) { z CESTER_NO_ISOLATION(); } |
The function that would be invoked before each test. You can only have one of this function in a test file.
#define CESTER_BODY | ( | x | ) |
Absorb the statements and logic in a test file before re including the BASE_FILE. This way code can be written in the global space of the test file.
#define CESTER_BODY | ( | x | ) |
Absorb the statements and logic in a test file before re including the BASE_FILE. This way code can be written in the global space of the test file.
#define CESTER_BODY | ( | x | ) | x |
Absorb the statements and logic in a test file before re including the BASE_FILE. This way code can be written in the global space of the test file.
#define CESTER_BOLD "\x1B[1m" |
bold text
#define CESTER_CAPTURE_STDERR | ( | ) | CESTER_CAPTURE_STREAM(stderr) |
Capture the stderr stream
#define CESTER_CAPTURE_STDIN | ( | ) | CESTER_CAPTURE_STREAM(stdin) |
Capture the stdin stream that receive the input for the active program
#define CESTER_CAPTURE_STDOUT | ( | ) | CESTER_CAPTURE_STREAM(stdout) |
Capture the stdout stream where everything sent to printf is written into
#define CESTER_CAPTURE_STREAM | ( | x | ) | cester_capture_stream(x, __FILE__, __LINE__) |
Alias for cester_capture_stream function
#define CESTER_CHANGE_STREAM | ( | x | ) | { cester_ptr_to_str(&(superTestInstance.output_stream_str), x); superTestInstance.output_stream_address = *x; } (superTestInstance.output_stream = x) |
Change the output stream used by cester to write data. The default is stdout
. E.g to change the output stream to a file.
The code above changes the stream to a file test.txt, all the output from the test will be written in the file.
#define CESTER_CHANGE_STREAM_CAPTURE_TM_FOLDER | ( | x | ) | cester_set_captured_streams_tmp_folder(x, CESTER_NULL) |
Change the folder to use to store the FILE handle for the captured streams.
x | the new folder to used for captured stream |
#define CESTER_COMMENT | ( | x | ) | void cester_test_file_comment_function(void); |
A multiline comment macro everything in the macro is printed out at the beginning of the test.
Comma in the content will cause issue in the macro expansion when the code is compiled with C version less than C99.
It should not begin or end in quote, escape characters is expanded when printed out
#define CESTER_COMMENT | ( | x | ) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_test_file_comment_function", CESTER_NULL, CESTER_NULL, (cester_test_file_comment_function), CESTER_TEST_FILE_COMMENT }, |
A multiline comment macro everything in the macro is printed out at the beginning of the test.
Comma in the content will cause issue in the macro expansion when the code is compiled with C version less than C99.
It should not begin or end in quote, escape characters is expanded when printed out
#define CESTER_COMMENT | ( | x | ) | void cester_test_file_comment_function(void) { if (cester_string_equals(superTestInstance.output_format, (char*) "text") == 1) { CESTER_DELEGATE_FPRINT_STR((cester_default_color), "\n"); CESTER_DELEGATE_FPRINT_STR((cester_default_color), #x); CESTER_DELEGATE_FPRINT_STR((cester_default_color), "\n"); } } |
A multiline comment macro everything in the macro is printed out at the beginning of the test.
Comma in the content will cause issue in the macro expansion when the code is compiled with C version less than C99.
It should not begin or end in quote, escape characters is expanded when printed out
#define CESTER_CONCAT | ( | x, | |
y | |||
) | x y |
Concat two items including C macro directives.
#define CESTER_DEBUG_LEVEL | ( | x | ) | (superTestInstance.verbose_level = x) |
Change the verbose level of the output, the higher the velue the more the information printed into the terminal. 0 value means no output apart from the testcase's and value 4 and above prints the full path to the test file.
#define CESTER_DELEGATE_FPRINT | ( | y | ) | fprintf(superTestInstance.output_stream, "%s", y) |
#define CESTER_DELEGATE_FPRINT_DOUBLE | ( | x, | |
y | |||
) | fprintf(superTestInstance.output_stream, "%s%f%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define CESTER_DELEGATE_FPRINT_DOUBLE_2 | ( | x, | |
y | |||
) | fprintf(superTestInstance.output_stream, "%s%.2f%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define CESTER_DELEGATE_FPRINT_INT | ( | x, | |
y | |||
) | fprintf(superTestInstance.output_stream, "%s%d%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define CESTER_DELEGATE_FPRINT_PTR | ( | x, | |
y | |||
) | fprintf(superTestInstance.output_stream, "%s%p%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define CESTER_DELEGATE_FPRINT_STR | ( | x, | |
y | |||
) | fprintf(superTestInstance.output_stream, "%s%s%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define CESTER_DELEGATE_FPRINT_UINT | ( | x, | |
y | |||
) | fprintf(superTestInstance.output_stream, "%s%u%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL)) |
#define CESTER_DO_MEMTEST | ( | ) | (superTestInstance.mem_test_active = 1) |
Enable memory allocation. The combination of CESTER_NO_MEMTEST() and CESTER_DO_MEMTEST() is valid only in non isolated tests.
This togle combined with CESTER_NO_MEMTEST()
can be used to selectively test memory allocation in a test e.g. Calling CESTER_NO_MEMTEST() before a test case will prevent memory test from the beginning of that function and calling CESTER_DO_MEMTEST() at the end of the test case will ensure memory allocation will be validated in all the other test case that follows.
#define CESTER_DO_STREAMCAPTURE | ( | ) | (superTestInstance.stream_capture_active = 1) |
Enable stream capture features. The combination of CESTER_NO_STREAMCAPTURE() and CESTER_DO_STREAMCAPTURE() is valid only in non isolated tests.
This togle combined with CESTER_NO_STREAMCAPTURE()
can be used to selectively test stream capture and content in a test e.g. Calling CESTER_NO_STREAMCAPTURE() before a test case will prevent stream capturing from the beginning of that function and calling CESTER_DO_STREAMCAPTURE() at the end of the test case will ensure stream capturing will be enabled in all the other test case that follows.
#define CESTER_DONT_FORMAT_TESTNAME | ( | ) | superTestInstance.format_test_name = 0; |
Do not format the test case name, it remain the way it declared in the test source.
#define CESTER_FOREGROUND_BLACK "\x1B[30m" |
gray terminal foreground color
#define CESTER_FOREGROUND_BLUE "\x1B[34m" |
blue terminal foreground color
#define CESTER_FOREGROUND_CYAN "\x1B[36m" |
cyan terminal foreground color
#define CESTER_FOREGROUND_GRAY "\x1B[90m" |
gray terminal foreground color
#define CESTER_FOREGROUND_GREEN "\x1B[32m" |
green foreground color
#define CESTER_FOREGROUND_MAGENTA "\x1B[35m" |
magenta terminal foreground color
#define CESTER_FOREGROUND_RED "\x1B[31m" |
red terminal foreground color
#define CESTER_FOREGROUND_WHITE "\x1B[37m" |
white terminal foreground color
#define CESTER_FOREGROUND_YELLOW "\x1B[33m" |
yellow terminal foreground color
#define CESTER_FORMAT_TESTNAME | ( | ) | superTestInstance.format_test_name = 1; |
Format the test case name for output. E.g the test name modify_test_instance
becomes modify test instance
. This does not apply to junitxml as the test name remain the way it declared in the test source.
#define CESTER_GET_RESULT_AGGR (superTestInstance.total_failed_tests_count == 0 ? "SUCCESS" : "FAILURE") |
#define CESTER_GET_RESULT_AGGR_COLOR (superTestInstance.total_failed_tests_count == 0 ? (CESTER_FOREGROUND_GREEN) : (CESTER_FOREGROUND_RED)) |
#define CESTER_HASH_SIGN # |
The hash # symbol for macro directive
#define CESTER_INTERNAL_EVALUATE | ( | comparator_type, | |
x, | |||
y, | |||
result | |||
) |
#define CESTER_LICENSE "MIT License" |
Cester License
#define cester_meta_free | ( | x | ) | free(x); x = CESTER_NULL |
set pointer to null after free
#define CESTER_MINIMAL | ( | ) | (superTestInstance.verbose_level = 0) |
Print minimal info into the output stream. With this option set the expression evaluated will not be printed in the result output.
This option can also be set from the command line with --cester-minimal
or --cester-verbose-level=0
#define CESTER_MOCK_FUNCTION | ( | x, | |
y, | |||
z | |||
) | __attribute__((weak)) y x; extern y __real_##x; |
#define CESTER_MOCK_FUNCTION | ( | x, | |
y, | |||
z | |||
) |
#define CESTER_MOCK_FUNCTION | ( | x, | |
y, | |||
z | |||
) | y __wrap_##x { z } |
#define CESTER_MOCK_SIMPLE_FUNCTION | ( | x, | |
y, | |||
z | |||
) | __attribute__((weak)) y x; y __real_##x; |
Mock a function to just return a value. the first argument is the name of the function to mock, the second argument is the return type of the function, the third parameter is the value that is returned when the function is called.
This still requires using the -Wl,–wrap option to wrap the parameter to override the initial function. E.g. if the function multiply_by
is mocked the option -Wl,--wrap=multiply_by
should be added during compilation.
Th mocking features only works on GCC for now.
#define CESTER_MOCK_SIMPLE_FUNCTION | ( | x, | |
y, | |||
z | |||
) |
Mock a function to just return a value. the first argument is the name of the function to mock, the second argument is the return type of the function, the third parameter is the value that is returned when the function is called.
This still requires using the -Wl,–wrap option to wrap the parameter to override the initial function. E.g. if the function multiply_by
is mocked the option -Wl,--wrap=multiply_by
should be added during compilation.
Th mocking features only works on GCC for now.
#define CESTER_MOCK_SIMPLE_FUNCTION | ( | x, | |
y, | |||
z | |||
) | y __wrap_##x { return z; } |
Mock a function to just return a value. the first argument is the name of the function to mock, the second argument is the return type of the function, the third parameter is the value that is returned when the function is called.
This still requires using the -Wl,–wrap option to wrap the parameter to override the initial function. E.g. if the function multiply_by
is mocked the option -Wl,--wrap=multiply_by
should be added during compilation.
Th mocking features only works on GCC for now.
#define CESTER_NO_ISOLATION | ( | ) | (superTestInstance.isolate_tests = 0) |
Do not isolate the tests, run each of the test cases in a single process. The drawback is if a test case causes segfault or crash the entire test crashes and no summary is displayed. No isolation causes a crash one crash all scenerio.
This option can also be set from the command line with --cester-noisolation
#define CESTER_NO_MEMTEST | ( | ) | (superTestInstance.mem_test_active = 0) |
Disable memory leak detection test.
This option can also be set from the command line with --cester-nomemtest
#define CESTER_NO_STREAMCAPTURE | ( | ) | (superTestInstance.stream_capture_active = 0) |
Disable stream capture features.
This option can also be set from the command line with --cester-nostreamcapture
#define CESTER_NOCOLOR | ( | ) | (superTestInstance.no_color = 1) |
Do not print to the output stream with color. This should be used to prevent writing the color bytes into a file stream (in case).
This option can also be set from the command line with --cester-nocolor
#define CESTER_NULL 0L |
#define CESTER_OPTIONS | ( | x | ) | void cester_options_before_main(void); |
Set the options for cester, anything in this macro will be executed before the tests starts running.
#define CESTER_OPTIONS | ( | x | ) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) "cester_options_before_main", CESTER_NULL, CESTER_NULL, (cester_options_before_main), CESTER_OPTIONS_FUNCTION }, |
Set the options for cester, anything in this macro will be executed before the tests starts running.
#define CESTER_OPTIONS | ( | x | ) | void cester_options_before_main(void) { x } |
Set the options for cester, anything in this macro will be executed before the tests starts running.
#define CESTER_OUTPUT_JUNITXML | ( | ) | superTestInstance.output_format = (char*) "junitxml" |
Change the output format to junitxml
#define CESTER_OUTPUT_TAP | ( | ) | superTestInstance.output_format = (char*) "tap" |
Change the output format to TAP (Test Anything Protocol)
#define CESTER_OUTPUT_TAPV13 | ( | ) | superTestInstance.output_format = (char*) "tapV13" |
Change the output format to TAP (Test Anything Protocol) Version 13
#define CESTER_OUTPUT_TEXT | ( | ) | superTestInstance.output_format = (char*) "text" |
Change the output format to text
#define CESTER_PRINT_ERROR_ONLY | ( | x | ) | (superTestInstance.print_error_only = x) |
Change the option to print error only for the assertion. The default value is true. Change the value to false to print all the results.
The macro CESTER_VERBOSE also modify the value to false.
#define CESTER_PRINT_TEST_FUNCTION | ( | tab, | |
text_prefix, | |||
test_case | |||
) |
Print out the test case attribute in the output format
#define CESTER_PRINT_VERSION | ( | ) | (superTestInstance.print_version = 1) |
Print cester version before running any test.
This option can also be set from the command line with --cester-printversion
#define CESTER_REGISTER_AFTER_ALL | ( | ) | cester_register_test("cester_after_all_test", (cester_after_all_test), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_AFTER_ALL_TEST) |
Manually notify cester to execute the AFTER_ALL function to execute after all the test case are run.
#define CESTER_REGISTER_AFTER_EACH | ( | ) | cester_register_test("cester_after_each_test", CESTER_NULL, (cester_after_each_test), CESTER_NULL, __LINE__, CESTER_AFTER_EACH_TEST) |
Manually notify cester to execute the AFTER_EACH function to execute every time after a test case is run.
#define CESTER_REGISTER_BEFORE_ALL | ( | ) | cester_register_test("cester_before_all_test", (cester_before_all_test), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_BEFORE_ALL_TEST) |
Manually notify cester to execute the BEFORE_ALL function to execute before all the test case are run.
#define CESTER_REGISTER_BEFORE_EACH | ( | ) | cester_register_test("cester_before_each_test", CESTER_NULL, (cester_before_each_test), CESTER_NULL, __LINE__, CESTER_BEFORE_EACH_TEST) |
Manually notify cester to execute the BEFORE_EACH function to execute every time before a test case is run.
#define CESTER_REGISTER_COMMENT | ( | ) | cester_register_test("cester_test_file_comment_function", CESTER_NULL, CESTER_NULL, (cester_test_file_comment_function), __LINE__, CESTER_OPTIONS_FUNCTION) |
Manually notify cester to print the CESTER_COMMENT content before running the tests.
#define CESTER_REGISTER_OPTIONS | ( | ) | cester_register_test("cester_options_before_main", CESTER_NULL, CESTER_NULL, (cester_options_before_main), __LINE__, CESTER_OPTIONS_FUNCTION) |
Manually notify cester to execute the CESTER_OPTIONS block before running the tests.
#define CESTER_REGISTER_SKIP_TEST | ( | x | ) | cester_register_test((char*)#x, (cester_test_##x), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_NORMAL_SKIP_TEST) |
Manually register a test case as a skip test which cases the test case not to run but it will be reported in result and logged under skipped tests.
Reason for skipping a test can be unavailability of resources or any other reason.
#define CESTER_REGISTER_TEST | ( | x | ) | cester_register_test((char*)#x, (cester_test_##x), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_NORMAL_TEST) |
Manually register a test case in situation where the the test are not auto detected or selected test cases want to be run.
If a test is registered manually all auto detected test will not be executed.
#define CESTER_REGISTER_TODO_TEST | ( | x | ) | cester_register_test((char*)#x, (cester_test_##x), CESTER_NULL, CESTER_NULL, __LINE__, CESTER_NORMAL_TODO_TEST) |
Manually register a test case that is yet to be implemented so it will be skipped but it will be reported in result and logged under todo tests.
#define CESTER_RELEASE_STDERR | ( | ) | CESTER_RELEASE_STREAM(stderr) |
Release the stderr stream
#define CESTER_RELEASE_STDIN | ( | ) | CESTER_RELEASE_STREAM(stdin) |
Release the stdin stream that receive the input for the active program
#define CESTER_RELEASE_STDOUT | ( | ) | CESTER_RELEASE_STREAM(stdout) |
Release the stdout stream where everything sent to printf is written into
#define CESTER_RELEASE_STREAM | ( | x | ) | cester_release_stream(x, __FILE__, __LINE__) |
Alias for cester_release_stream function
#define CESTER_REPORT_FAILURE_REGARDLESS | ( | ) | (superTestInstance.report_success_regardless = 0); (superTestInstance.report_failure_regardless = 1) |
Always mark the test as failure even if the test cases passes and no error occur.
#define CESTER_REPORT_SUCCESS_REGARDLESS | ( | ) | (superTestInstance.report_failure_regardless = 0); (superTestInstance.report_success_regardless = 1) |
Always mark the test as success even if the test cases failed or an error occur while running the test.
#define CESTER_RESET_STDERR | ( | ) | CESTER_RESET_STREAM(stderr) |
Clear the stderr content.
#define CESTER_RESET_STDIN | ( | ) | CESTER_RESET_STREAM(stdin) |
Clear the stdin content.
#define CESTER_RESET_STDOUT | ( | ) | CESTER_RESET_STREAM(stdout) |
Clear the stdout content.
#define CESTER_RESET_STREAM | ( | x | ) | cester_reset_stream(x, __FILE__, __LINE__) |
Alias for cester_reset_stream function
#define CESTER_RESET_TERMINAL "\x1B[0m" |
reset the terminal color
#define CESTER_RESET_TERMINAL_ATTR | ( | ) | ; |
reset the terminal color
#define CESTER_RUN_ALL_TESTS | ( | x, | |
y | |||
) | cester_run_all_test(x,y) |
Run all the test registered in cester, the TestInstance* pointer will be initalized with the pointer to the string arguments from cli and the length of the arguments. The void* arg
pointer in the TestInstance* can be initalized in the *_BEFORE_* function to share data between the unit tests.
#define CESTER_SELECTCOLOR | ( | x | ) | (superTestInstance.no_color == 1 ? "" : x) |
#define CESTER_SINGLE_OUPUT_ONLY | ( | ) | (superTestInstance.single_output_only = 1) |
Display test for a single test case only, skip syntesis and summary.
This option can also be set from the command line with --cester-singleoutput
#define CESTER_SKIP_TEST | ( | x, | |
y, | |||
z | |||
) | static void cester_test_##x(TestInstance* y); |
Create a test case that is not run.
This uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_SKIP_TEST | ( | x, | |
y, | |||
z | |||
) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) #x, (cester_test_##x), CESTER_NULL, CESTER_NULL, CESTER_NORMAL_SKIP_TEST }, |
Create a test case that is not run.
This uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_SKIP_TEST | ( | x, | |
y, | |||
z | |||
) | static void cester_test_##x(TestInstance* y) { z } |
Create a test case that is not run.
This uses the first arguments as the test case name and identifier and the body of the test.
#define cester_sprintf | ( | x, | |
y, | |||
z, | |||
a, | |||
b | |||
) | sprintf(x, z, a, b); |
#define cester_sprintf1 | ( | x, | |
y, | |||
z, | |||
a | |||
) | sprintf(x, z, a) |
#define cester_sprintf2 | ( | x, | |
y, | |||
z, | |||
a, | |||
b | |||
) | sprintf(x, z, a, b) |
#define cester_sprintf3 | ( | x, | |
y, | |||
z, | |||
a, | |||
b, | |||
c | |||
) | sprintf(x, z, a, b, c) |
#define CESTER_STDERR_CONTENT | ( | ) | CESTER_STREAM_CONTENT(stderr) |
Get the stderr content.
#define CESTER_STDIN_CONTENT | ( | ) | CESTER_STREAM_CONTENT(stdin) |
Get the stdin content.
#define CESTER_STDOUT_CONTENT | ( | ) | CESTER_STREAM_CONTENT(stdout) |
Get the stdout content.
#define CESTER_STREAM_CONTENT | ( | x | ) | cester_stream_content(x, __FILE__, __LINE__) |
Alias for cester_stream_content function
#define cester_swallow | ( | param | ) |
Send the parameter into a black hole.
#define CESTER_TEST | ( | x, | |
y, | |||
z | |||
) | static void cester_test_##x(TestInstance* y); |
Create a test case, this uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_TEST | ( | x, | |
y, | |||
z | |||
) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) #x, (cester_test_##x), CESTER_NULL, CESTER_NULL, CESTER_NORMAL_TEST }, |
Create a test case, this uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_TEST | ( | x, | |
y, | |||
z | |||
) | static void cester_test_##x(TestInstance* y) { z } |
Create a test case, this uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_TEST_FUNTION_TYPE_TO_STRING | ( | test_type | ) |
Get the string value of the test type
#define CESTER_TEST_SHOULD | ( | x, | |
y | |||
) | cester_expected_test_result(#x, y); |
Set the expected result of a test case.
x | the test case name |
y | the expected result. Can be one of the cester_test_status enum |
#define CESTER_TEST_SHOULD_BE_TERMINATED | ( | x | ) | CESTER_TEST_SHOULD(x, CESTER_RESULT_TERMINATED); |
Change the expected test case result. If the test case is terminated by user or another program then it passes ortherwise it fails.
x | the test case name |
#define CESTER_TEST_SHOULD_FAIL | ( | x | ) | CESTER_TEST_SHOULD(x, CESTER_RESULT_FAILURE); |
Change the expected result of a test case to failure. If the test case passed then it marked as failure. If it failed then it consider as passed.
x | the test case name |
#define CESTER_TEST_SHOULD_LEAK_MEMORY | ( | x | ) | CESTER_TEST_SHOULD(x, CESTER_RESULT_MEMORY_LEAK); |
Change the expected test case result to leak memory. If the test case does not leak any memory then the test case is marked as failure.
x | the test case name |
#define CESTER_TEST_SHOULD_NOT_RELEASE_STREAM | ( | x | ) | CESTER_TEST_SHOULD(x, CESTER_RESULT_UNRELEASED_STREAM); |
Change the expected test case result. If the test case has any un released captured stream it passes.
Dont ignore CESTER_RESULT_UNRELEASED_STREAM failure it can result in more erros in other test cases and will leave dangling pointers in memory with no way to tract and free them.
x | the test case name |
#define CESTER_TEST_SHOULD_SEGFAULT | ( | x | ) | CESTER_TEST_SHOULD(x, CESTER_RESULT_SEGFAULT); |
Change the expected result of a test case to Segfault. If the test segfault then it passes. If it does not segfault it is marked as failed.
x | the test case name |
#define CESTER_TODO_TEST | ( | x, | |
y, | |||
z | |||
) | static void cester_test_##x(TestInstance* y); |
Create a test case that has not been implemented, It is skipped and generates warning. This macro will print message in output to remind the developer of it implementation. Good for TDD.
This uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_TODO_TEST | ( | x, | |
y, | |||
z | |||
) | { CESTER_RESULT_UNKNOWN, __LINE__, CESTER_RESULT_SUCCESS, 0.000, 0.000, (char*) "", (char*) #x, (cester_test_##x), CESTER_NULL, CESTER_NULL, CESTER_NORMAL_TODO_TEST }, |
Create a test case that has not been implemented, It is skipped and generates warning. This macro will print message in output to remind the developer of it implementation. Good for TDD.
This uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_TODO_TEST | ( | x, | |
y, | |||
z | |||
) | static void cester_test_##x(TestInstance* y) { } |
Create a test case that has not been implemented, It is skipped and generates warning. This macro will print message in output to remind the developer of it implementation. Good for TDD.
This uses the first arguments as the test case name and identifier and the body of the test.
#define CESTER_TOTAL_FAILED_TESTS_COUNT (superTestInstance.total_failed_tests_count) |
The total number of tests that failed.
#define CESTER_TOTAL_PASSED_TESTS_COUNT (superTestInstance.total_passed_tests_count) |
The total number of tests that passed. CESTER_TOTAL_TESTS_COUNT - CESTER_TOTAL_FAILED_TESTS_COUNT
#define CESTER_TOTAL_TEST_ERRORS_COUNT (superTestInstance.total_test_errors_count) |
The total number of errors that occur during the test.
The errors is not tied to the test cases, the error is tied to cester fixtures, environment error and error that occur outside a test case.
Error that occur within a test case is reported for that test case
#define CESTER_TOTAL_TESTS_COUNT (superTestInstance.total_tests_count) |
The total number of tests that is present in the test file.
#define CESTER_TOTAL_TESTS_RAN (superTestInstance.total_tests_ran) |
The total number of tests that was ran.
#define CESTER_TOTAL_TESTS_SKIPPED (superTestInstance.skipped_test_count) |
The number of test that was skipped.
If the selected test_cases_size is 0 then no test was skipped else the number of executed selected test cases minus the total number of test cases is the number of test that was skipped.
#define CESTER_TOTAL_TODO_TESTS (superTestInstance.todo_tests_count) |
The number of test that was marked as todo and skipped.
If the selected test_cases_size is 0 then no test was skipped else the number of executed selected test cases minus the total number of test cases is the number of test that was skipped.
#define CESTER_VERBOSE | ( | ) | (superTestInstance.verbose_level = 10); (superTestInstance.print_error_only = 0) |
Print as much info as possible into the output stream. With this option set
both passed and failed expression evaluated will be printed in the result.
This macro also set the value of print_error_only only to false to display output of all the assertions.
This option can also be set from the command line with --cester-verbose
or --cester-verbose-level=10
#define CESTER_VERBOSE_LEVEL | ( | x | ) | (superTestInstance.verbose_level = x) |
Deprecated. Use CESTER_DEBUG_LEVEL
#define CESTER_VERSION "0.4" |
Cester current version
#define CESTER_VERSION_NUM 0.4 |
Cester current version
#define EXOTIC_API extern |
Keyword to export the functions to allow ussage dynamically. NOT USED. IGNORED
#define EXOTICTYPES_WINDLLEXPORT 0 |
#define free | ( | x | ) | cester_free( x, __FILE__, __LINE__, __CESTER_FUNCTION__) |
Override the default free function for mem test
#define inline |
#define malloc | ( | x | ) | cester_allocator( 0, x, 0, __FILE__, __LINE__, __CESTER_FUNCTION__) |
Override the default malloc function for mem test
typedef struct allocated_memory AllocatedMemory |
typedef struct captured_stream CapturedStream |
The structure that manages the stream that has been captured by cester. It keeps record of the original stream and also of the stream that replaces the original, this way when a stream is to be released by cester it can simly set the original stream to it original state with no consequences and the extrac stream can be properlly freed.
typedef void(* cester_before_after_each) (TestInstance *, char *const, unsigned) |
The function signature for function to execute before and after each test cases. It accepts the test_instance, char* and unsigned as parameters.
typedef void(* cester_test) (TestInstance *) |
The function signature for each test case and the before after functions. It accepts the test_instance as it only argument.
typedef void(* cester_void) (void) |
A void function signature with no return type and no parameters.
typedef struct cester_array_struct CesterArray |
typedef struct super_test_instance SuperTestInstance |
This structure manages the BEFORE and AFTER functions for the test main test_instance. And also accounts for all the registered test cases. This is for Cester internal use only.
typedef struct test_instance TestInstance |
The test instance that contains the command line argument length and values, with void* pointer that can be used to share data between unit tests.
typedef enum cester_test_type TestType |
The type of caparison to perform on two values.
This is introduce to resolve the bug https://github.com/exoticlibraries/libcester/issues/30
enum cester_test_status |
The execution status of a test case that indicates whether a test passes of fails. And also enable the detection of the reason if a test fail.
enum cester_test_type |
void cester_capture_signals | ( | void | ) |
void cester_recover_on_signal | ( | int | sig_num | ) |
int main | ( | int | argc, |
char ** | argv | ||
) |
jmp_buf buf |
const char* cester_default_color = CESTER_RESET_TERMINAL |
SuperTestInstance superTestInstance |