]> git.mxchange.org Git - simgear.git/blob - simgear/misc/test_macros.hxx
Update doxgen config and some comments.
[simgear.git] / simgear / misc / test_macros.hxx
1
2 #ifndef SG_MISC_TEST_MACROS_HXX
3 #define SG_MISC_TEST_MACROS_HXX
4
5 #include <cmath> // for fabs()
6
7 #define COMPARE(a, b) \
8     if ((a) != (b))  { \
9         std::cerr << "failed:" << #a << " != " << #b << std::endl; \
10         std::cerr << "\tgot:'" << a << "'" << std::endl; \
11         std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \
12         exit(1); \
13     }
14
15 #define VERIFY(a) \
16     if (!(a))  { \
17         std::cerr << "failed:" << #a << std::endl; \
18         std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \
19         exit(1); \
20     }
21
22 #define COMPARE_EP(a, b) \
23     if (fabs(a - b) > SG_EPSILON)  { \
24         std::cerr << "failed with epsilon:" << #a << " != " << #b << std::endl; \
25         std::cerr << "\tgot:'" << a << "'" << std::endl; \
26         std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \
27         exit(1); \
28     }
29
30 #define COMPARE_EP2(a, b, ep) \
31     if (fabs(a - b) > ep)  { \
32         std::cerr << "failed with epsilon:" << #a << " != " << #b << std::endl; \
33         std::cerr << "\tgot:'" << a << "'" << std::endl; \
34         std::cerr << "\tat:" << __FILE__ << ":" << __LINE__ << std::endl; \
35         exit(1); \
36     }
37
38 #endif // of SG_MISC_TEST_MACROS_HXX