Description
Lightweight C++11 single header unit test framework
upp11 alternatives and similar libraries
Based on the "Testing" category.
Alternatively, view upp11 alternatives based on common mentions on social networks and blogs.
-
FakeIt
C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
Access the most powerful time series database as a service
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of upp11 or a related project?
Popular Comparisons
README
upp11
Lightweight C++11 single header unit test framework
To use framework:
Copy upp11.h in you project dir. Create unit test source files or modify existing file
#include "upp11.h"
Write the tests
UP_TEST(test1)
{
// test code
}
// tuple - for example. Any type possible, but params should be monotypes.
const auto params = {
make_tuple(1, "str1"),
make_tuple(2, "str222")
// etc
};
UP_PARAMETRIZED_TEST(test2, params)
{
const auto i = get<0>(params);
const auto s = get<1>(params);
// parametrized test code
}
struct fixture {
};
UP_FIXTURE_TEST(test3, fixture)
{
// test code with fixture
}
// parametrized with fixture available too...
Using test assertions
UP_TEST(test)
{
UP_ASSERT(0 < 1);
UP_ASSERT_EQUAL("right", "right");
UP_ASSERT_NE(list<int>{1, 2, 3, 4, 5 }, vector<int>{5, 4, 3, 2, 1});
// check exception by type
UP_ASSERT_EXCEPTION(runtime_error, []{
// code under test here...
});
// check exception by what
UP_ASSERT_EXCEPTION(runtime_error, "exception message", []{
// code under test here...
});
}
Group tests
UP_SUITE_BEGIN(suite_name);
// tests and child suites here
UP_SUITE_END();
Compile and run the test
// once for all test source files of test runner
UP_MAIN();
$ runner [-q] [-t] [-s <seed>]
Enjoy