12#include <source_location>
38 std::string
const& message,
42 std::optional<std::source_location>
location = std::nullopt
43 ) : std::logic_error{make_message(message,
reason)},
45 actual_{std::move(
actual)},
55 std::string
const&
reason() const noexcept {
64 std::string
const&
actual() const noexcept {
82 std::optional<std::source_location>
const&
location() const noexcept {
94 static std::string make_message(std::string
const& message, std::string_view
reason) {
99 auto result = message;
107 std::string expected_;
108 std::optional<std::source_location> location_;
Thrown when an assertion fails.
Definition assertion_error.hpp:23
std::optional< std::source_location > const & location() const noexcept
Returns the source location of the failed assertion.
Definition assertion_error.hpp:82
std::string const & reason() const noexcept
Returns the optional assertion reason.
Definition assertion_error.hpp:55
assertion_error(std::string const &message, std::string_view reason, std::string actual, std::string expected, std::optional< std::source_location > location=std::nullopt)
Creates an assertion error with already-rendered diagnostic values.
Definition assertion_error.hpp:37
std::string const & actual() const noexcept
Returns the rendered actual value.
Definition assertion_error.hpp:64
std::string const & expected() const noexcept
Returns the rendered expected value.
Definition assertion_error.hpp:73
Unit test framework functions and types.
Definition test.hpp:15