- Started unit tests for the common math functions
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <fennec/math/common.h>
|
||||
#include <fennec/math/matrix.h>
|
||||
#include <fennec/math/relational.h>
|
||||
#include <fennec/math/vector_traits.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
@@ -76,7 +77,9 @@ inline void __fennec_test_run(const std::string& expression, const ResultT resul
|
||||
std::cout << std::boolalpha;
|
||||
std::cout << '\t' << expression << " = " << result;
|
||||
bool passed = false;
|
||||
if constexpr(is_arithmetic_v<ResultT> or is_vector_v<ResultT>)
|
||||
if constexpr(is_arithmetic_v<ResultT>)
|
||||
passed = fennec::abs(expected - result) <= numeric_limits<ResultT>::epsilon();
|
||||
else if constexpr(is_vector_v<ResultT> && not(is_bool_v<typename ResultT::scalar_t>))
|
||||
passed = fennec::abs(expected - result) <= numeric_limits<ResultT>::epsilon();
|
||||
else
|
||||
passed = result == expected;
|
||||
|
||||
Reference in New Issue
Block a user