I've recently released xUnit++, specifically as an alternative to Google Test and the Boost Test Library (view the comparisons). If you're familiar with xUnit.Net, you're ready for xUnit++.
#include "xUnit++/xUnit++.h"
FACT("Foo and Blah should always return the same value")
{
Check.Equal("0", Foo()) << "Calling Foo() with no parameters should always return \"0\".";
Assert.Equal(Foo(), Blah());
}
THEORY("Foo should return the same value it was given, converted to string", (int input, std::string expected),
std::make_tuple(0, "0"),
std::make_tuple(1, "1"),
std::make_tuple(2, "2"))
{
Assert.Equal(expected, Foo(input));
}
Main features:
- Incredibly fast: tests run concurrently.
- Portable
- Automatic test registration
- Many assertion types (Boost has nothing on xUnit++)
- Compares collections natively.
- Assertions come in three levels:
- fatal errors
- non-fatal errors
- warnings
- Easy assert logging:
Assert.Equal(-1, foo(i)) << "Failed with i = " << i;
- Test logging:
Log.Debug << "Starting test"; Log.Warn << "Here's a warning";
- Fixtures
- Data-driven tests (Theories)
- Select which tests to run based on:
- Attribute matching
- Name substring matchin
- Test Suites