Skip to content

NEXFI-KK/munit

 
 

Repository files navigation

Forked from https://github.com/nemequ/munit/

µnit

µnit is a small but full-featured unit testing framework for C. It has no dependencies (beyond libc), is permissively licensed (MIT), and is easy to include into any project.

For more information, see the µnit web site.

Build status Windows build status

Features

Features µnit currently includes include:

  • Handy assertion macros which make for nice error messages.
  • Reproducible cross-platform random number generation, including support for supplying a seed via CLI.
  • Timing of both wall-clock and CPU time.
  • Parameterized tests.
  • Nested test suites.
  • Flexible CLI.
  • Forking (except on Windows).
  • Hiding output of successful tests.

Features µnit does not currently include, but some day may include (a.k.a., if you file a PR…), include:

Include with CMake FetchContent

FetchContent_Declare(
    munit
    GIT_REPOSITORY https://github.com/NEXFI-KK/munit
    GIT_TAG        master
)

FetchContent_MakeAvailable(munit)

Important

By default µnit will fork test cases, which can often lead to breaking the debugger. Unless you need this forking behavior for memory safety, it can be disabled by adding add_compile_definitions(MUNIT_NO_FORK) before the FetchContent_Declare call.

Include into your project with meson

In your subprojects folder put a munit.wrap file containing:

[wrap-git]
directory=munit
url=https://github.com/nemequ/munit/
revision=head

Then you can use a subproject fallback when you include munit as a dependency to your project: dependency('munit', fallback: ['munit', 'munit_dep'])

Documentation

See the µnit web site.

Additionally, there is a heavily-commented example.c in the repository.

Releases

No releases published

Packages

No packages published

Languages

  • C 96.2%
  • CMake 1.7%
  • Makefile 1.1%
  • Other 1.0%