SMBIOS Library
Classes | Macros
outputctl.h File Reference
#include "smbios/compat.h"
#include <exception>
#include <typeinfo>
Include dependency graph for outputctl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  skip_test

Macros

#define WHEREAMI   typeid(*this).name() << " (line " << __LINE__ << ")... "
#define GET_FLAGS()   std::ios::fmtflags old_opts = cout.flags()
#define RESTORE_FLAGS()   cout.flags(old_opts)
#define startTest(arg)   do{GET_FLAGS(); cout << arg << WHEREAMI; RESTORE_FLAGS();}while(0)
#define passTest(arg)   do{GET_FLAGS(); cout << "[ ok ]" << arg << endl; RESTORE_FLAGS();} while(0)
#define failTest(arg)   do{GET_FLAGS(); cout << "[FAIL]" << arg << endl; RESTORE_FLAGS();} while(0)
#define skipTest(arg)   do{GET_FLAGS(); cout << "[SKIP]" << arg << endl; RESTORE_FLAGS();} while(0)
#define STD_TEST_START_CHECKSKIP(arg)   startTest(arg); bool skip=false; cout << flush; try {
#define STD_TEST_START(arg)   startTest(arg); bool skip=false; cout << flush; try {
#define STD_TEST_END(arg)
#define ASSERT_THROWS(expr, exc)

Macro Definition Documentation

#define ASSERT_THROWS (   expr,
  exc 
)
Value:
do { \
bool caught = false; \
try \
{ \
expr; \
} \
catch( const exc & ) \
{ \
caught = true; \
} \
catch( const std::exception &e ) \
{ \
ostringstream ost; \
ost << "Executed: " #expr "\nCaught wrong exception. Expected: " #exc; \
ost << "\nLine: " << __LINE__; \
ost << "\nFile: " << __FILE__; \
ost << "\nException Caught: " << typeid(e).name(); \
CPPUNIT_FAIL (ost.str().c_str()); \
} \
catch( ... ) \
{ \
ostringstream ost; \
ost << "Executed: " #expr "\nCaught wrong exception. Expected: " #exc; \
ost << "\nLine: " << __LINE__; \
ost << "\nFile: " << __FILE__; \
CPPUNIT_FAIL (ost.str().c_str()); \
} \
if ( ! caught ) \
CPPUNIT_FAIL ("Executed: " #expr "\nShould have thrown an exception, but did not. Expected: " #exc);\
} while(0)

Definition at line 79 of file outputctl.h.

Referenced by testPlatform::testCmosWriting(), testPlatform::testConstructionOffset2(), testStandalone::testGetBoundaries(), testStandalone::testMemoryBadFiles(), testStandalone::testMemoryFuncs(), testPlatform::testOutOfBounds(), and testRbu::testRbuBadData().

#define failTest (   arg)    do{GET_FLAGS(); cout << "[FAIL]" << arg << endl; RESTORE_FLAGS();} while(0)

Definition at line 46 of file outputctl.h.

#define GET_FLAGS ( )    std::ios::fmtflags old_opts = cout.flags()

Definition at line 41 of file outputctl.h.

#define passTest (   arg)    do{GET_FLAGS(); cout << "[ ok ]" << arg << endl; RESTORE_FLAGS();} while(0)

Definition at line 45 of file outputctl.h.

#define RESTORE_FLAGS ( )    cout.flags(old_opts)

Definition at line 42 of file outputctl.h.

#define skipTest (   arg)    do{GET_FLAGS(); cout << "[SKIP]" << arg << endl; RESTORE_FLAGS();} while(0)

Definition at line 47 of file outputctl.h.

#define startTest (   arg)    do{GET_FLAGS(); cout << arg << WHEREAMI; RESTORE_FLAGS();}while(0)

Definition at line 44 of file outputctl.h.

#define STD_TEST_END (   arg)
Value:
} catch (const skip_test &) { \
skip = true; \
} catch ( const CppUnit::Exception &e ) { \
failTest(arg); \
throw; \
} catch ( const std::exception &e ) { \
failTest(arg); \
CPPUNIT_FAIL( e.what() ); \
} catch (...) { \
failTest(arg); \
throw; \
} \
if( skip ) \
skipTest(arg); \

Definition at line 60 of file outputctl.h.

Referenced by testPlatform::testAssetTag(), testPlatform::testBiosVersion(), testPlatform::testCmosChecksum(), testStandalone::testCmosConstructor(), testPlatform::testCmosWriting(), testStandalone::testConstIterator(), testPlatform::testConstructionOffset1(), testPlatform::testConstructionOffset2(), testStandalone::testEachItemAccessors(), testStandalone::testEntryCount(), testStandalone::testException(), testStandalone::testGetBoundaries(), testPlatform::testIdByte(), testPlatform::testIsDell(), testStandalone::testItemIdentity(), testStandalone::testLibraryVersion(), testStandalone::testMemoryBadFiles(), testStandalone::testMemoryFuncs(), testStandalone::testNonXml(), testPlatform::testOutOfBounds(), testRbu::testRbuBadData(), testRbu::testRbuBasic(), testRbu::testRbuNewVerCompare(), testRbu::testRbuNewVerSplit(), testRbu::testRbuOldVerCompare(), testRbu::testRbuOutput(), testPlatform::testServiceTag(), testPlatform::testServiceTagWriting(), testStandalone::testSmbiosXml(), testStandalone::testSmi_callingInterface(), testStandalone::testSmi_callingInterface_physaddr(), testPlatform::testStateBytes(), testStandalone::testStreamify(), testStandalone::testSubscriptOperator1(), testStandalone::testSubscriptOperator2(), testStandalone::testSubscriptOperator3(), testPlatform::testSystemInfo(), testPlatform::testSystemName(), testStandalone::testTable_Subscript(), testPlatform::testUpBoot(), and testPlatform::testVariousAccessors().

#define STD_TEST_START (   arg)    startTest(arg); bool skip=false; cout << flush; try {
#define STD_TEST_START_CHECKSKIP (   arg)    startTest(arg); bool skip=false; cout << flush; try {
#define WHEREAMI   typeid(*this).name() << " (line " << __LINE__ << ")... "

Definition at line 38 of file outputctl.h.