A tiny cpp unit test framework for myself. It's for quick start, only 1 header and 1 cpp file. Coping to a repo finishs the setup.
See src/example.cpp
to get a few examples.
-
Put
src/cpput.hpp
andsrc/cpput.cc
into your project -
In the test code
// include header:
#include "cpput.hpp"
// define a test case
TEST(TestGroup, TestCase) {
// do your case
// ...
// check result
EQ_(result, 0);
}
OK_(exp)
expectexp
is trueNO_(exp)
expectexp
is falseEQ_(exp1, exp2)
expectexp1 == exp2
NE_(exp1, exp2)
expectexp1 != exp2
LE_(exp1, exp2)
expectexp1 <= exp2
LT_(exp1, exp2)
expectexp1 < exp2
GE_(exp1, exp2)
expectexp1 >= exp2
GT_(exp1, exp2)
expectexp1 > exp2