Skip to content

Commit 65e2ed8

Browse files
committed
LLVMTestUtils: Properly test NaN values
1 parent e70709f commit 65e2ed8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/llvm/llvmtestutils.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@
55
#include <targetmock.h>
66
#include <randomgeneratormock.h>
77

8-
#define ASSERT_NUM_OP1(utils, type, rawArg, v) ASSERT_EQ(utils.getOpResult(type, rawArg, v).toDouble(), m_utils.getExpectedOpResult(type, v).toDouble());
9-
#define ASSERT_NUM_OP2(utils, type, rawArgs, v1, v2) ASSERT_EQ(utils.getOpResult(type, rawArgs, v1, v2).toDouble(), m_utils.getExpectedOpResult(type, v1, v2).toDouble());
8+
#define ASSERT_NUM_OP1(utils, type, rawArg, v) \
9+
Value result = utils.getOpResult(type, rawArg, v); \
10+
Value expected = utils.getExpectedOpResult(type, v); \
11+
ASSERT_EQ(result.isNaN(), expected.isNaN()); \
12+
ASSERT_EQ(result.toDouble(), expected.toDouble());
13+
14+
#define ASSERT_NUM_OP2(utils, type, rawArgs, v1, v2) \
15+
Value result = utils.getOpResult(type, rawArgs, v1, v2); \
16+
Value expected = utils.getExpectedOpResult(type, v1, v2); \
17+
ASSERT_EQ(result.isNaN(), expected.isNaN()); \
18+
ASSERT_EQ(result.toDouble(), expected.toDouble());
1019

1120
#define ASSERT_BOOL_OP1(utils, type, rawArg, v) ASSERT_EQ(utils.getOpResult(type, rawArg, v).toBool(), m_utils.getExpectedOpResult(type, v).toBool());
1221
#define ASSERT_BOOL_OP2(utils, type, rawArgs, v1, v2) ASSERT_EQ(utils.getOpResult(type, rawArgs, v1, v2).toBool(), m_utils.getExpectedOpResult(type, v1, v2).toBool());

0 commit comments

Comments
 (0)