Skip to content

A project template for testing C code with Google Test

License

Notifications You must be signed in to change notification settings

Jawan81/C-Unit-Test-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-Unit-Test-Demo

A project for demonstrating how to test C code with Google Test.

Prerequisites

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)

Building

  1. Create a project folder:
cd ~
mkdir unit-test-demo
cd unit-test-demo
  1. Clone this repository with git: git clone https://github.com/Jawan81/C-Unit-Test-Demo.git
  2. Create a build output directory:
mkdir build
cd build
  1. Run CMake to create the makefiles: cmake ../C-Unit-Test-Demo
  2. 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
  1. Run the executables
  • For the unit tests run tests/runUnitTests
  • For the example application run src/runMain

About

A project template for testing C code with Google Test

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published