| 17 | #endif |
| 18 | |
| 19 | int testStatus(int, char*[]) |
| 20 | { |
| 21 | bool res = true; |
| 22 | { |
| 23 | kwsys::Status status; |
| 24 | if (status.GetKind() != kwsys::Status::Kind::Success) { |
| 25 | std::cerr << "Status default constructor does not produce Success\n"; |
| 26 | res = false; |
| 27 | } |
| 28 | |
| 29 | status = kwsys::Status::Success(); |
| 30 | if (status.GetKind() != kwsys::Status::Kind::Success) { |
| 31 | std::cerr << "Status Success constructor does not produce Success\n"; |
| 32 | res = false; |
| 33 | } |
| 34 | if (!status.IsSuccess()) { |
| 35 | std::cerr << "Status Success gives false IsSuccess\n"; |
| 36 | res = false; |
| 37 | } |
| 38 | if (!status) { |
| 39 | std::cerr << "Status Success kind is not true\n"; |
| 40 | res = false; |
| 41 | } |
| 42 | if (status.GetPOSIX() != 0) { |
| 43 | std::cerr << "Status Success kind does not return POSIX 0\n"; |
| 44 | res = false; |
| 45 | } |
| 46 | #ifdef _WIN32 |
| 47 | if (status.GetWindows() != 0) { |
| 48 | std::cerr << "Status Success kind does not return Windows 0\n"; |
| 49 | res = false; |
| 50 | } |
| 51 | #endif |
| 52 | if (status.GetString() != "Success") { |
| 53 | std::cerr << "Status Success kind does not return \"Success\" string\n"; |
| 54 | res = false; |
| 55 | } |
| 56 | |
| 57 | status = kwsys::Status::POSIX(EINVAL); |
| 58 | if (status.GetKind() != kwsys::Status::Kind::POSIX) { |
| 59 | std::cerr << "Status POSIX constructor does not produce POSIX\n"; |
| 60 | res = false; |
| 61 | } |
| 62 | if (status.IsSuccess()) { |
| 63 | std::cerr << "Status POSIX gives true IsSuccess\n"; |
| 64 | res = false; |
| 65 | } |
| 66 | if (status) { |
| 67 | std::cerr << "Status POSIX kind is not false\n"; |
| 68 | res = false; |
| 69 | } |
| 70 | if (status.GetPOSIX() != EINVAL) { |
| 71 | std::cerr << "Status POSIX kind does not preserve POSIX value\n"; |
| 72 | res = false; |
| 73 | } |
| 74 | #ifdef _WIN32 |
| 75 | if (status.GetWindows() != 0) { |
| 76 | std::cerr << "Status POSIX kind does not return Windows 0\n"; |