Attractor: unit test framework written in C11

Attractor is a personal project that I made open source. It’s a single-function unit test framework for C projects.

You can find it here: https://github.com/zaerl/attractor

I wanted to create something:

  1. Simple
  2. Small

I wasn’t happy with all the unit test libraries I found online so I created one that uses the magic behind C11 _Generic selection.

The library consists of two files: attractor.h and attractor.c.

Usage

Using Attractor is very simple. It consists of the macro:

It is a generic macro and accepts every core C type, see the repository for the complete list.

You can add all the tests you want and then check if all tests went well. Quick example:

See the repository for complete examples.

Why? There are multiple C unit test frameworks

Why not?

@online{zaerl2024-attractor-unit-test-framework-written-in-c11,
  author = {Francesco Bigiarini},
  title = {Attractor: unit test framework written in C11},
  date = {2024-02-06},
  url = {https://zaerl.com/2024/02/06/attractor-unit-test-framework-written-in-c11/},
  urldate = {2024-02-06}
}