GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vanderhell/microtest: A lightweight, header-only C99 testing framework for embedded and low-level libraries, with zero runtime dependencies and practical CLI tooling.

BranchesTags
Open more actions menu

Latest commit

 

History

17 Commits
17 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
cmake
cmake
 
 
docs
docs
 
 
include
include
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
SUPPORT.md
SUPPORT.md
 
 
VERIFICATION.md
VERIFICATION.md
 
 

Repository files navigation

microtest

Single-header C99 test framework for hosted and embedded-oriented C projects.

What it does:

  • Assertions for integers, pointers, strings, memory, and optional floats.
  • Suites for grouping tests, including multi-translation-unit suites.
  • Fixtures with explicit setup and teardown.
  • Runtime CLI filtering, list mode, verbose mode, stop-on-fail, and no-color.
  • Output callbacks for custom sinks.
  • CMake package export, install, and consumer verification.

What it does not do:

  • No dynamic allocation.
  • No third-party dependencies.
  • No claim of thread safety.
  • No ASan/UBSan verification on this host.
  • No claim of freestanding, ISR, RTOS, or production readiness.

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();
}

Basic Examples

Assertions:

MTEST(test_strings) {
    MTEST_ASSERT_STR_EQ("alpha", "alpha");
    MTEST_ASSERT_MEM_EQ("abc", "abc", 3);
}

Skip:

MTEST(test_skip_example) {
    MTEST_SKIP("not supported here");
}

Fixture:

static void setup(void) { }
static void teardown(void) { }

MTEST(test_with_fixture) {
    MTEST_ASSERT_TRUE(1);
}

MTEST_SUITE(example) {
    MTEST_RUN_F(test_with_fixture, setup, teardown);
}

Multi-TU:

/* in one file */
MTEST_SUITE_DEFINE(shared) { MTEST_RUN(test_one); }

/* in another file */
MTEST_SUITE_DECLARE(shared);

CLI

Supported options:

  • --filter=NAME
  • -v, --verbose
  • -x, --stop-on-fail
  • -l, --list
  • -h, --help
  • --no-color

Examples:

./test_all --filter=ring
./test_all -l
./test_all -x
./test_all --no-color

--help prints usage and returns success without running suites. An empty --filter= is invalid. An unknown option fails with a nonzero exit code.

Configuration

Macro Default Meaning
MTEST_ENABLE_COLOR 1 ANSI colors at runtime
MTEST_ENABLE_CLI 1 CLI parsing and help
MTEST_ENABLE_ENV 1 NO_COLOR support
MTEST_ENABLE_EXIT 1 Hosted exit codes from MTEST_END()
MTEST_ENABLE_FLOAT 1 Float assertions and math helpers

Layout

  • include/mtest.h - single public header
  • tests/ - self-tests, CLI checks, install consumer, and multi-TU checks
  • cmake/ - package config template
  • docs/ - reference notes for API and usage

More

  • API
  • Assertions
  • CLI
  • Fixtures
  • Testing
  • Release

About

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

Topics

cc99embeddedembedded-systemsheader-onlylightweightlow-levelmicrocontrollertest-frameworktestingunit-testingzero-dependency

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity

Stars

0 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.