libcester
Classes | Macros | Typedefs | Enumerations | Functions | Variables
cester.h File Reference
#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>
Include dependency graph for cester.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
 

Enumerations

enum  cester_assertion_caparator {
  CESTER_COMPARATOR_EQUAL, CESTER_COMPARATOR_NOT_EQUAL, CESTER_COMPARATOR_GREATER_THAN, CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL,
  CESTER_COMPARATOR_LESSER_THAN, CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL
}
 
enum  cester_test_status {
  CESTER_RESULT_SUCCESS, CESTER_RESULT_FAILURE, CESTER_RESULT_TERMINATED, CESTER_RESULT_SEGFAULT,
  CESTER_RESULT_UNRELEASED_STREAM, CESTER_RESULT_MEMORY_LEAK, CESTER_RESULT_TIMED_OUT, CESTER_RESULT_UNKNOWN
}
 
enum  cester_test_type {
  CESTER_NORMAL_TEST, CESTER_NORMAL_TODO_TEST, CESTER_NORMAL_SKIP_TEST, CESTER_BEFORE_ALL_TEST,
  CESTER_BEFORE_EACH_TEST, CESTER_AFTER_ALL_TEST, CESTER_AFTER_EACH_TEST, CESTER_OPTIONS_FUNCTION,
  CESTER_TEST_FILE_COMMENT, CESTER_TESTS_TERMINATOR
}
 

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
 

Detailed Description

Author
Adewale Azeez iamth.nosp@m.ecar.nosp@m.isma@.nosp@m.gmai.nosp@m.l.com
Date
10 April 2020

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.

Macro Definition Documentation

◆ __CESTER_CAST_CHAR_ARRAY__

#define __CESTER_CAST_CHAR_ARRAY__

◆ __CESTER_FUNCTION__

#define __CESTER_FUNCTION__   "<unknown>"

◆ __CESTER_INLINE__

#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.

◆ __CESTER_LONG_LONG__

#define __CESTER_LONG_LONG__   long

◆ __CESTER_LONG_LONG_FORMAT__

#define __CESTER_LONG_LONG_FORMAT__   "%ld"

◆ __internal_cester_assert_cmp

#define __internal_cester_assert_cmp (   w,
  x,
  y,
 
)    (w x y, z, w, y, #x, __FILE__, __LINE__)

◆ __internal_cester_assert_eq

#define __internal_cester_assert_eq (   x,
  y,
 
)    (CESTER_COMPARATOR_EQUAL, "expected " #z ",%s received " #z, y, x, "", __FILE__, __LINE__)

◆ __internal_cester_assert_ge

#define __internal_cester_assert_ge (   x,
  y,
 
)    (CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL, "expected value to be greater than or equal to " #z ",%s received " #z, x, y, "", __FILE__, __LINE__)

◆ __internal_cester_assert_gt

#define __internal_cester_assert_gt (   x,
  y,
 
)    (CESTER_COMPARATOR_GREATER_THAN, "expected value to be greater than " #z ",%s received " #z, x, y, "", __FILE__, __LINE__)

◆ __internal_cester_assert_le

#define __internal_cester_assert_le (   x,
  y,
 
)    (CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL, "expected value to be lesser than or equal to " #z ",%s received " #z, x, y, "", __FILE__, __LINE__)

◆ __internal_cester_assert_lt

#define __internal_cester_assert_lt (   x,
  y,
 
)    (CESTER_COMPARATOR_LESSER_THAN, "expected value to be lesser than " #z ",%s received " #z, x, y, "", __FILE__, __LINE__)

◆ __internal_cester_assert_ne

#define __internal_cester_assert_ne (   x,
  y,
 
)    (CESTER_COMPARATOR_NOT_EQUAL, "not expecting " #z ",%s found " #z, x, y, "", __FILE__, __LINE__)

◆ calloc

#define calloc (   x,
 
)    cester_allocator( x, y, 1, __FILE__, __LINE__, __CESTER_FUNCTION__)

Override the default malloc function for mem test

◆ CESTER_AFTER_ALL [1/3]

#define CESTER_AFTER_ALL (   x,
 
)    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.

◆ CESTER_AFTER_ALL [2/3]

#define CESTER_AFTER_ALL (   x,
 
)    { 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.

◆ CESTER_AFTER_ALL [3/3]

#define CESTER_AFTER_ALL (   x,
 
)    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.

◆ CESTER_AFTER_EACH [1/3]

#define CESTER_AFTER_EACH (   w,
  x,
  y,
 
)    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.

◆ CESTER_AFTER_EACH [2/3]

#define CESTER_AFTER_EACH (   w,
  x,
  y,
 
)    { 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.

◆ CESTER_AFTER_EACH [3/3]

#define CESTER_AFTER_EACH (   w,
  x,
  y,
 
)    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.

◆ CESTER_ARRAY_FOREACH

#define CESTER_ARRAY_FOREACH (   w,
  x,
  y,
 
)
Value:
for (x = 0; x < w->size; ++x) {\
void* y = w->buffer[x];\
z\
}

◆ CESTER_ARRAY_INITIAL_CAPACITY

#define CESTER_ARRAY_INITIAL_CAPACITY   30

The initial amount of item the CesterArray can accept the first time it initialized.

◆ CESTER_ARRAY_MAX_CAPACITY

#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.

◆ cester_assert_char_eq

#define cester_assert_char_eq (   x,
 
)    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.

Parameters
xa char
yanother char

◆ cester_assert_char_ge

#define cester_assert_char_ge (   x,
 
)    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.

Parameters
xa char
yanother char

◆ cester_assert_char_gt

#define cester_assert_char_gt (   x,
 
)    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.

Parameters
xa char
yanother char

◆ cester_assert_char_le

#define cester_assert_char_le (   x,
 
)    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.

Parameters
xa char
yanother char

◆ cester_assert_char_lt

#define cester_assert_char_lt (   x,
 
)    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.

Parameters
xa char
yanother char

◆ cester_assert_char_ne

#define cester_assert_char_ne (   x,
 
)    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.

Parameters
xa char
yanother char

◆ cester_assert_cmp

#define cester_assert_cmp (   x,
  y,
 
)    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

Parameters
xa value to compare to z
ythe operator to use for the comparison. One of ==, !=, <, >, <=, >=
za value to compare to x

◆ cester_assert_cmp_char

#define cester_assert_cmp_char (   w,
  x,
  y,
 
)    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.

Parameters
wa char
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother char
zthe string formated for output

◆ cester_assert_cmp_double

#define cester_assert_cmp_double (   w,
  x,
  y,
 
)    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.

Parameters
wa double
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother double
zthe string formated for output

◆ cester_assert_cmp_float

#define cester_assert_cmp_float (   w,
  x,
  y,
 
)    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.

Parameters
wa float
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother float
zthe string formated for output

◆ cester_assert_cmp_int

#define cester_assert_cmp_int (   w,
  x,
  y,
 
)    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.

Parameters
wan int
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother int
zthe string formated for output

◆ cester_assert_cmp_ldouble

#define cester_assert_cmp_ldouble (   w,
  x,
  y,
 
)    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.

Parameters
wa long double
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother long double
zthe string formated for output

◆ cester_assert_cmp_llong

#define cester_assert_cmp_llong (   w,
  x,
  y,
 
)    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.

Parameters
wa long long
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother long long
zthe string formated for output

◆ cester_assert_cmp_long

#define cester_assert_cmp_long (   w,
  x,
  y,
 
)    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.

Parameters
wa long
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother long
zthe string formated for output

◆ cester_assert_cmp_msg

#define cester_assert_cmp_msg (   w,
  x,
  y,
 
)    cester_evaluate_expression(w x y, z, __FILE__, __LINE__)

Compare two argument using the provided operator Prints the expression as in the source code

Parameters
wa value to compare to y
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
ya value to compare to w
zthe expression to print in output

◆ cester_assert_cmp_short

#define cester_assert_cmp_short (   w,
  x,
  y,
 
)    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.

Parameters
wa short
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother short
zthe string formated for output

◆ cester_assert_cmp_uchar

#define cester_assert_cmp_uchar (   w,
  x,
  y,
 
)    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.

Parameters
wan unsigned char
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother unsigned char
zthe string formated for output

◆ cester_assert_cmp_uint

#define cester_assert_cmp_uint (   w,
  x,
  y,
 
)    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.

Parameters
wan unsigned int
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother unsigned int
zthe string formated for output

◆ cester_assert_cmp_ullong

#define cester_assert_cmp_ullong (   w,
  x,
  y,
 
)    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.

Parameters
wa unsigned long long
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother unsigned long long
zthe string formated for output

◆ cester_assert_cmp_ulong

#define cester_assert_cmp_ulong (   w,
  x,
  y,
 
)    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.

Parameters
wa unsigned long
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother unsigned long
zthe string formated for output

◆ cester_assert_cmp_ushort

#define cester_assert_cmp_ushort (   w,
  x,
  y,
 
)    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.

Parameters
wan unsigned short
xthe operator to use for the comparison. One of ==, !=, <, >, <=, >=
yanother unsigned short
zthe string formated for output

◆ cester_assert_double_eq

#define cester_assert_double_eq (   x,
 
)    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.

Parameters
xa double
yanother double

◆ cester_assert_double_ge

#define cester_assert_double_ge (   x,
 
)    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.

Parameters
xa double
yanother double

◆ cester_assert_double_gt

#define cester_assert_double_gt (   x,
 
)    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.

Parameters
xa double
yanother double

◆ cester_assert_double_le

#define cester_assert_double_le (   x,
 
)    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.

Parameters
xa double
yanother double

◆ cester_assert_double_lt

#define cester_assert_double_lt (   x,
 
)    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.

Parameters
xa double
yanother double

◆ cester_assert_double_ne

#define cester_assert_double_ne (   x,
 
)    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.

Parameters
xa double
yanother double

◆ cester_assert_equal

#define cester_assert_equal (   x,
 
)    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

Parameters
xthe first expression to compare
ythe second expression to compare to the first expression

◆ cester_assert_false

#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.

Parameters
xthe expression to check if false

◆ cester_assert_false_msg

#define cester_assert_false_msg (   x,
 
)    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.

Parameters
xthe expression to check if false
ythe text to print out in output

◆ cester_assert_float_eq

#define cester_assert_float_eq (   x,
 
)    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.

Parameters
xa float
yanother float

◆ cester_assert_float_ge

#define cester_assert_float_ge (   x,
 
)    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.

Parameters
xa float
yanother float

◆ cester_assert_float_gt

#define cester_assert_float_gt (   x,
 
)    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.

Parameters
xa float
yanother float

◆ cester_assert_float_le

#define cester_assert_float_le (   x,
 
)    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.

Parameters
xa float
yanother float

◆ cester_assert_float_lt

#define cester_assert_float_lt (   x,
 
)    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.

Parameters
xa float
yanother float

◆ cester_assert_float_ne

#define cester_assert_float_ne (   x,
 
)    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.

Parameters
xa float
yanother float

◆ cester_assert_int_eq

#define cester_assert_int_eq (   x,
 
)    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.

Parameters
xan int
yanother int

◆ cester_assert_int_ge

#define cester_assert_int_ge (   x,
 
)    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.

Parameters
xan int
yanother int

◆ cester_assert_int_gt

#define cester_assert_int_gt (   x,
 
)    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.

Parameters
xan int
yanother int

◆ cester_assert_int_le

#define cester_assert_int_le (   x,
 
)    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.

Parameters
xan int
yanother int

◆ cester_assert_int_lt

#define cester_assert_int_lt (   x,
 
)    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.

Parameters
xan int
yanother int

◆ cester_assert_int_ne

#define cester_assert_int_ne (   x,
 
)    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.

Parameters
xan int
yanother int

◆ cester_assert_ldouble_eq

#define cester_assert_ldouble_eq (   x,
 
)    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.

Parameters
xa long double
yanother long double

◆ cester_assert_ldouble_ge

#define cester_assert_ldouble_ge (   x,
 
)    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.

Parameters
xa long double
yanother long double

◆ cester_assert_ldouble_gt

#define cester_assert_ldouble_gt (   x,
 
)    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.

Parameters
xa long double
yanother long double

◆ cester_assert_ldouble_le

#define cester_assert_ldouble_le (   x,
 
)    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.

Parameters
xa long double
yanother long double

◆ cester_assert_ldouble_lt

#define cester_assert_ldouble_lt (   x,
 
)    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.

Parameters
xa long double
yanother long double

◆ cester_assert_ldouble_ne

#define cester_assert_ldouble_ne (   x,
 
)    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.

Parameters
xa long double
yanother long double

◆ cester_assert_llong_eq

#define cester_assert_llong_eq (   x,
 
)    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.

Parameters
xa long long
yanother long long

◆ cester_assert_llong_ge

#define cester_assert_llong_ge (   x,
 
)    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.

Parameters
xa long long
yanother long long

◆ cester_assert_llong_gt

#define cester_assert_llong_gt (   x,
 
)    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.

Parameters
xa long long
yanother long long

◆ cester_assert_llong_le

#define cester_assert_llong_le (   x,
 
)    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.

