diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..4d73a7b --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +lily +==== + +**lily** is a testing library for C. It provides both basic assertions as well as mocking. + +To incorporate lily into a project, just copy `lily-test.h` and `lily-test.c` into your +source code. + + +usage +----- + +The function `lily_init()` must be called exactly once before any other lily +functions may be called. + +Tests are simply functions with the signature `void ()`. Each test can contain +any of the following assertion messages: + +* `lily_assert_true(bool)` +* `lily_assert_false(bool)` +* `lily_assert_not_null(void *)` +* `lily_assert_null(void *)` +* `lily_assert_ptr_equal(void *, void *)` +* `lily_assert_ptr_not_equal(void *, void *)` +* `lily_assert_int_equal(int, int)` +* `lily_assert_int_not_equal(int, int)` +* `lily_assert_float_equal(float, float, float epsilon)` +* `lily_assert_float_not_equal(float, float, float epsilon)` +* `lily_assert_string_equal(char *, char *)` +* `lily_assert_string_not_equal(char *, char *)` +* `lily_assert_memory_equal(void *, void *, size_t size)` +* `lily_assert_memory_not_equal(void *, void *, size_t size)` + +Tests are run via the macro `lily_run_test(test_func)`. A test suite is simply a `void ()` +function that runs some tests. Suites can be called via the macro `lily_run_suite(suite_func)`. + +A small script, called `prepare-tests.sh` is provided. It will automatically scan +the given source root for all files matching `*.test.c` and qenerate a header file, +main function, and Makefile to run all of the functions matching `void ()` in those +test files. (If you want a utility function or something, just make it `static`). +This script relies on POSIX utilities -- sorry, Windows users. :l + |