Skip to content

Commit d3611f3

Browse files
committed
Add compat for libcheck < 0.11.
1 parent a2d0dd9 commit d3611f3

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/check_elemwise.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@
66
#include "gpuarray/error.h"
77
#include "gpuarray/types.h"
88

9+
#if CHECK_MINOR_VERSION < 11
10+
11+
#ifndef CK_FLOATING_DIG
12+
# define CK_FLOATING_DIG 6
13+
#endif /* CK_FLOATING_DIG */
14+
15+
#define _ck_assert_floating(X, OP, Y, TP, TM) do { \
16+
TP _ck_x = (X); \
17+
TP _ck_y = (Y); \
18+
ck_assert_msg(_ck_x OP _ck_y, \
19+
"Assertion '%s' failed: %s == %.*"TM"g, %s == %.*"TM"g", \
20+
#X" "#OP" "#Y, \
21+
#X, (int)CK_FLOATING_DIG, _ck_x, \
22+
#Y, (int)CK_FLOATING_DIG, _ck_y); \
23+
} while (0)
24+
25+
#define ck_assert_float_eq(X, Y) _ck_assert_floating(X, ==, Y, float, "")
26+
#endif
27+
28+
929
extern void *ctx;
1030

1131
void setup(void);

0 commit comments

Comments
 (0)