Parameters
xa long long
yanother long long

◆ cester_assert_llong_lt

#define cester_assert_llong_lt (   x,
 
)    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.

Parameters
xa long long
yanother long long

◆ cester_assert_llong_ne

#define cester_assert_llong_ne (   x,
 
)    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.

Parameters
xa long long
yanother long long

◆ cester_assert_long_eq

#define cester_assert_long_eq (   x,
 
)    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.

Parameters
xa long
yanother long

◆ cester_assert_long_ge

#define cester_assert_long_ge (   x,
 
)    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.

Parameters
xa long
yanother long

◆ cester_assert_long_gt

#define cester_assert_long_gt (   x,
 
)    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.

Parameters
xa long
yanother long

◆ cester_assert_long_le

#define cester_assert_long_le (   x,
 
)    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.

Parameters
xa long
yanother long

◆ cester_assert_long_lt

#define cester_assert_long_lt (   x,
 
)    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.

Parameters
xa long
yanother long

◆ cester_assert_long_ne

#define cester_assert_long_ne (   x,
 
)    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.

Parameters
xa long
yanother long

◆ cester_assert_not_equal

#define cester_assert_not_equal (   x,
 
)    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

Parameters
xthe first expression to compare
ythe second expression to compare to the first expression

◆ cester_assert_not_null

#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.

Parameters
xthe expression to check if it not CESTER_NULL.

◆ cester_assert_nothing

#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

◆ cester_assert_null

#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.

Parameters
xthe expression to check if it CESTER_NULL.

◆ cester_assert_printf_contain

#define cester_assert_printf_contain   cester_assert_stdout_stream_content_contain

Alias for cester_assert_stdout_stream_content_contain

◆ cester_assert_printf_equal

#define cester_assert_printf_equal   cester_assert_stdout_stream_content_equal

Alias for cester_assert_stdout_stream_content_equal

◆ cester_assert_printf_not_contain

#define cester_assert_printf_not_contain   cester_assert_stdout_stream_content_not_contain

Alias for cester_assert_stdout_stream_content_not_contain

◆ cester_assert_printf_not_equal

#define cester_assert_printf_not_equal   cester_assert_stdout_stream_content_not_equal

Alias for cester_assert_stdout_stream_content_not_equal

◆ cester_assert_ptr_eq

#define cester_assert_ptr_eq   cester_assert_ptr_equal

alias for cester_assert_ptr_equal

◆ cester_assert_ptr_equal

#define cester_assert_ptr_equal (   x,
 
)    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.

Parameters
xa pointer to compare
yanother pointer to compare with the first pointer

◆ cester_assert_ptr_ne

#define cester_assert_ptr_ne   cester_assert_ptr_not_equal

alias for cester_assert_ptr_not_equal

◆ cester_assert_ptr_not_equal

#define cester_assert_ptr_not_equal (   x,
 
)    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.

Parameters
xa pointer to compare
yanother pointer to compare with the first pointer

◆ cester_assert_short_eq

#define cester_assert_short_eq (   x,
 
)    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.

Parameters
xa short
yanother short

◆ cester_assert_short_ge

#define cester_assert_short_ge (   x,
 
)    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.

Parameters
xa short
yanother short

◆ cester_assert_short_gt

#define cester_assert_short_gt (   x,
 
)    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.

Parameters
xa short
yanother short

◆ cester_assert_short_le

#define cester_assert_short_le (   x,
 
)    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.

Parameters
xa short
yanother short

◆ cester_assert_short_lt

#define cester_assert_short_lt (   x,
 
)    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.

Parameters
xa short
yanother short

◆ cester_assert_short_ne

#define cester_assert_short_ne (   x,
 
)    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.

Parameters
xa short
yanother short

◆ cester_assert_stderr_stream_content_contain

#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

◆ cester_assert_stderr_stream_content_equal

#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

◆ cester_assert_stderr_stream_content_not_contain

#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

◆ cester_assert_stderr_stream_content_not_equal

#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

◆ cester_assert_stdin_stream_content_contain

#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

◆ cester_assert_stdin_stream_content_equal

#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

◆ cester_assert_stdin_stream_content_not_contain

#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

◆ cester_assert_stdin_stream_content_not_equal

#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

◆ cester_assert_stdout_stream_content_contain

#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

◆ cester_assert_stdout_stream_content_equal

#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

◆ cester_assert_stdout_stream_content_not_contain

#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

◆ cester_assert_stdout_stream_content_not_equal

#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

◆ cester_assert_str_eq

#define cester_assert_str_eq   cester_assert_str_equal

alias for cester_assert_str_equal

◆ cester_assert_str_equal

#define cester_assert_str_equal (   x,
 
)    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.

Parameters
xa string to compare
yanother string to compare with the first string

◆ cester_assert_str_ne

#define cester_assert_str_ne   cester_assert_str_not_equal

alias for cester_assert_ptr_not_equal

◆ cester_assert_str_not_equal

#define cester_assert_str_not_equal (   x,
 
)    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.

Parameters
xa string to compare
yanother string to compare with the first string

◆ cester_assert_stream_content_contain

#define cester_assert_stream_content_contain (   x,
 
)    cester_assert_true(cester_string_contains(CESTER_STREAM_CONTENT(x), y))

Check whether the content of a stream contains a value

Parameters
xthe stream
ythe string to check if it present as the stream content

◆ cester_assert_stream_content_equal

#define cester_assert_stream_content_equal (   x,
 
)    cester_assert_str_equal(CESTER_STREAM_CONTENT(x), y)

Check whether the content of a stream equals a value

Parameters
xthe stream
ythe string to check if it same as the stream content

◆ cester_assert_stream_content_not_contain

#define cester_assert_stream_content_not_contain (   x,
 
)    cester_assert_false(cester_string_contains(CESTER_STREAM_CONTENT(x), y))

Check whether the content of a stream does not contains a value

Parameters
xthe stream
ythe string to check if it not present as the stream content

◆ cester_assert_stream_content_not_equal

#define cester_assert_stream_content_not_equal (   x,
 
)    cester_assert_str_not_equal(CESTER_STREAM_CONTENT(x), y)

Check whether the content of a stream does not equal a value

Parameters
xthe stream
ythe string to check if it not same as the stream content

◆ cester_assert_true

#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.

Parameters
xthe expression to check if true

◆ cester_assert_true_msg

#define cester_assert_true_msg (   x,
 
)    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.

Parameters
xthe expression to check if true
ythe text to print out in output

◆ cester_assert_uchar_eq

#define cester_assert_uchar_eq (   x,
 
)    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.

Parameters
xan unsigned char
yanother unsigned char

