1 // Copyright (c) 1999-2018 David Muse
2 // See the file COPYING for more information
3
4 #include <rudiments/error.h>
5 #include <rudiments/charstring.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include "test.cpp"
9
main(int argc,const char ** argv)10 int main(int argc, const char **argv) {
11
12 header("error");
13
14 error::setErrorNumber(EINTR);
15 test("getErrorNumber()",error::getErrorNumber()==EINTR);
16 test("getErrorString()",
17 !charstring::compare(error::getErrorString(),
18 #ifdef _WIN32
19 "Interrupted function call"
20 #else
21 "Interrupted system call"
22 #endif
23 ));
24 error::clearError();
25 test("clearError()/getErrorNumber()",!error::getErrorNumber());
26
27 //stdoutput.printf("\"%s\"\n",error::getErrorString());
28 const char *success[]={
29 "Success",
30 "No error",
31 "No error: 0",
32 "Error 0",
33 "Unknown error",
34 "Unknown error: 0",
35 "Undefined error: 0",
36 NULL
37 };
38 test("clearError()/getErrorString()",
39 charstring::inSet(error::getErrorString(),success));
40 }
41