1234567891011121314151617181920212223242526 |
- #ifndef CORE_ERROR_SIMULATOR_HPP
- #define CORE_ERROR_SIMULATOR_HPP
- #include <stdexcept>
- #ifdef ERROR_SIMULATOR
- extern int failStep;
- extern int failStepThrow;
- #define FAIL_STEP (--failStep == 0)
- inline void debugThrow() {
- if(--failStepThrow == 0) {
- throw std::runtime_error("not a real error");
- }
- }
- #define FAIL_STEP_THROW() debugThrow()
- #else
- #define FAIL_STEP false
- #define FAIL_STEP_THROW() \
- do { \
- } while(false)
- #endif
- #endif
|