This is an example git repository for a tutorial of the subpatch. You can find the tutorial here: Basic usage.
The project is a very tiny C-library that contains a add
function that just
adds two integers together. The project contains the following files
libadd.c
: Implementation of the library functioninclude/libadd/main.h
: Single header of the libraryprog.c
: Example program use the librarytest.cc
: Tests for the library
To build the project, execute the commands
$ cmake -B build .
$ cmake --build build
The program reads two integers as arguments from the command line and uses the library function to add them together. The result is printed on the console. Example:
$ build/prog 5 6
11
Some tests are already implement in the file test.c
, but not yet useable. In
the tutorial you add the dependency to
googletest . After that the tests are
working.
How to execute the tests:
$ cmake --build build # build again after adding the dependency
$ build/test
Resolve TODOs in prog.c