Skip to content

Vanderhell/microtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

microtest

CI License: MIT C99 Header-only

Single-header test framework for embedded C libraries.

C99 | Header-only | Zero dependencies | Zero allocations | Color output | CLI filtering

Why microtest?

Many small C libraries end up with copy-pasted ad-hoc test macros. microtest extracts that pattern into a single reusable header with a consistent API.

Features

  • 16+ assertion macros for integers, strings, memory, floats, pointers, and booleans
  • Test suites for logical grouping
  • Setup/teardown fixtures via MTEST_RUN_F
  • Skip support with reason (MTEST_SKIP)
  • CLI options: --filter, -v, -x, -l, -h
  • Colorized output (configurable)
  • Per-run assertion counter in summary

Quick start

#define MTEST_IMPLEMENTATION
#include "mtest.h"

MTEST(test_addition) {
    MTEST_ASSERT_EQ(2 + 2, 4);
}

MTEST_SUITE(math) {
    MTEST_RUN(test_addition);
}

int main(int argc, char **argv) {
    MTEST_BEGIN(argc, argv);
    MTEST_SUITE_RUN(math);
    return MTEST_END();
}

Build and run self-tests

cd tests
make clean
make

CLI examples

./test_all
./test_all --filter=ring
./test_all -l
./test_all -x
./test_all -v
./test_all -h

Configuration

Macro Default Description
MTEST_ENABLE_COLOR 1 ANSI color output
MTEST_ENABLE_TIMING 1 Reserved timing switch
MTEST_MAX_NAME 64 Max test name length

Project structure

include/mtest.h      # framework header
tests/test_all.c     # self-tests
tests/Makefile       # local test build/run
docs/DESIGN.md       # design rationale
CONTRIBUTING.md      # contribution guide
CHANGELOG.md         # release notes
LICENSE              # MIT license (Vanderhell)

Roadmap

  • JUnit/XML reporting mode
  • More assertion variants for custom diagnostics
  • Optional minimal benchmark helper for test runtime

Contributing

Please read CONTRIBUTING.md.

Changelog

See CHANGELOG.md.

License

MIT License, Copyright (c) 2026 Vanderhell. See LICENSE.

About

A lightweight, header-only C99 testing framework for embedded and low-level libraries, with zero runtime dependencies and practical CLI tooling.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors