stdex/mac/UnitTests/common.hpp
Simon Rozman 1e993c8c65 math: port unit tests to XCode
Signed-off-by: Simon Rozman <simon@rozman.si>
2023-09-11 17:34:40 +02:00

19 lines
334 B
C++

#pragma once
#include <stdexcept>
template <class T>
void are_equal(const T& a, const T& b)
{
if (!(a == b))
throw std::runtime_error("values are not equal");
}
template <class E, typename F>
void expect_exception(F functor)
{
try { functor(); }
catch (const E&) { return; }
throw std::runtime_error("exception expected");
}