123456789101112131415161718192021222324252627282930313233343536373839 |
- #include<__vic/posix/file_stat.h>
- #include<iostream>
- #include<exception>
- #include<cassert>
- void run_tests()
- {
- __vic::posix::file_stat s;
- assert(s.get_if_exists("posix_file_stat.cpp") == true);
- s.get("posix_file_stat.cpp");
- assert(s.is_regular());
- assert(s.get_if_exists("posix_file_stat.doesnotexist") == false);
- try {
- s.get("posix_file_stat.doesnotexist");
- assert(false);
- } catch(const std::exception &) {
- // OK
- }
- struct ::stat ss = s;
- s = ss;
- }
- int main()
- {
- try
- {
- run_tests();
- return 0;
- }
- catch(const std::exception &ex)
- {
- std::cerr << ex.what() << '\n';
- }
- return 1;
- }
|