◆ cester_assert_uchar_ge

#define cester_assert_uchar_ge (   x,
 
)    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.

Parameters
xan unsigned char
yanother unsigned char

◆ cester_assert_uchar_gt

#define cester_assert_uchar_gt (   x,
 
)    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.

Parameters
xan unsigned char
yanother unsigned char

◆ cester_assert_uchar_le

#define cester_assert_uchar_le (   x,
 
)    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.

Parameters
xan unsigned char
yanother unsigned char

◆ cester_assert_uchar_lt

#define cester_assert_uchar_lt (   x,
 
)    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.

Parameters
xan unsigned char
yanother unsigned char

◆ cester_assert_uchar_ne

#define cester_assert_uchar_ne (   x,
 
)    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.

Parameters
xan unsigned char
yanother unsigned char

◆ cester_assert_uint_eq

#define cester_assert_uint_eq (   x,
 
)    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.

Parameters
xan unsigned int
yanother unsigned int

◆ cester_assert_uint_ge

#define cester_assert_uint_ge (   x,
 
)    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.

Parameters
xan unsigned int
yanother unsigned int

◆ cester_assert_uint_gt

#define cester_assert_uint_gt (   x,
 
)    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.

Parameters
xan unsigned int
yanother unsigned int

◆ cester_assert_uint_le

#define cester_assert_uint_le (   x,
 
)    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.

Parameters
xan unsigned int
yanother unsigned int

◆ cester_assert_uint_lt

#define cester_assert_uint_lt (   x,
 
)    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.

Parameters
xan unsigned int
yanother unsigned int

◆ cester_assert_uint_ne

#define cester_assert_uint_ne (   x,
 
)    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.

Parameters
xan unsigned int
yanother unsigned int

◆ cester_assert_ullong_eq

#define cester_assert_ullong_eq (   x,
 
)    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.

Parameters
xa unsigned long long
yanother unsigned long long

◆ cester_assert_ullong_ge

#define cester_assert_ullong_ge (   x,
 
)    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.

Parameters
xa unsigned long long
yanother unsigned long long

◆ cester_assert_ullong_gt

#define cester_assert_ullong_gt (   x,
 
)    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.

Parameters
xa unsigned long long
yanother unsigned long long

◆ cester_assert_ullong_le

#define cester_assert_ullong_le (   x,
 
)    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.

Parameters
xa unsigned long long
yanother unsigned long long

◆ cester_assert_ullong_lt

#define cester_assert_ullong_lt (   x,
 
)    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.

Parameters
xa unsigned long long
yanother unsigned long long

◆ cester_assert_ullong_ne

#define cester_assert_ullong_ne (   x,
 
)    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.

Parameters
xa unsigned long long
yanother unsigned long long

◆ cester_assert_ulong_eq

#define cester_assert_ulong_eq (   x,
 
)    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.

Parameters
xa unsigned long
yanother unsigned long

◆ cester_assert_ulong_ge

#define cester_assert_ulong_ge (   x,
 
)    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.

Parameters
xa unsigned long
yanother unsigned long

◆ cester_assert_ulong_gt

#define cester_assert_ulong_gt (   x,
 
)    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.

Parameters
xa unsigned long
yanother unsigned long

◆ cester_assert_ulong_le

#define cester_assert_ulong_le (   x,
 
)    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.

Parameters
xa unsigned long
yanother unsigned long

◆ cester_assert_ulong_lt

#define cester_assert_ulong_lt (   x,
 
)    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.

Parameters
xa unsigned long
yanother unsigned long

◆ cester_assert_ulong_ne

#define cester_assert_ulong_ne (   x,
 
)    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.

Parameters
xa unsigned long
yanother unsigned long

◆ cester_assert_ushort_eq

#define cester_assert_ushort_eq (   x,
 
)    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.

Parameters
xan unsigned short
yanother unsigned short

◆ cester_assert_ushort_ge

#define cester_assert_ushort_ge (   x,
 
)    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.

Parameters
xan unsigned short
yanother unsigned short

◆ cester_assert_ushort_gt

#define cester_assert_ushort_gt (   x,
 
)    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.

Parameters
xan unsigned short
yanother unsigned short

◆ cester_assert_ushort_le

#define cester_assert_ushort_le (   x,
 
)    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.

Parameters
xan unsigned short
yanother unsigned short

◆ cester_assert_ushort_lt

#define cester_assert_ushort_lt (   x,
 
)    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.

Parameters
xan unsigned short
yanother unsigned short

◆ cester_assert_ushort_ne

#define cester_assert_ushort_ne (   x,
 
)    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.

Parameters
xan unsigned short
yanother unsigned short

◆ CESTER_AUTHOR

#define CESTER_AUTHOR   "Adewale Azeez and other contributors"

Cester Authors

◆ CESTER_BACKGROUND_BLACK

#define CESTER_BACKGROUND_BLACK   "\x1B[40m"

black terminal background color

◆ CESTER_BACKGROUND_BLUE

#define CESTER_BACKGROUND_BLUE   "\x1B[44m"

blue terminal background color

◆ CESTER_BACKGROUND_CYAN

#define CESTER_BACKGROUND_CYAN   "\x1B[46m"

cyan terminal background color

◆ CESTER_BACKGROUND_GRAY

#define CESTER_BACKGROUND_GRAY   "\x1B[100m"

gray terminal background color

◆ CESTER_BACKGROUND_GREEN

#define CESTER_BACKGROUND_GREEN   "\x1B[42m"

green terminal background color

◆ CESTER_BACKGROUND_MAGENTA

#define CESTER_BACKGROUND_MAGENTA   "\x1B[45m"

magenta terminal background color

◆ CESTER_BACKGROUND_RED

#define CESTER_BACKGROUND_RED   "\x1B[41m"

red terminal background color

◆ CESTER_BACKGROUND_WHITE

#define CESTER_BACKGROUND_WHITE   "\x1B[47m"

gray terminal background color

◆ CESTER_BACKGROUND_YELLOW

#define CESTER_BACKGROUND_YELLOW   "\x1B[43m"

yellow terminal background color

◆ CESTER_BEFORE_ALL [1/3]

#define CESTER_BEFORE_ALL (   x,
 
)    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.

◆ CESTER_BEFORE_ALL [2/3]

#define CESTER_BEFORE_ALL (   x,
 
)    { 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.

◆ CESTER_BEFORE_ALL [3/3]

#define CESTER_BEFORE_ALL (   x,
 
)    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.

◆ CESTER_BEFORE_EACH [1/3]

#define CESTER_BEFORE_EACH (   w,
  x,
  y,
 
)    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.

◆ CESTER_BEFORE_EACH [2/3]

#define CESTER_BEFORE_EACH (   w,
  x,
  y,
 
)    { 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.

◆ CESTER_BEFORE_EACH [3/3]

#define CESTER_BEFORE_EACH (   w,
  x,
  y,
 
)    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.

◆ CESTER_BODY [1/3]

#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.

Note
do not put other CESTER_ macros inside this one, this should contain only your C or C++ code.

◆ CESTER_BODY [2/3]

#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.

Note
do not put other CESTER_ macros inside this one, this should contain only your C or C++ code.

◆ CESTER_BODY [3/3]

#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.

Note
do not put other CESTER_ macros inside this one, this should contain only your C or C++ code.

◆ CESTER_BOLD

#define CESTER_BOLD   "\x1B[1m"

bold text

◆ CESTER_CAPTURE_STDERR

#define CESTER_CAPTURE_STDERR ( )    CESTER_CAPTURE_STREAM(stderr)

Capture the stderr stream

◆ CESTER_CAPTURE_STDIN

#define CESTER_CAPTURE_STDIN ( )    CESTER_CAPTURE_STREAM(stdin)

Capture the stdin stream that receive the input for the active program

◆ CESTER_CAPTURE_STDOUT

#define CESTER_CAPTURE_STDOUT ( )    CESTER_CAPTURE_STREAM(stdout)

Capture the stdout stream where everything sent to printf is written into

◆ CESTER_CAPTURE_STREAM

#define CESTER_CAPTURE_STREAM (   x)    cester_capture_stream(x, __FILE__, __LINE__)

Alias for cester_capture_stream function

◆ CESTER_CHANGE_STREAM

#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.

CESTER_CHANGE_STREAM(fopen("./test.txt", "w+"));

The code above changes the stream to a file test.txt, all the output from the test will be written in the file.

◆ CESTER_CHANGE_STREAM_CAPTURE_TM_FOLDER

#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.

Parameters
xthe new folder to used for captured stream

◆ CESTER_COMMENT [1/3]

#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

◆ CESTER_COMMENT [2/3]

#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

◆ CESTER_COMMENT [3/3]

#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

◆ CESTER_CONCAT

#define CESTER_CONCAT (   x,
 
)    x y

Concat two items including C macro directives.

◆ CESTER_DEBUG_LEVEL

#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.

◆ CESTER_DELEGATE_FPRINT

#define CESTER_DELEGATE_FPRINT (   y)    fprintf(superTestInstance.output_stream, "%s", y)

◆ CESTER_DELEGATE_FPRINT_DOUBLE

#define CESTER_DELEGATE_FPRINT_DOUBLE (   x,
 
)    fprintf(superTestInstance.output_stream, "%s%f%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL))

◆ CESTER_DELEGATE_FPRINT_DOUBLE_2

#define CESTER_DELEGATE_FPRINT_DOUBLE_2 (   x,
 
)    fprintf(superTestInstance.output_stream, "%s%.2f%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL))

◆ CESTER_DELEGATE_FPRINT_INT

#define CESTER_DELEGATE_FPRINT_INT (   x,
 
)    fprintf(superTestInstance.output_stream, "%s%d%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL))

◆ CESTER_DELEGATE_FPRINT_PTR

#define CESTER_DELEGATE_FPRINT_PTR (   x,
 
)    fprintf(superTestInstance.output_stream, "%s%p%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL))

◆ CESTER_DELEGATE_FPRINT_STR

#define CESTER_DELEGATE_FPRINT_STR (   x,
 
)    fprintf(superTestInstance.output_stream, "%s%s%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL))

◆ CESTER_DELEGATE_FPRINT_UINT

#define CESTER_DELEGATE_FPRINT_UINT (   x,
 
)    fprintf(superTestInstance.output_stream, "%s%u%s", CESTER_SELECTCOLOR(x), y, CESTER_SELECTCOLOR(CESTER_RESET_TERMINAL))

◆ CESTER_DO_MEMTEST

#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.

◆ CESTER_DO_STREAMCAPTURE

#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.

◆ CESTER_DONT_FORMAT_TESTNAME

#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.

◆ CESTER_FOREGROUND_BLACK

#define CESTER_FOREGROUND_BLACK   "\x1B[30m"

gray terminal foreground color

◆ CESTER_FOREGROUND_BLUE

#define CESTER_FOREGROUND_BLUE   "\x1B[34m"

blue terminal foreground color

◆ CESTER_FOREGROUND_CYAN

#define CESTER_FOREGROUND_CYAN   "\x1B[36m"

cyan terminal foreground color

◆ CESTER_FOREGROUND_GRAY

#define CESTER_FOREGROUND_GRAY   "\x1B[90m"

gray terminal foreground color

◆ CESTER_FOREGROUND_GREEN

#define CESTER_FOREGROUND_GREEN   "\x1B[32m"

green foreground color

◆ CESTER_FOREGROUND_MAGENTA

#define CESTER_FOREGROUND_MAGENTA   "\x1B[35m"

magenta terminal foreground color

◆ CESTER_FOREGROUND_RED

#define CESTER_FOREGROUND_RED   "\x1B[31m"

red terminal foreground color

◆ CESTER_FOREGROUND_WHITE

#define CESTER_FOREGROUND_WHITE   "\x1B[37m"

white terminal foreground color

◆ CESTER_FOREGROUND_YELLOW

#define CESTER_FOREGROUND_YELLOW   "\x1B[33m"

yellow terminal foreground color

◆ CESTER_FORMAT_TESTNAME

#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.

◆ CESTER_GET_RESULT_AGGR

#define CESTER_GET_RESULT_AGGR   (superTestInstance.total_failed_tests_count == 0 ? "SUCCESS" : "FAILURE")

◆ CESTER_GET_RESULT_AGGR_COLOR

#define CESTER_GET_RESULT_AGGR_COLOR   (superTestInstance.total_failed_tests_count == 0 ? (CESTER_FOREGROUND_GREEN) : (CESTER_FOREGROUND_RED))

◆ CESTER_HASH_SIGN

#define CESTER_HASH_SIGN   #

The hash # symbol for macro directive

◆ CESTER_INTERNAL_EVALUATE

#define CESTER_INTERNAL_EVALUATE (   comparator_type,
  x,
  y,
  result 
)
Value:
{\
if (comparator_type == CESTER_COMPARATOR_EQUAL) {\
result = (x == y);\
} else if (comparator_type == CESTER_COMPARATOR_NOT_EQUAL) {\
result = (x != y);\
} else if (comparator_type == CESTER_COMPARATOR_GREATER_THAN) {\
result = (x > y);\
} else if (comparator_type == CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL) {\
result = (x >= y);\
} else if (comparator_type == CESTER_COMPARATOR_LESSER_THAN) {\
result = (x < y);\
} else if (comparator_type == CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL) {\
result = (x <= y);\
} else {\
result = (x == y);\
}\
}

