finds.dev

ThrowTheSwitch/Unity

Simple unit testing for C

View on GitHubHomepage ↗

★ 5,390CMITupdated Sep 2026

// the take

Unity is a unit testing framework for C, built primarily for embedded toolchains where a full test framework won't fit or compile cleanly. It's the core assertion/test-runner engine behind ThrowTheSwitch's ecosystem (Ceedling, CMock) but works standalone with any build system.

The core is one C file and two headers, so it drops into an existing embedded build without pulling in a package manager or build system change. Assertion macros are sized explicitly (INT8/16/32/64, HEX variants) which matters on embedded targets where silent integer promotion hides bugs. It's been validated against oddball toolchains — the test/targets directory includes IAR and HiTech PICC18 configs, not just GCC/Clang. Optional extras (fixture, memory, bdd) are separate opt-in modules rather than bundled into the core, so you're not carrying dead weight.

No mocking support — that's punted entirely to CMock, a separate project you have to wire in yourself. The test runner generation leans on Ruby scripts (auto/generate_test_runner.rb, rakefile), an odd dependency to bring into a C toolchain if you're not already using Ceedling. Parameterized/data-driven tests exist but are clunkier than what you'd get from a framework like Unity (Apple's) or Catch2 — you're writing more boilerplate per test case. Documentation is thorough but scattered across a dozen markdown files in docs/ rather than a single reference, so ramp-up takes longer than the 'single file' pitch suggests.

We read the README, the directory tree and a key source file in September 2026. Nobody pays to be listed. How we judge →

search the same ground:

// at a glance

Stars
5,390
Forks
1,134
Language
C
License
MIT
Last commit
10 Sep 2026

// nearby

If Unity isn't quite it.

All repos →