readonly_cstring.cpp 503 B

123456789101112131415161718192021222324252627282930
  1. #include<__vic/readonly_cstring.h>
  2. #include<iostream>
  3. #include<exception>
  4. #include<cassert>
  5. void run_tests()
  6. {
  7. static const char cstr[] = "cstring";
  8. __vic::readonly_cstring st(cstr);
  9. assert(!st.empty());
  10. assert(st == cstr);
  11. assert(compare("a", st) < 0);
  12. assert(__vic::readonly_cstring().empty());
  13. }
  14. int main()
  15. {
  16. try
  17. {
  18. run_tests();
  19. return 0;
  20. }
  21. catch(const std::exception &ex)
  22. {
  23. std::cerr << ex.what() << '\n';
  24. }
  25. return 1;
  26. }