1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * $COPYRIGHT$
13 *
14 * Additional copyrights may follow
15 *
16 * $HEADER$
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 * test_verify: Non-fatal assertion macro.
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 /* OMPI_SUPPORT_H */
57