libcester is compliant with the original C language specification
ISO/IEC 9899:1990 and the first POSIX specification IEEE Std 1003.1-1988
which ensures the project compatibility in various environments including
embedded systems.
It also makes use of features in the newer revisions ISO/IEC 9899:1999
and IEEE Std 1003.1-2001 whenever possible.
With the stretched use of C preprocessor libcester in most cases does not require you to manually register your test cases, you just define your test with the provided macros and it will be executed.
libcester supports various output formats for test analysis. The following output formats are supported:
The documentation provides several examples,
tutorials, and detailed guides for using the library.
While reference provides a
low-level overview of all the implemented APIs in the library
Create functions that simulate the behaviour of the real function implementation.
Mocking function is useful when your unit tests relies on dependencies which are
not available at the time of running your tests.
Each test case is run in isolation which allows exceptions like a segfault,
premature termination e.t.c to be reported.
A crahsed test case does not cause the testing to stop instead the test case is
reported as failure and libcester continue running other test cases.
Each test cases accepts a test_instance
variable that can be used to share data across multiple test cases.
There are also CESTER_BEFORE_ALL, CESTER_BEFORE_EACH, CESTER_AFTER_EACH and
CESTER_AFTER_ALL macros to setup and tear down shared functions and objects use
in the test cases.
The library detects memory leak in the test cases without the need to run
program like valgrind. The precise amount of bytes leaked is reported for
each test case.
Memory leak test is optional and can be diabled with the option
--cester-nomemtest
This allows you to use the library freely in your open or closed source project. You also have the freedom to modify your version so far it provides the freedom MIT License stated.
#include <exotic/cester.h>
CESTER_BEFORE_ALL(test_instance,
test_instance->arg = (void*) "exoticlibs";
)
CESTER_TEST(test_assert_cmp_msg, test_instance,
cester_assert_cmp_msg(NULL, ==, ((void*)0), "Check if NULL is same as ((void*)0)");
cester_assert_cmp_msg(NULL, !=, "String", "is NULL equal to 'String'");
)
CESTER_TEST(test_string, test_instance,
cester_assert_str_equal((char*)test_instance->arg, "exoticlibs");
cester_assert_str_not_equal((char*)test_instance->arg, NULL);
)