Skip to content

An ultra-simple unit test framework, in C++17. Might also work in C++11 or C++14, but not tested.

License

CC0-1.0, CC0-1.0 licenses found

Licenses found

CC0-1.0
LICENSE
CC0-1.0
COPYING
Notifications You must be signed in to change notification settings

lewisgdljr/toy_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy Test

This is a simple, quick-building unit test framwork. It doesn't have all of the features of other frameworks, but it's also only a couple pages of code.

Usage:

To compile under Linux or Cygwin:

make test

To create a test suite, you do something like this:

#include "toy_test.hpp"

toy_test::suite example_suite {
    "test suite name to display to the user",
    {
      { "name of this test",
         []{ code_to_actually_do_the_test; }},
      { "name of another test",
         []{ code_to_test_the_second_thing; }},
     }};

int main(){
    toy_test::run_suites({example_suite, another_suite});
}

There are two macros you can use to assert something:

ASSERT(exp); // checks to make sure that exp is a true expression
THROWS(exp, exception_name); // checks to make sure that exception_name
 	    		     // is thrown when exp is evaluated

See the test directory for examples.

License CC0

This work is licensed under the terms of the CC0-1.0 Universal license, or may be considered to be in the public domain, at your option.

About

An ultra-simple unit test framework, in C++17. Might also work in C++11 or C++14, but not tested.

Topics

Resources

License

CC0-1.0, CC0-1.0 licenses found

Licenses found

CC0-1.0
LICENSE
CC0-1.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published