2017-04-11 21:13:36 +00:00
|
|
|
#include <wctype.h>
|
|
|
|
#include <newlib.h>
|
|
|
|
#include "check.h"
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
wctype_t x;
|
|
|
|
|
|
|
|
x = wctype ("alpha");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'a', x) && iswalpha (L'a'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("alnum");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'0', x) && iswalnum (L'0'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("blank");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L' ', x) && iswblank (L' '));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("cntrl");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'\n', x) && iswcntrl (L'\n'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("digit");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'7', x) && iswdigit (L'7'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("graph");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'!', x) && iswgraph (L'!'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("lower");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'k', x) && iswlower (L'k'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("print");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'@', x) && iswprint (L'@'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("punct");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'.', x) && iswpunct (L'.'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("space");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'\t', x) && iswspace (L'\t'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("upper");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'T', x) && iswupper (L'T'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("xdigit");
|
|
|
|
CHECK (x != 0);
|
2017-10-07 00:16:47 +00:00
|
|
|
CHECK (iswctype (L'B', x) && iswxdigit (L'B'));
|
2017-04-11 21:13:36 +00:00
|
|
|
|
|
|
|
x = wctype ("unknown");
|
|
|
|
CHECK (x == 0);
|
|
|
|
|
|
|
|
exit (0);
|
|
|
|
}
|