A project for demonstrating how to test C code with Google Test.
You need to install the following software in order to run this project
- git
- A C++14-compatible compiler (gcc or clang). Under Linux gcc is usually already installed by default.
- CMake v3.5 or higher (install via
sudo apt install cmake
) - Google Test (Installation instructions are given on the GitHub pages)
- Create a project folder:
cd ~
mkdir unit-test-demo
cd unit-test-demo
- Clone this repository with git:
git clone https://github.com/Jawan81/C-Unit-Test-Demo.git
- Create a build output directory:
mkdir build
cd build
- Run CMake to create the makefiles:
cmake ../C-Unit-Test-Demo
- Either
- build all build targets by just calling
make
- or choose your build target
- For building the unit tests run:
make runUnitTests
- for the example executable run:
make runMain
- For building the unit tests run:
- Run the executables
- For the unit tests run
tests/runUnitTests
- For the example application run
src/runMain