]> pd.if.org Git - pdclib/blob - functions/wctype/wctrans.c
c15bde085c7009b007beb616f8bfba1e0dd1533d
[pdclib] / functions / wctype / wctrans.c
1 /* wctrans( const char * )
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #include <wctype.h>
8 #ifndef REGTEST
9 #include <string.h>
10 #include "_PDCLIB_locale.h"
11
12 wctrans_t wctrans( const char * property )
13 {
14     if(!property) {
15         return 0;
16     } else if(strcmp(property, "tolower") == 0) {
17         return _PDCLIB_WCTRANS_TOLOWER;
18     } else if(strcmp(property, "toupper") == 0) {
19         return _PDCLIB_WCTRANS_TOUPPER;
20     } else {
21         return 0;
22     }
23 }
24
25 #endif
26
27 #ifdef TEST
28 #include "_PDCLIB_test.h"
29
30 int main( void )
31 {
32     TESTCASE(wctrans("") == 0);
33     TESTCASE(wctrans("invalid") == 0);
34     TESTCASE(wctrans("toupper") != 0);
35     TESTCASE(wctrans("tolower") != 0);
36     return TEST_RESULTS;
37 }
38 #endif