Skip to content

mrtkp9993/UnitTestCpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unit Test C++

Header-only simple unit-testing library for C++.

DOI

Usage

Just include test.hpp in your app and use it like in main.cpp:

#include <functional>

#include "test.hpp"

int main() {
    std::vector<std::function<bool()>> test_funcs = {
            []() { return 1 == 1; }, // TEST 1
            []() { return !(1 == 2); },   // TEST 2
            []() { return 1 == 2; } // TEST 3
    };

    Test tests(test_funcs);
    tests.Run();

    return 0;
}

Example result:

Test 3 FAILED
Run completed, # of failed tests/total tests: 1/3