IMP  2.1.1
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-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPTEST_TEST_MACROS_H
10 #define IMPTEST_TEST_MACROS_H
11 
12 //! Report an error if a != b
13 #define IMP_TEST_EQUAL(a, b) \
14  if (a != b) { \
15  IMP_ERROR("Test failed: " << #a << " != " << #b << " values are " << a \
16  << " != " << b); \
17  }
18 
19 //! Report an error if !a
20 #define IMP_TEST_TRUE(a) \
21  if (!(a)) { \
22  IMP_ERROR("Test failed: !" << #a); \
23  }
24 
25 //! Report an error if a >= b
26 #define IMP_TEST_LESS_THAN(a, b) \
27  if (a >= b) { \
28  IMP_ERROR("Test failed: " << #a << " >= " << #b << " values are " << a \
29  << " >= " << b); \
30  }
31 
32 //! Report an error if a < b
33 #define IMP_TEST_GREATER_THAN(a, b) \
34  if (a <= b) { \
35  IMP_ERROR("Test failed: " << #a << " <= " << #b << " values are " << a \
36  << " <= " << b); \
37  }
38 
39 #endif /* IMPTEST_TEST_MACROS_H */