Tinytest
A tiny unit-testing framework for C
Install / Use
/learn @joewalnes/TinytestREADME
TinyTest
A really really really tiny and simple no-hassle C unit-testing framework.
Features
- No library dependencies. Not even itself. Just a header file.
- Simple ANSI C. Should work with virtually every C or C++ compiler on virtually any platform.
- Reports assertion failures, including expressions and line numbers.
- Stops test on first failed assertion.
- ANSI color output for maximum visibility.
- Easy to embed in apps for runtime tests (e.g. environment tests).
Example Usage
#include "tinytest.h"
#include "mylib.h"
void test_sheep()
{
ASSERT("Sheep are cool", are_sheep_cool());
ASSERT_EQUALS(4, sheep.legs);
}
void test_cheese()
{
ASSERT("Cheese is tangy", cheese.tanginess > 0);
ASSERT_STRING_EQUALS("Wensleydale", cheese.name);
}
int main()
{
RUN(test_sheep);
RUN(test_cheese);
return TEST_REPORT();
}
To run the tests, compile the tests as a binary and run it.
2010-2014, -Joe Walnes joe@walnes.com http://joewalnes.com
Related Skills
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

