Go to the documentation of this file.
35 #ifdef LIBSMBIOS_HAS_PRETTY_FUNCTION
36 #define WHEREAMI "\t" << __PRETTY_FUNCTION__ << "... "
38 #define WHEREAMI typeid(*this).name() << " (line " << __LINE__ << ")... "
41 #define GET_FLAGS() std::ios::fmtflags old_opts = cout.flags()
42 #define RESTORE_FLAGS() cout.flags(old_opts)
44 #define startTest(arg) do{GET_FLAGS(); cout << arg << WHEREAMI; RESTORE_FLAGS();}while(0)
45 #define passTest(arg) do{GET_FLAGS(); cout << "[ ok ]" << arg << endl; RESTORE_FLAGS();} while(0)
46 #define failTest(arg) do{GET_FLAGS(); cout << "[FAIL]" << arg << endl; RESTORE_FLAGS();} while(0)
47 #define skipTest(arg) do{GET_FLAGS(); cout << "[SKIP]" << arg << endl; RESTORE_FLAGS();} while(0)
52 #ifdef LIBSMBIOS_HAS_PRETTY_FUNCTION
53 #define STD_TEST_START_CHECKSKIP(arg) startTest(arg); bool skip=false; cout << flush; try { checkSkipTest(__FUNCTION__)
54 #define STD_TEST_START(arg) startTest(arg); bool skip=false; cout << flush; try {
56 #define STD_TEST_START_CHECKSKIP(arg) startTest(arg); bool skip=false; cout << flush; try {
57 #define STD_TEST_START(arg) startTest(arg); bool skip=false; cout << flush; try {
60 #define STD_TEST_END(arg) \
61 } catch (const skip_test &) { \
63 } catch ( const CppUnit::Exception &e ) { \
66 } catch ( const std::exception &e ) { \
68 CPPUNIT_FAIL( e.what() ); \
79 #define ASSERT_THROWS( expr, exc ) \
81 bool caught = false; \
86 catch( const exc & ) \
90 catch( const std::exception &e ) \
93 ost << "Executed: " #expr "\nCaught wrong exception. Expected: " #exc; \
94 ost << "\nLine: " << __LINE__; \
95 ost << "\nFile: " << __FILE__; \
96 ost << "\nException Caught: " << typeid(e).name(); \
97 CPPUNIT_FAIL (ost.str().c_str()); \
102 ost << "Executed: " #expr "\nCaught wrong exception. Expected: " #exc; \
103 ost << "\nLine: " << __LINE__; \
104 ost << "\nFile: " << __FILE__; \
105 CPPUNIT_FAIL (ost.str().c_str()); \
108 CPPUNIT_FAIL ("Executed: " #expr "\nShould have thrown an exception, but did not. Expected: " #exc);\