ErrorTests.cpp 1.0 KB

123456789101112131415161718192021222324252627
  1. #include "../Tests.hpp"
  2. #include "core/utils/Error.hpp"
  3. static void test(Core::Error e, const char* s) {
  4. CORE_TEST_STRING(getErrorName(e), s);
  5. }
  6. void Core::testError() {
  7. test(Error::NONE, "NONE");
  8. test(Error::NEGATIVE_ARGUMENT, "NEGATIVE_ARGUMENT");
  9. test(Error::CAPACITY_REACHED, "CAPACITY_REACHED");
  10. test(Error::BLOCKED_STDOUT, "BLOCKED_STDOUT");
  11. test(Error::OUT_OF_MEMORY, "OUT_OF_MEMORY");
  12. test(Error::INVALID_CHAR, "INVALID_CHAR");
  13. test(Error::NOT_FOUND, "NOT_FOUND");
  14. test(Error::INVALID_STATE, "INVALID_STATE");
  15. test(Error::INVALID_INDEX, "INVALID_INDEX");
  16. test(Error::INVALID_ARGUMENT, "INVALID_ARGUMENT");
  17. test(Error::TIME_NOT_AVAILABLE, "TIME_NOT_AVAILABLE");
  18. test(Error::SLEEP_INTERRUPTED, "SLEEP_INTERRUPTED");
  19. test(Error::THREAD_ERROR, "THREAD_ERROR");
  20. test(Error::MUTEX_ERROR, "MUTEX_ERROR");
  21. test(Error::EXISTING_KEY, "EXISTING_KEY");
  22. test(Error::CANNOT_OPEN_FILE, "CANNOT_OPEN_FILE");
  23. test(Error::END_OF_FILE, "END_OF_FILE");
  24. test(static_cast<Error>(200), "?");
  25. }