#include "smbios/compat.h"
#include <exception>
#include <typeinfo>
Go to the source code of this file.
Classes | |
class | skip_test |
Defines | |
#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) |
#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::testItem_GetBiosInfo(), testStandalone::testMemoryBadFiles(), testStandalone::testMemoryFuncs(), testStandalone::testNonXml(), testPlatform::testOutOfBounds(), testRbu::testRbuBadData(), and testStandalone::testTypeMismatch().
#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); \ else \ passTest(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::testItem_GetBiosInfo(), testStandalone::testItem_GetSystemInfo(), 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(), testStandalone::testTypeMismatch(), testPlatform::testUpBoot(), and testPlatform::testVariousAccessors().
#define STD_TEST_START | ( | arg | ) | startTest(arg); bool skip=false; cout << flush; try { |
Definition at line 57 of file outputctl.h.
Referenced by testStandalone::testCmosConstructor(), testStandalone::testConstIterator(), testStandalone::testEachItemAccessors(), testStandalone::testEntryCount(), testStandalone::testException(), testStandalone::testGetBoundaries(), testStandalone::testItem_GetBiosInfo(), testStandalone::testItem_GetSystemInfo(), testStandalone::testItemIdentity(), testStandalone::testLibraryVersion(), testStandalone::testMemoryBadFiles(), testStandalone::testMemoryFuncs(), testStandalone::testNonXml(), testRbu::testRbuBadData(), testRbu::testRbuBasic(), testRbu::testRbuNewVerCompare(), testRbu::testRbuNewVerSplit(), testRbu::testRbuOldVerCompare(), testRbu::testRbuOutput(), testStandalone::testSmbiosXml(), testStandalone::testSmi_callingInterface(), testStandalone::testSmi_callingInterface_physaddr(), testStandalone::testStreamify(), testStandalone::testSubscriptOperator1(), testStandalone::testSubscriptOperator2(), testStandalone::testSubscriptOperator3(), testStandalone::testTable_Subscript(), and testStandalone::testTypeMismatch().
#define STD_TEST_START_CHECKSKIP | ( | arg | ) | startTest(arg); bool skip=false; cout << flush; try { |
Definition at line 56 of file outputctl.h.
Referenced by testPlatform::testAssetTag(), testPlatform::testBiosVersion(), testPlatform::testCmosChecksum(), testPlatform::testCmosWriting(), testPlatform::testConstructionOffset1(), testPlatform::testConstructionOffset2(), testPlatform::testIdByte(), testPlatform::testIsDell(), testPlatform::testOutOfBounds(), testPlatform::testServiceTag(), testPlatform::testServiceTagWriting(), testPlatform::testStateBytes(), testPlatform::testSystemInfo(), testPlatform::testSystemName(), testPlatform::testUpBoot(), and testPlatform::testVariousAccessors().
#define WHEREAMI typeid(*this).name() << " (line " << __LINE__ << ")... " |
Definition at line 38 of file outputctl.h.