◆ CESTER_LICENSE

#define CESTER_LICENSE   "MIT License"

Cester License

◆ cester_meta_free

#define cester_meta_free (   x)    free(x); x = CESTER_NULL

set pointer to null after free

◆ CESTER_MINIMAL

#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

◆ CESTER_MOCK_FUNCTION [1/3]

#define CESTER_MOCK_FUNCTION (   x,
  y,
 
)    __attribute__((weak)) y x; extern y __real_##x;

◆ CESTER_MOCK_FUNCTION [2/3]

#define CESTER_MOCK_FUNCTION (   x,
  y,
 
)

◆ CESTER_MOCK_FUNCTION [3/3]

#define CESTER_MOCK_FUNCTION (   x,
  y,
 
)    y __wrap_##x { z }

◆ CESTER_MOCK_SIMPLE_FUNCTION [1/3]

#define CESTER_MOCK_SIMPLE_FUNCTION (   x,
  y,
 
)    __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.

◆ CESTER_MOCK_SIMPLE_FUNCTION [2/3]

#define CESTER_MOCK_SIMPLE_FUNCTION (   x,
  y,
 
)

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.

◆ CESTER_MOCK_SIMPLE_FUNCTION [3/3]

#define CESTER_MOCK_SIMPLE_FUNCTION (   x,
  y,
 
)    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.

◆ CESTER_NO_ISOLATION

#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

◆ CESTER_NO_MEMTEST

#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

◆ CESTER_NO_STREAMCAPTURE

#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

◆ CESTER_NOCOLOR

#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

◆ CESTER_NULL

#define CESTER_NULL   0L

◆ CESTER_OPTIONS [1/3]

#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.

◆ CESTER_OPTIONS [2/3]

#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.

◆ CESTER_OPTIONS [3/3]

#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.

◆ CESTER_OUTPUT_JUNITXML

#define CESTER_OUTPUT_JUNITXML ( )    superTestInstance.output_format = (char*) "junitxml"

Change the output format to junitxml

◆ CESTER_OUTPUT_TAP

#define CESTER_OUTPUT_TAP ( )    superTestInstance.output_format = (char*) "tap"

Change the output format to TAP (Test Anything Protocol)

◆ CESTER_OUTPUT_TAPV13

#define CESTER_OUTPUT_TAPV13 ( )    superTestInstance.output_format = (char*) "tapV13"

Change the output format to TAP (Test Anything Protocol) Version 13

◆ CESTER_OUTPUT_TEXT

#define CESTER_OUTPUT_TEXT ( )    superTestInstance.output_format = (char*) "text"

Change the output format to text

◆ CESTER_PRINT_ERROR_ONLY

#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.

◆ CESTER_PRINT_TEST_FUNCTION

#define CESTER_PRINT_TEST_FUNCTION (   tab,
  text_prefix,
  test_case 
)
Value:
if (cester_string_equals(superTestInstance.output_format, (char*) "junitxml")) {\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_BLUE), "" tab "<function");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_RED), " name=");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_MAGENTA), "\"");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_MAGENTA), test_case.name);\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_MAGENTA), "\"");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_RED), " line_number=");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_MAGENTA), "\"");\
CESTER_DELEGATE_FPRINT_INT((CESTER_FOREGROUND_MAGENTA), test_case.line_num);\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_MAGENTA), "\"");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_RED), " type=");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_MAGENTA), "\"");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_MAGENTA), "\"");\
CESTER_DELEGATE_FPRINT_STR((CESTER_FOREGROUND_BLUE), "/>\n");\
} else {\
CESTER_DELEGATE_FPRINT(text_prefix); CESTER_DELEGATE_FPRINT(test_case.name);\
if (!cester_string_equals(info_section, "all")) CESTER_DELEGATE_FPRINT("\n");\
}

Print out the test case attribute in the output format

◆ CESTER_PRINT_VERSION

#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

◆ CESTER_REGISTER_AFTER_ALL

#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.

◆ CESTER_REGISTER_AFTER_EACH

#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.

◆ CESTER_REGISTER_BEFORE_ALL

#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.

◆ CESTER_REGISTER_BEFORE_EACH

#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.

◆ CESTER_REGISTER_COMMENT

#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.

◆ CESTER_REGISTER_OPTIONS

#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.

◆ CESTER_REGISTER_SKIP_TEST

#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.

◆ CESTER_REGISTER_TEST

#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.

◆ CESTER_REGISTER_TODO_TEST

#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.

◆ CESTER_RELEASE_STDERR

#define CESTER_RELEASE_STDERR ( )    CESTER_RELEASE_STREAM(stderr)

Release the stderr stream

◆ CESTER_RELEASE_STDIN

#define CESTER_RELEASE_STDIN ( )    CESTER_RELEASE_STREAM(stdin)

Release the stdin stream that receive the input for the active program

◆ CESTER_RELEASE_STDOUT

#define CESTER_RELEASE_STDOUT ( )    CESTER_RELEASE_STREAM(stdout)

Release the stdout stream where everything sent to printf is written into

◆ CESTER_RELEASE_STREAM

#define CESTER_RELEASE_STREAM (   x)    cester_release_stream(x, __FILE__, __LINE__)

Alias for cester_release_stream function

◆ CESTER_REPORT_FAILURE_REGARDLESS

#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.

◆ CESTER_REPORT_SUCCESS_REGARDLESS

#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.

◆ CESTER_RESET_STDERR

#define CESTER_RESET_STDERR ( )    CESTER_RESET_STREAM(stderr)

Clear the stderr content.

◆ CESTER_RESET_STDIN

#define CESTER_RESET_STDIN ( )    CESTER_RESET_STREAM(stdin)

Clear the stdin content.

◆ CESTER_RESET_STDOUT

#define CESTER_RESET_STDOUT ( )    CESTER_RESET_STREAM(stdout)

Clear the stdout content.

◆ CESTER_RESET_STREAM

#define CESTER_RESET_STREAM (   x)    cester_reset_stream(x, __FILE__, __LINE__)

Alias for cester_reset_stream function

◆ CESTER_RESET_TERMINAL

#define CESTER_RESET_TERMINAL   "\x1B[0m"

reset the terminal color

◆ CESTER_RESET_TERMINAL_ATTR

#define CESTER_RESET_TERMINAL_ATTR ( )    ;

reset the terminal color

◆ CESTER_RUN_ALL_TESTS

