![Ubuntu](https://github.com/stevengogogo/CProjectTemplate/actions/workflows/ci.yml/badge.svg)
![codecov](https://codecov.io/gh/stevengogogo/CProjectTemplate/branch/main/graph/badge.svg?token=5F6B6C9M1K)
![Doxygen Action](https://github.com/stevengogogo/CProjectTemplate/actions/workflows/doc.yml/badge.svg?branch=main)
![Dev](https://img.shields.io/badge/docs-dev-blue.svg)
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>
![Screen Shot 2021-02-25 at 3 04 42 PM](https://user-images.githubusercontent.com/29009898/109116029-db116d80-777a-11eb-883a-f10f599d5cc5.png)
Unit testing
![Screen Shot 2021-02-25 at 3 04 06 PM](https://user-images.githubusercontent.com/29009898/109116100-f7150f00-777a-11eb-9de0-88eaef70a222.png)
Set workspace to this project
![Workspace](https://user-images.githubusercontent.com/29009898/109115183-a5b85000-7779-11eb-97b2-1cde0b306cdb.png)
Use the debugger icon on VScode
![GDB usage](https://user-images.githubusercontent.com/29009898/109115199-abae3100-7779-11eb-8c21-bc4d98be52a7.png)
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