From 55d908255a31530d6177a3f50fe233c61b85c84c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 26 Sep 2022 23:35:21 +0200 Subject: [PATCH] try fixing expression error/warning, might fail in windows --- Utils/TestUtils.h | 8 ++++---- tests/Image/ImageUtilsTest.cpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Utils/TestUtils.h b/Utils/TestUtils.h index 9001571..203f40a 100644 --- a/Utils/TestUtils.h +++ b/Utils/TestUtils.h @@ -13,7 +13,7 @@ #include #include "MathUtils.h" -#define ASSERT_EQUALS(a, b, t1, t2) (\ +#define ASSERT_EQUALS(a, b, t1, t2) ({\ if ((a) == (b)) { \ printf("."); \ } else { \ @@ -21,9 +21,9 @@ printf("\n\n%s - %i: ", __FILE__, __LINE__); \ printf((t1), (a)); printf(" != "); printf((t2), (b)); printf("\n"); \ return 0; } \ - ) + }) -#define ASSERT_EQUALS_WITH_DELTA(a, b, delta, t1, t2) (\ +#define ASSERT_EQUALS_WITH_DELTA(a, b, delta, t1, t2) ({\ if (oms_abs((a) - (b)) <= (delta)) { \ printf("."); \ } else { \ @@ -31,6 +31,6 @@ printf("\n\n%s - %i: ", __FILE__, __LINE__); \ printf((t1), (a)); printf(" != "); printf((t2), (b)); printf("\n"); \ return 0; } \ - ) + }) #endif diff --git a/tests/Image/ImageUtilsTest.cpp b/tests/Image/ImageUtilsTest.cpp index 95b9d8e..970386e 100644 --- a/tests/Image/ImageUtilsTest.cpp +++ b/tests/Image/ImageUtilsTest.cpp @@ -21,6 +21,8 @@ int main(int argc, char** argv) float white = Image::ImageUtils::lightnessFromRgb(255, 255, 255); ASSERT_EQUALS(white, 1.0, "%f", "%f"); + if (true) {} + float black = Image::ImageUtils::lightnessFromRgb(0, 0, 0); ASSERT_EQUALS(black, 0.0, "%f", "%f");