Project template for C programming. Including debugging in VSCODE, makefile and Unit testing (+ Github CI)
make BUILD
make RUN
make TEST
- Clear structures
- Source and test
- Header file are organized under
src/include/
- Building with makfile
- Unit testing
- Organized by
runtests.c
- Use [
acutest.h
] (https://github.com/stevengogogo/CProjectTemplate/blob/main/test/acutest.h) debugging (Courtesy from mity/acutest)
- Organized by
- Debugger with VScode
- The configuration of debugger are supported under
.vscode
- The configuration of debugger are supported under
- Vscode
build-essentials
. (Installgdb
and xcode if you are using Mac)- Linux
- python3.8
- pip
pip intall quom
(for merging to single c file) [See https://github.com/Viatorus/quom]
make BUILD_RUN
make TEST
See issue for tutorial
- Run unit testing on every push and PR [Thank @sosiristseng]
- Merged to single
main.c
file when tagging or releasing. [Thank @sosiristseng]
-
The test file is set as
test/buil/test.out
-
If you want to test
main.c
, it can be set simply by modifying themakefile
-
Leakage during test
LEAK: TEST
valgrind --leak-check=full --show-leak-kinds=all --verbose ./test/build/test.out
- Leakage in
main.c
LEAK: BUILD
valgrind --leak-check=full --show-leak-kinds=all --verbose ./build/main.out
- noted that if
main.out
needs input. Use following command
LEAK: BUILD
valgrind --leak-check=full --show-leak-kinds=all --verbose ./build/main.out < path2data.in