Skip to content

Commit 75b2be7

Browse files
Fix a compile warning with g++ 13.2.0. (#207)
* Fix a compile warning with g++ 13.2.0. When building the tests with g++ 13.2.0, it complains that the EXPECT_LONG_DOUBLE_EQ macro has no effect. That ends up being true; because it is just a x == y, with no EXPECT statement around it, it actually does nothing. Here, I just remove this macro because it is unnecessary; we can just do EXPECT_TRUE(x == y) and get the same effect with less code. Signed-off-by: Chris Lalancette <[email protected]> * Revert "Fix a compile warning with g++ 13.2.0." This reverts commit 28b32de. Signed-off-by: Miguel Company <[email protected]> * Refactor EXPECT_LONG_DOUBLE_EQ. Signed-off-by: Miguel Company <[email protected]> * Make expectations be checked. Signed-off-by: Miguel Company <[email protected]> --------- Signed-off-by: Chris Lalancette <[email protected]> Signed-off-by: Miguel Company <[email protected]> Co-authored-by: Miguel Company <[email protected]>
1 parent f44cbf6 commit 75b2be7

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

test/cdr/ResizeTest.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
#include <gtest/gtest.h>
2424

25-
#define EXPECT_LONG_DOUBLE_EQ(val1, val2) (val1 == val2)
26-
2725
using namespace eprosima::fastcdr;
2826
using namespace ::exception;
2927

@@ -180,6 +178,13 @@ static void EXPECT_ARRAY_DOUBLE_EQ(
180178
}
181179
}
182180

181+
static void EXPECT_LONG_DOUBLE_EQ(
182+
const long double val1,
183+
const long double val2)
184+
{
185+
EXPECT_TRUE(val1 == val2);
186+
}
187+
183188
static void EXPECT_ARRAY_LONG_DOUBLE_EQ(
184189
long double* array1,
185190
const long double* array2,

test/cdr/SimpleTest.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
#include <gtest/gtest.h>
2727

28-
#define EXPECT_LONG_DOUBLE_EQ(val1, val2) (val1 == val2)
29-
3028
using namespace eprosima::fastcdr;
3129
using namespace ::exception;
3230

@@ -194,6 +192,13 @@ static void EXPECT_ARRAY_DOUBLE_EQ(
194192
}
195193
}
196194

195+
static void EXPECT_LONG_DOUBLE_EQ(
196+
const long double val1,
197+
const long double val2)
198+
{
199+
EXPECT_TRUE(val1 == val2);
200+
}
201+
197202
static void EXPECT_ARRAY_LONG_DOUBLE_EQ(
198203
long double* array1,
199204
const long double* array2,

0 commit comments

Comments
 (0)