NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Asserts.h
1 #ifndef ASSERTS_H
2 #define ASSERTS_H
3 
4 #include <iostream>
5 #include <string>
6 
7 // Abbreviations for assertions in cppunit.
8 
9 #define EQMSG(msg, a, b) CPPUNIT_ASSERT_EQUAL_MESSAGE(msg,a,b)
10 #define EQ(a,b) CPPUNIT_ASSERT_EQUAL(a,b)
11 #define ASSERT(expr) CPPUNIT_ASSERT(expr)
12 #define ASSERTMSG(msg,expr) CPPUNIT_ASSERT_MESSAGE(msg,expr)
13 #define FAIL(msg) CPPUNIT_FAIL(msg)
14 
15 // Macro to test for exceptions:
16 
17 #define EXCEPTION(operation, type) \
18  { \
19  bool ok = false; \
20  try { \
21  operation; \
22  } \
23  catch (type e) { \
24  ok = true; \
25  } \
26  ASSERT(ok); \
27  }
28 
29 class Warning {
30 
31 public:
32  Warning(std::string message) {
33  std::cerr << message << std::endl;
34  }
35 };
36 
37 #endif // ASSERTS_H
Definition: Asserts.h:29