Files
stubser/README.md
2021-01-03 12:09:36 +01:00

1.2 KiB

Stubser is a stub creator for CUnit

In an existing project, which does not use unit tests yet or which is still under heavy development, it is always a tedious task to create stubs for existing code. This GNU C based application takes one or multiple (also recursively) C files to create functional stubs ready to use with CUnit. Following files are created from one input C file:

Input Output Description
myfile.c stub_myfile_user.c Define additional elements which need to be tested, or helper functions.
stub_myfile_user.h Define test subject header needed for compilation of this stub including e.g. typedefs, structures, etc..
stub_myfile.c Actual stub containing all global variables and functions.
stub_myfile.h Header exposing all functions needed by CUnit test suite.

Stubser can be called repeatedly to the same output directory. It won't overwrite existing *_user.c|h files. This makes it possible to use it already during development in early stages.

Regular Expression based C file parser

This is a personal "experience collection" project to get more familiar with regular expressions in general, but also the use of it in GNU C. The focus is therefore not on performance.