#define CESTER_RUN_ALL_TESTS (   x,
 
)    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.

◆ CESTER_SELECTCOLOR

#define CESTER_SELECTCOLOR (   x)    (superTestInstance.no_color == 1 ? "" : x)

◆ CESTER_SINGLE_OUPUT_ONLY

#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

◆ CESTER_SKIP_TEST [1/3]

#define CESTER_SKIP_TEST (   x,
  y,
 
)    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.

◆ CESTER_SKIP_TEST [2/3]

#define CESTER_SKIP_TEST (   x,
  y,
 
)    { 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.

◆ CESTER_SKIP_TEST [3/3]

#define CESTER_SKIP_TEST (   x,
  y,
 
)    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.

◆ cester_sprintf

#define cester_sprintf (   x,
  y,
  z,
  a,
 
)    sprintf(x, z, a, b);

◆ cester_sprintf1

#define cester_sprintf1 (   x,
  y,
  z,
 
)    sprintf(x, z, a)

◆ cester_sprintf2

#define cester_sprintf2 (   x,
  y,
  z,
  a,
 
)    sprintf(x, z, a, b)

◆ cester_sprintf3

#define cester_sprintf3 (   x,
  y,
  z,
  a,
  b,
 
)    sprintf(x, z, a, b, c)

◆ CESTER_STDERR_CONTENT

#define CESTER_STDERR_CONTENT ( )    CESTER_STREAM_CONTENT(stderr)

Get the stderr content.

◆ CESTER_STDIN_CONTENT

#define CESTER_STDIN_CONTENT ( )    CESTER_STREAM_CONTENT(stdin)

Get the stdin content.

◆ CESTER_STDOUT_CONTENT

#define CESTER_STDOUT_CONTENT ( )    CESTER_STREAM_CONTENT(stdout)

Get the stdout content.

◆ CESTER_STREAM_CONTENT

#define CESTER_STREAM_CONTENT (   x)    cester_stream_content(x, __FILE__, __LINE__)

Alias for cester_stream_content function

◆ cester_swallow

#define cester_swallow (   param)

Send the parameter into a black hole.

◆ CESTER_TEST [1/3]

#define CESTER_TEST (   x,
  y,
 
)    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.

◆ CESTER_TEST [2/3]

#define CESTER_TEST (   x,
  y,
 
)    { 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.

◆ CESTER_TEST [3/3]

#define CESTER_TEST (   x,
  y,
 
)    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.

◆ CESTER_TEST_FUNTION_TYPE_TO_STRING

#define CESTER_TEST_FUNTION_TYPE_TO_STRING (   test_type)
Value:
(test_type == CESTER_NORMAL_TEST ? "CESTER_NORMAL_TEST" :\
(test_type == CESTER_NORMAL_TODO_TEST ? "CESTER_NORMAL_TODO_TEST" :\
(test_type == CESTER_NORMAL_SKIP_TEST ? "CESTER_NORMAL_SKIP_TEST" :\
(test_type == CESTER_BEFORE_ALL_TEST ? "CESTER_BEFORE_ALL_TEST" :\
(test_type == CESTER_BEFORE_EACH_TEST ? "CESTER_BEFORE_EACH_TEST" :\
(test_type == CESTER_AFTER_ALL_TEST ? "CESTER_AFTER_ALL_TEST" :\
(test_type == CESTER_AFTER_EACH_TEST ? "CESTER_AFTER_EACH_TEST" :\
(test_type == CESTER_OPTIONS_FUNCTION ? "CESTER_OPTIONS_FUNCTION" :\
(test_type == CESTER_TEST_FILE_COMMENT ? "CESTER_TEST_FILE_COMMENT" : "CESTER_TESTS_TERMINATOR")))))))))

Get the string value of the test type

◆ CESTER_TEST_SHOULD

#define CESTER_TEST_SHOULD (   x,
 
)    cester_expected_test_result(#x, y);

Set the expected result of a test case.

Parameters
xthe test case name
ythe expected result. Can be one of the cester_test_status enum

◆ CESTER_TEST_SHOULD_BE_TERMINATED

#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.

Parameters
xthe test case name

◆ CESTER_TEST_SHOULD_FAIL

#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.

Parameters
xthe test case name

◆ CESTER_TEST_SHOULD_LEAK_MEMORY

#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.

Parameters
xthe test case name

◆ CESTER_TEST_SHOULD_NOT_RELEASE_STREAM

#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.

Parameters
xthe test case name

◆ CESTER_TEST_SHOULD_SEGFAULT

#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.

Parameters
xthe test case name

◆ CESTER_TODO_TEST [1/3]

#define CESTER_TODO_TEST (   x,
  y,
 
)    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.

◆ CESTER_TODO_TEST [2/3]

#define CESTER_TODO_TEST (   x,
  y,
 
)    { 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.

◆ CESTER_TODO_TEST [3/3]

#define CESTER_TODO_TEST (   x,
  y,
 
)    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.

◆ CESTER_TOTAL_FAILED_TESTS_COUNT

#define CESTER_TOTAL_FAILED_TESTS_COUNT   (superTestInstance.total_failed_tests_count)

The total number of tests that failed.

◆ CESTER_TOTAL_PASSED_TESTS_COUNT

#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

◆ CESTER_TOTAL_TEST_ERRORS_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

◆ CESTER_TOTAL_TESTS_COUNT

#define CESTER_TOTAL_TESTS_COUNT   (superTestInstance.total_tests_count)

The total number of tests that is present in the test file.

◆ CESTER_TOTAL_TESTS_RAN

#define CESTER_TOTAL_TESTS_RAN   (superTestInstance.total_tests_ran)

The total number of tests that was ran.

◆ CESTER_TOTAL_TESTS_SKIPPED

#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.

◆ CESTER_TOTAL_TODO_TESTS

#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.

◆ CESTER_VERBOSE

#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

◆ CESTER_VERBOSE_LEVEL

#define CESTER_VERBOSE_LEVEL (   x)    (superTestInstance.verbose_level = x)

Deprecated. Use CESTER_DEBUG_LEVEL

◆ CESTER_VERSION

#define CESTER_VERSION   "0.4"

Cester current version

◆ CESTER_VERSION_NUM

#define CESTER_VERSION_NUM   0.4

Cester current version

◆ EXOTIC_API

#define EXOTIC_API   extern

Keyword to export the functions to allow ussage dynamically. NOT USED. IGNORED

◆ EXOTICTYPES_WINDLLEXPORT

#define EXOTICTYPES_WINDLLEXPORT   0

◆ free

#define free (   x)    cester_free( x, __FILE__, __LINE__, __CESTER_FUNCTION__)

