1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef OMPI_SUPPORT_H
20 #define OMPI_SUPPORT_H
21
22 #include <stdio.h>
23 #include <stdlib.h>
24
25 #define TEST_AND_REPORT(res, exp_res, str) \
26 if( res == exp_res ) test_success(); \
27 else test_failure(str);
28
29 void test_init(const char *a);
30 void test_success(void);
31 void test_failure(const char *a);
32 int test_verify_str(const char *expected_result, const char *test_result);
33 int test_verify_int(int expected_result, int test_result);
34 int test_finalize(void);
35 void test_comment (const char* userstr);
36 void test_fail_stop(const char *msg, int status);
37
38
39
40
41
42
43
44 #define test_verify(MESSAGE, EXPR) \
45 do { \
46 if (!(EXPR)) { \
47 char s[256]; \
48 sprintf(s, "%s:%d: %s: %s\n", \
49 __FILE__, __LINE__, MESSAGE, # EXPR); \
50 test_failure(s); \
51 } else { \
52 test_success(); \
53 } \
54 } while (0)
55
56 #endif
57