finds.dev← search

// the find

ThrowTheSwitch/Unity

★ 5,390 · C · MIT · updated Sep 2026

Simple unit testing for C

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.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →