From 3aa4bf34cf1f8a710764bfd35849c2474589bf2e Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Wed, 9 Apr 2025 12:35:16 -0400 Subject: pke-test: compare floats using epsilon --- tests/pke-test-types.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/pke-test-types.h') diff --git a/tests/pke-test-types.h b/tests/pke-test-types.h index 5a9ee24..097d42f 100644 --- a/tests/pke-test-types.h +++ b/tests/pke-test-types.h @@ -3,6 +3,7 @@ #include #include +#include struct pke_test_long_jump { uint8_t expected_exit; @@ -38,4 +39,9 @@ struct pke_test_group { #define PKE_TEST_ASSERT(condition, index) if (!(condition)) { return ++index; } else { ++index; } +template +inline bool flt_equal(T a, T b, T epsilon) { + return std::abs(a - b) < epsilon; +} + #endif /* PKE_PKE_TEST_TYPES_H */ -- cgit v1.2.3