← Home

nmtest

14 December, 2025

nmtest is a C++23 library created as an experiment to see if it was possible to do unit-testing without the use of any macros in modern C++.

Related blogposts:

Examples:

Test("Math", "Addition")
.Func([]{ return Equal(2+2, 4); })
Suite("suite name")
.Test({
    .name = "test 1",
    .func = []{ return Equal(0, 9); }
})
.Test({
    .name = "test 2",
    .func = []{ return Equal(0, 8); }
});
[X  FAIL] TestName (main.cpp:100):
          - Equal(3:5) | main.cpp:101
          - NotEqual(2:2) | main.cpp:103 | custom message
[SUMMARY] Total: 3; Passed: 1; Failed: 2; Errors: 0
          Failed tests:
          - Subtraction (main.cpp:139)
          - Multiplication (main.cpp:167)