libc_error.cpp 600 B

1234567891011121314151617181920212223242526272829303132
  1. #include<__vic/error.h>
  2. #include<iostream>
  3. #include<exception>
  4. #include<cstring>
  5. #include<cassert>
  6. void run_tests()
  7. {
  8. __vic::libc_error ex1("My prompt", ERANGE);
  9. std::cout << ex1.what() << '\n';
  10. __vic::libc_error ex2(ERANGE);
  11. std::cout << ex2.what() << '\n';
  12. __vic::libc_error ex3("Current error");
  13. std::cout << ex3.what() << '\n';
  14. __vic::libc_error ex4;
  15. std::cout << ex4.what() << '\n';
  16. }
  17. int main()
  18. {
  19. try
  20. {
  21. run_tests();
  22. return 0;
  23. }
  24. catch(const std::exception &ex)
  25. {
  26. std::cerr << ex.what() << '\n';
  27. }
  28. return 1;
  29. }