openpgp-card-app/unit-tests
Charles-Edouard de la Vergne eab32ad7af
Add Unit Tests
2024-02-14 09:29:17 +01:00
..
mocks Add Unit Tests 2024-02-14 09:29:17 +01:00
src Add Unit Tests 2024-02-14 09:29:17 +01:00
CMakeLists.txt Add Unit Tests 2024-02-14 09:29:17 +01:00
gen_coverage.sh Add Unit Tests 2024-02-14 09:29:17 +01:00
README.md Add Unit Tests 2024-02-14 09:29:17 +01:00

Unit tests

Prerequisite

Be sure to have installed:

  • CMake >= 3.10
  • CMocka >= 1.1.5

and for code coverage generation:

  • lcov >= 1.14

Overview

In unit-tests folder, compile with:

cmake -Bbuild -H. && make -C build

and run tests with:

CTEST_OUTPUT_ON_FAILURE=1 make -C build test

To get more verbose output, use:

CTEST_OUTPUT_ON_FAILURE=1 make -C build test ARGS="-V"

Or also directly with:

CTEST_OUTPUT_ON_FAILURE=1 build/test_io

Generate code coverage

Just execute in unit-tests folder:

./gen_coverage.sh

it will output coverage.total and coverage/ folder with HTML details (in coverage/index.html).