Skip to content

Tags: alvarezp/caddeus

Tags

v0.6

Toggle v0.6's commit message
Removed automatic object loading for unit tests

This turned out to be an incorrect approach. Unit tests should be able
to access all internal unit functions, including those not meant to be
exposed.

What happens right now (the wrong approach) is that Caddeus
automatically adds the module object (unit.o) into the test linking
process. This avoids having to reprocess the unit each time the test is
compiled but, because the module is added as an object and only public
prototypes are read, there is no way to access private functions.

This commits removes the automatic inclusion the unit object in the
linking process. The test should #include "unit.c" at the very top,
followed by #include "unit.h" right after. This way, there is full
access to internal functions, while prototype mismatches are detected.
This means, though, that if multiple test programs are created for a
single unit, the unit will be compiled along each test program, always.
This will make compilation slower and waste resources, but it seems to
be better than being unable to test the program.

I am open to suggestions on how to come up with a middle ground. I
dislike having to set variables for each test, though.

v0.5

Toggle v0.5's commit message
Remove THIS_IS_A_RELEASE

The default make does not test for anything anymore so we no longer
have the need to mark the code as a release. The user and downstream
distributions can just run make and no checks will be performed.

v0.4

Toggle v0.4's commit message
Completely reworked the README.md file

v0.3

Toggle v0.3's commit message
GNUmakefile: fix .caddeus/timestamps/ directory creation

v0.2

Toggle v0.2's commit message
README.md: a lot better project introduction

v0.1

Toggle v0.1's commit message
Initial commit. It is in a working state.

This repo supercedes my other attempt: simple-c-tdd.

Features and characteristics:
 * Have one test file per module. For a module.o target, a test named
   module.t.c can exist. A module.t binary will be compiled and run.
   If succeeds, a timestamp file module.ts file will be generated.
 * Dependency chain for modules:
   - module.ts: module.t
   - module.t: module.to module.o
   - module.to: module.t.c GNUmakefile
   - module.o: module.c GNUmakefile
 * Dependency chain for the final binary:
   - app: all-objects all-test-timestamps
 * CFLAGS are tight. Compiler errors usually indicate programming
   mistakes and should now let compilation be successful.
 * Allows testing to be required for some but not all modules by
   specifying objects in OBJS_TDD and OBJS_NO_TDD.
 * Will automatically generate module.d with generated dependency
   information. If module.c includes module.h, module.d will say
   module.c: module.h and included each time make is run.
 * Lower targets depend on GNUmakefile. This causes the whole project
   rebuild if GNUmakefile changes. This ensures that a change on
   GNUmakefile does not break project build.