A small C library for test-driven software development (TDD). Faction mimics the C assert macro closely, except that it doesn't abort execution when the condition fails and results are always pretty printed.
A simple installation script comes included with the tarball. You can execute it by running `./setup.sh install`.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31#ifdef FACTION #define _GNU_SOURCE #endif /* This is the function to be tested */ int increment(int input) { return (input + 1); } #ifdef FACTION #include <faction.h> #include <limits.h> FI FT( AUTHORS( "timetoplatypus" ), SPEC( "increment() returns 1 when given 0" ), increment(0) == 1 ); FT( AUTHORS( "timetoplatypus" ), SPEC( "increment() returns 0 when given the largest integer value" ), increment(INT_MAX) == 0 ); FC #endif
This can be compiled using `gcc <filename.c> -D FACTION`. When you run the compiled binary (in this case, it's named "faction_normal1.o"), you'll see the following:
Faction is developed and maintained on Gitea