IMP logo
IMP Reference Guide  2.5.0
The Integrative Modeling Platform
test_macros.h
Go to the documentation of this file.
1 /**
2  * \file IMP/test/test_macros.h
3  * Macros for writing C++ tests.
4  *
5  * Copyright 2007-2015 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPTEST_TEST_MACROS_H
10 #define IMPTEST_TEST_MACROS_H
11 #include <IMP/log_macros.h>
12 
13 //! Report an error if a != b
14 #define IMP_TEST_EQUAL(a, b) \
15  if (a != b) { \
16  IMP_ERROR("Test failed: " << #a << " != " << #b << " values are " << a \
17  << " != " << b); \
18  }
19 
20 //! Report an error if !a
21 #define IMP_TEST_TRUE(a) \
22  if (!(a)) { \
23  IMP_ERROR("Test failed: !" << #a); \
24  }
25 
26 //! Report an error if a >= b
27 #define IMP_TEST_LESS_THAN(a, b) \
28  if (a >= b) { \
29  IMP_ERROR("Test failed: " << #a << " >= " << #b << " values are " << a \
30  << " >= " << b); \
31  }
32 
33 //! Report an error if a < b
34 #define IMP_TEST_GREATER_THAN(a, b) \
35  if (a <= b) { \
36  IMP_ERROR("Test failed: " << #a << " <= " << #b << " values are " << a \
37  << " <= " << b); \
38  }
39 
40 #endif /* IMPTEST_TEST_MACROS_H */
Logging and error reporting support.