How to run unittest
You can run the unittest
in your local system.
- Create a directory -
lib/
and install Unity.
mkdir lib
git clone https://github.com/ThrowTheSwitch/Unity.git lib/
- Write the
unitiest
code insidetest/test_src
directory to test all functions of a specific library.- Make sure the
filename
starts withtest_
followed by thelibrary
name. - For example,
test_stack_singly_linkedlist_int.c
.
- Make sure the
- Run the test.
cd test/
make test TEST_LIB=stack_singly_linkedlist_int
-
It creates
test/test_build/<lib_name>/unittest/
directory and saves all test related artifacts over there. -
Clean the test artifacts
make clean TEST_LIB=stack_singly_linkedlist_int