Skip to content

00000000000000001/Test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test

A class for unit testing in c++.

Example

#include "Test.hh"

Test test{};

void ten_equals_twenty()
{
    test.equals(10,20);
}

void ten_equals_ten()
{
    test.equals(10,10);
}

void object_is_printed_correctly()
{
    int zahl{42};
    test.prints("42", zahl);
}

void object_is_not_printed_correctly()
{
    int zahl{42};
    test.prints("hello", zahl);
}

void this_test_fails()
{
    test.fail();
}

int main()
{
    ten_equals_twenty();
    ten_equals_ten();
    object_is_printed_correctly();
    object_is_not_printed_correctly();
    this_test_fails();
    return 0;
}

prints

checking: ten_equals_twenty: expected: 10 but was: 20
checking: ten_equals_ten
checking: object_is_printed_correctly
checking: object_is_not_printed_correctly: expected: hello but was: 42
checking: this_test_fails: not implemented yet
>> Test failed

About

A class for unit tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published