@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2021-2022 Robin Lindén <dev@robinlinden.eu>
// SPDX-FileCopyrightText: 2021-2023 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
@@ -38,9 +38,13 @@ void expect_eq(T const &a,
U const &b,
std::optional<std::string_view> log_message = std::nullopt,
etest::source_location const &loc = etest::source_location::current()) noexcept {
if (a == b) {
return;
}
std::stringstream ss;
ss << a << " !=\n" << b;
expect(a == b, log_message ? std::move(log_message) : std::move(ss).str(), loc);
expect(false, log_message ? std::move(log_message) : std::move(ss).str(), loc);
}
template<typename T, typename U>
@@ -57,9 +61,13 @@ void require_eq(T const &a,
U const &b,
std::optional<std::string_view> log_message = std::nullopt,
etest::source_location const &loc = etest::source_location::current()) {
if (a == b) {
return;
}
std::stringstream ss;
ss << a << " !=\n" << b;
require(a == b, log_message ? std::move(log_message) : std::move(ss).str(), loc);
require(false, log_message ? std::move(log_message) : std::move(ss).str(), loc);
}
template<typename T, typename U>