Override the default free function for mem test

◆ inline

#define inline

◆ malloc

#define malloc (   x)    cester_allocator( 0, x, 0, __FILE__, __LINE__, __CESTER_FUNCTION__)

Override the default malloc function for mem test

Typedef Documentation

◆ AllocatedMemory

◆ 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.

◆ cester_before_after_each

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.

◆ cester_test

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.

◆ cester_void

typedef void(* cester_void) (void)

A void function signature with no return type and no parameters.

◆ CesterArray

◆ 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.

◆ TestCase

typedef struct test_case TestCase

◆ TestInstance

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.

◆ TestType

typedef enum cester_test_type TestType

Enumeration Type Documentation

◆ cester_assertion_caparator

The type of caparison to perform on two values.

This is introduce to resolve the bug https://github.com/exoticlibraries/libcester/issues/30

Enumerator
CESTER_COMPARATOR_EQUAL 

the comparisson operator is '=='

CESTER_COMPARATOR_NOT_EQUAL 

the comparisson operator is '!='

CESTER_COMPARATOR_GREATER_THAN 

the comparisson operator is '>'

CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL 

the comparisson operator is '>='

CESTER_COMPARATOR_LESSER_THAN 

the comparisson operator is '<'

CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL 

the comparisson operator is '<='

◆ 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.

Enumerator
CESTER_RESULT_SUCCESS 

the test case passed

CESTER_RESULT_FAILURE 

the test case failes dues to various reason mostly AssertionError

CESTER_RESULT_TERMINATED 

in isolated test, the test case was termiated by a user or another program

CESTER_RESULT_SEGFAULT 

the test case crahses or causes segmentation fault

CESTER_RESULT_UNRELEASED_STREAM 

the test case has unreleased streams

CESTER_RESULT_MEMORY_LEAK 

the test case passes or fails but failed to free allocated memory

CESTER_RESULT_TIMED_OUT 

cester terminated the test case because it running for too long

CESTER_RESULT_UNKNOWN 

the test case was never ran

◆ cester_test_type

Enumerator
CESTER_NORMAL_TEST 

normal test in global or test suite. For internal use only.

CESTER_NORMAL_TODO_TEST 

test to be implemented in future. For internal use only.

CESTER_NORMAL_SKIP_TEST 

test to be skipped. For internal use only.

CESTER_BEFORE_ALL_TEST 

test to run before all normal tests in global or test suite. For internal use only.

CESTER_BEFORE_EACH_TEST 

test to run before each normal tests in global or test suite. For internal use only.

CESTER_AFTER_ALL_TEST 

test to run after all normal tests in global or test suite. For internal use only.

CESTER_AFTER_EACH_TEST 

test to run after each normal tests in global or test suite. For internal use only.

CESTER_OPTIONS_FUNCTION 

the cester function for test, this wil be excuted before running the tests. For internal use only.

CESTER_TEST_FILE_COMMENT 

The function that holds the text defined in the CESTER_COMMENT macro. For internal use only.

CESTER_TESTS_TERMINATOR 

the last value in the test cases to terminates the tests. For internal use only.

Function Documentation

◆ cester_capture_signals()

void cester_capture_signals ( void  )

◆ cester_recover_on_signal()

void cester_recover_on_signal ( int  sig_num)

◆ main()

int main ( int  argc,
char **  argv 
)

Variable Documentation

◆ buf

jmp_buf buf

◆ cester_default_color

const char* cester_default_color = CESTER_RESET_TERMINAL

◆ superTestInstance

SuperTestInstance superTestInstance
CESTER_NORMAL_TODO_TEST
@ CESTER_NORMAL_TODO_TEST
Definition: cester.h:261
CESTER_TEST_FUNTION_TYPE_TO_STRING
#define CESTER_TEST_FUNTION_TYPE_TO_STRING(test_type)
Definition: cester.h:5021
CESTER_OPTIONS_FUNCTION
@ CESTER_OPTIONS_FUNCTION
Definition: cester.h:267
test_case::name
char * name
Definition: cester.h:333
CESTER_FOREGROUND_RED
#define CESTER_FOREGROUND_RED
Definition: cester.h:176
CESTER_NORMAL_TEST
@ CESTER_NORMAL_TEST
Definition: cester.h:260
CESTER_FOREGROUND_BLUE
#define CESTER_FOREGROUND_BLUE
Definition: cester.h:179
CESTER_COMPARATOR_GREATER_THAN
@ CESTER_COMPARATOR_GREATER_THAN
Definition: cester.h:235
CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL
@ CESTER_COMPARATOR_GREATER_THAN_OR_EQUAL
Definition: cester.h:236
super_test_instance::output_format
char * output_format
Definition: cester.h:412
CESTER_AFTER_ALL_TEST
@ CESTER_AFTER_ALL_TEST
Definition: cester.h:265
CESTER_AFTER_EACH_TEST
@ CESTER_AFTER_EACH_TEST
Definition: cester.h:266
CESTER_BEFORE_ALL_TEST
@ CESTER_BEFORE_ALL_TEST
Definition: cester.h:263
CESTER_BEFORE_EACH_TEST
@ CESTER_BEFORE_EACH_TEST
Definition: cester.h:264
test_case::line_num
unsigned line_num
Definition: cester.h:326
CESTER_DELEGATE_FPRINT
#define CESTER_DELEGATE_FPRINT(y)
Definition: cester.h:1092
CESTER_FOREGROUND_MAGENTA
#define CESTER_FOREGROUND_MAGENTA
Definition: cester.h:180
test_case
Definition: cester.h:324
CESTER_TEST_FILE_COMMENT
@ CESTER_TEST_FILE_COMMENT
Definition: cester.h:268
CESTER_COMPARATOR_NOT_EQUAL
@ CESTER_COMPARATOR_NOT_EQUAL
Definition: cester.h:234
CESTER_CHANGE_STREAM
#define CESTER_CHANGE_STREAM(x)
Definition: cester.h:519
superTestInstance
SuperTestInstance superTestInstance
Definition: cester.h:441
test_case::test_type
TestType test_type
Definition: cester.h:337
CESTER_NORMAL_SKIP_TEST
@ CESTER_NORMAL_SKIP_TEST
Definition: cester.h:262
CESTER_COMPARATOR_EQUAL
@ CESTER_COMPARATOR_EQUAL
Definition: cester.h:233
CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL
@ CESTER_COMPARATOR_LESSER_THAN_OR_EQUAL
Definition: cester.h:238
CESTER_COMPARATOR_LESSER_THAN
@ CESTER_COMPARATOR_LESSER_THAN
Definition: cester.h:237