ErrorSimulator.hpp 626 B

1234567891011121314151617181920212223
  1. #ifndef CORE_ERROR_SIMULATOR_HPP
  2. #define CORE_ERROR_SIMULATOR_HPP
  3. #ifdef ERROR_SIMULATOR
  4. namespace Core::Fail {
  5. extern bool realloc;
  6. extern bool fileClose;
  7. extern bool timeGet;
  8. extern int leftAllocations;
  9. bool freeAndReturn(void* p);
  10. }
  11. #define CORE_REALLOC_FAIL(pointer) \
  12. (Core::Fail::realloc && Core::Fail::freeAndReturn(pointer))
  13. #define CORE_FILE_CLOSE_FAIL Core::Fail::fileClose
  14. #define CORE_TIME_GET_FAIL Core::Fail::timeGet
  15. #else
  16. #define CORE_REALLOC_FAIL(...) false
  17. #define CORE_FILE_CLOSE_FAIL false
  18. #define CORE_TIME_GET_FAIL false
  19. #endif
  20. #endif