Partials
A Partial is your C code sliced and diced to expose elements for testing that you could not otherwise access without rewriting your source code. Think of Partials as a unit testing scalpel.
Partials are useful when a module under test contains:
staticorinlinefunctions — These become accessible within your test code.- File-scoped
staticvariables — Thestatickeyword is stripped, and the variable is automatically madeexternfor easy access within your test code. - Function-scoped
staticvariables — These are promoted from function scope to module scope so they can be accessed in your test code. Apart from necessary renaming, this works identically to file-scopedstaticvariables.
Limitations of Partials
Partials are new to Ceedling with 1.1.0. Carving up C code is tricky business. Complex code may break Ceedling’s lexing or its assumptions on symbol ordering. Some issues may be bugs to be reported while others may be complexities that Partials are simply unable to resolve.
-
How Ceedling generates testable and mockable Partials from your C source under test with a step-by-step simple example.
-
What is a module? “Public” and “private” functions in a programming language that has no such terminology.
-
How to enable Partials in your project, include
ceedling.h, and an overview of directive macro categories. -
A complete end-to-end demonstration of Test Partials and Mock Partials.
-
- Generation macros used with
#includefor creating Partials. - Config macros for fine-tuning your Partials.
- Generation macros used with
-
How to test file-scoped and function-scoped
staticvariables via Partials.