C++Unit​X Reference Manual

Introduction

C++Unit­X is an xUnit-style testing framework for C++11 and later.

Programming interface

Assertions

The functions described in this section are declared in the cppunitx::assertion namespace.

template<class T, class U>
void assertEqual(T x, U y, const char *message = nullptr)
template<class T, class U>
void assertEqual(T x, U y, const std::string &message)

This function asserts two values are equal to each other.

void fail(const char *message = nullptr)
void fail(const std::string &message)

This function signals a test failure by throwing an exception.

Exceptions

The header <cppunitx/exception> defines the class for exceptions.

class AssertionFailedException : public std::runtime_error

This class represents the exceptions thrown when an assertion failed.

Indices and tables