Snaipe/Criterion
FreeA cross-platform C and C++ unit testing framework for the 21st century
About Snaipe/Criterion
Criterion is a dead-simple, yet extensible, C and C++ unit testing framework that follows the KISS principle. It is C99 and C++11 compatible and requires minimal boilerplate: tests are automatically registered when declared, and a default entry point is provided, so no need to write a main() unless special handling is needed. The framework implements a xUnit structure, runs tests in isolated processes to report crashes and signals, and provides a unified interface between C and C++. It supports parameterized tests and theories, real-time progress via report hooks, TAP output format, and runs on Linux, FreeBSD, macOS, and Windows (MinGW GCC and Visual Studio 2015+). Built with boxfort, debugbreak, libffi, klib, libcsptr, nanomsg, and nanopb.
Key Features
Pros & Cons
- Minimal boilerplate: test registration is automatic
- No need to manually define a main() entry point
- Test isolation ensures crashes don't break the entire suite
- Supports both C and C++ with a single include
- Rich feature set including parameterized tests and TAP output
- Cross-platform with package availability on major systems
- Actively maintained with regular releases
- C and C++ only; not applicable to other languages
- Requires compilation of test code (like most unit testing frameworks)
- Limited to xUnit style (may not suit all testing philosophies)
- Documentation is external (ReadTheDocs) and may not cover advanced usage deeply