This class may be used in white-box testing to force that an OsbException is thrown or the function abort() is called.
For this the source code must be modified to call the function operator of the global object theFailPoint at potential points of failure.
void foo(const std::string& path) { int rc = openFile(path); if (0 != rc) throw NoFile; // temporary add this: theFailPoint("foo: openFile"); }
The application should initialize counter_ and action_ in order to control when failure will be forced.
Note that if initialized with 0, counter_ will contain the number of calls to the function operator.
Definition at line 66 of file osbfail.h.
OSB_LIB::FailPoint::FailPoint | ( | ) | [inline] |
void OSB_LIB::FailPoint::operator() | ( | const char * | where = 0 |
) |
Decrease counter_ and throw/abort if it is 0.