home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.22.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
include
IMP
test
version 2.22.0
test_macros.h
Go to the documentation of this file.
1
/**
2
* \file IMP/test/test_macros.h
3
* \brief Macros for writing C++ tests.
4
*
5
* These should only be used in test code (i.e. C++ binaries in the test/
6
* subdirectory that link against IMP libraries and are run as part of the
7
* test suite). For runtime checks of IMP itself, see IMP_INTERNAL_CHECK
8
* and IMP_USAGE_CHECK.
9
*
10
* Copyright 2007-2022 IMP Inventors. All rights reserved.
11
*
12
*/
13
14
#ifndef IMPTEST_TEST_MACROS_H
15
#define IMPTEST_TEST_MACROS_H
16
#include <
IMP/log_macros.h
>
17
18
//! Report an error if a != b
19
#define IMP_TEST_EQUAL(a, b) \
20
if (a != b) { \
21
IMP_ERROR("Test failed: " << #a << " != " << #b << " values are " << a \
22
<< " != " << b); \
23
}
24
25
//! Report an error if !a
26
#define IMP_TEST_TRUE(a) \
27
if (!(a)) { \
28
IMP_ERROR("Test failed: !" << #a); \
29
}
30
31
//! Report an error if a >= b
32
#define IMP_TEST_LESS_THAN(a, b) \
33
if (a >= b) { \
34
IMP_ERROR("Test failed: " << #a << " >= " << #b << " values are " << a \
35
<< " >= " << b); \
36
}
37
38
//! Report an error if a < b
39
#define IMP_TEST_GREATER_THAN(a, b) \
40
if (a <= b) { \
41
IMP_ERROR("Test failed: " << #a << " <= " << #b << " values are " << a \
42
<< " <= " << b); \
43
}
44
45
#endif
/* IMPTEST_TEST_MACROS_H */
log_macros.h
Logging and error reporting support.