Skip to content
Using the Catch unit test framework to write BDD-style tests for straight up C.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
Rakefile
catch.hpp
power_button.c
power_button.h
test_main.c
test_power_button.c

README.md

This is an example for how to use the Catch unit test framework to write BDD-style tests for C.

Requires

  • Rake (via Ruby)
  • g++

How to run

Run all the tests with rake.

Details

The module under test is the power_button which can be found in power_button.c. The BDD-style tests can be found in test_power_button.c.

Catch is a C++ unit test framework, but the code under test in the power_button module is straight up C. To run the tests, we need to compile everything with g++ (a C++ compiler).

See the Rakefile for more details about how everything is built.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.