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 FAIL(msg) CPPUNIT_FAIL(msg)
13 
14 // Macro to test for exceptions:
15 
16 #define EXCEPTION(operation, type) \
17  { \
18  bool ok = false; \
19  try { \
20  operation; \
21  } \
22  catch (type e) { \
23  ok = true; \
24  } \
25  ASSERT(ok); \
26  }
27 
28 class Warning {
29 
30 public:
31  Warning(std::string message) {
32  std::cerr << message << std::endl;
33  }
34 };
35 
36 
37 #endif
Definition: Asserts.h:29