Project template for C programming. Including debugging in VSCODE, makefile and Unit testing (+ Github CI)
Usage
make BUILD
make RUN
make TEST
Features
- Clear structures
- Unit testing
Debugger with VScode
- The configuration of debugger are supported under
.vscode
Prerequist
- Vscode
build-essentials
. (Install gdb
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]
How to use this C template
Build and Run with <tt>src/main.c</tt>
Unit testing
Set workspace to this project
Use the debugger icon on VScode
Gihub CD (Continuouse Documentation)
See issue for tutorial
Continuous Integration (CI)
- Run unit testing on every push and PR [Thank @sosiristseng]
Continusous Deployment (CD)
- Merged to single
main.c
file when tagging or releasing. [Thank @sosiristseng]
Memory Leak Detection with Valgrind
- The test file is set as
test/buil/test.out
- If you want to test
main.c
, it can be set simply by modifying the makefile
- 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