| 1 | /*
|
|---|
| 2 | * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
|
|---|
| 3 | *
|
|---|
| 4 | * FILE: dat_towctrans.c
|
|---|
| 5 | *
|
|---|
| 6 | * TOWCTRANS: wint_t towctrans (wint_t wc, wctrans_t charclass);
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | #include <errno.h>
|
|---|
| 10 | #include <stdlib.h>
|
|---|
| 11 | #include <wctype.h>
|
|---|
| 12 | #include "tst_types.h"
|
|---|
| 13 | #include "tgn_locdef.h"
|
|---|
| 14 |
|
|---|
| 15 | /*
|
|---|
| 16 | * NOTE:
|
|---|
| 17 | * Set ret_flg = 1, when a return value is expected to be 0 (FALSE).
|
|---|
| 18 | * Set ret_flg = 0, when a return value is expected to be non-zero (TRUE).
|
|---|
| 19 | *
|
|---|
| 20 | * Since the functions return *non*-zero value for TRUE, can't
|
|---|
| 21 | * compare an actual return value with an expected return value.
|
|---|
| 22 | * Set the ret_flg=0 for TRUE cases and the tst_isw*() will check
|
|---|
| 23 | * the non-zero value.
|
|---|
| 24 | *
|
|---|
| 25 | * { { WEOF }, { 0,0,1,0 } },
|
|---|
| 26 | * | |
|
|---|
| 27 | * | ret_val: an expected return value
|
|---|
| 28 | * ret_flg: if 1, compare an actual return value with the
|
|---|
| 29 | * ret_val; if 0, the test program checks
|
|---|
| 30 | * the actual return value.
|
|---|
| 31 | *
|
|---|
| 32 | * CAUTION: if a charclass is invalid, the test function gives
|
|---|
| 33 | * towctrans() an invalid wctrans object instead of a return value
|
|---|
| 34 | * from wctrans() which is supposed to be 0.
|
|---|
| 35 | */
|
|---|
| 36 |
|
|---|
| 37 | TST_TOWCTRANS tst_towctrans_loc [] = {
|
|---|
| 38 | {
|
|---|
| 39 | { Ttowctrans, TST_LOC_C },
|
|---|
| 40 | {
|
|---|
| 41 | #ifdef SHOJI_IS_RIGHT
|
|---|
| 42 | { { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 } },
|
|---|
| 43 | #else
|
|---|
| 44 | { { 0x0010, "xxxxxxx" }, { 0, 1,0x0010 } },
|
|---|
| 45 | #endif
|
|---|
| 46 | { { 0x007F, "tolower" }, { 0, 1,0x007F } },
|
|---|
| 47 | { { 0x0061, "toupper" }, { 0, 1,0x0041 } },
|
|---|
| 48 | { { 0x0041, "tolower" }, { 0, 1,0x0061 } },
|
|---|
| 49 | { .is_last = 1 }
|
|---|
| 50 | }
|
|---|
| 51 | },
|
|---|
| 52 | {
|
|---|
| 53 | { Ttowctrans, TST_LOC_de },
|
|---|
| 54 | {
|
|---|
| 55 | #ifdef SHOJI_IS_RIGHT
|
|---|
| 56 | { { 0x0010, "tojkata" }, { EINVAL,1,0x0010 } },
|
|---|
| 57 | #else
|
|---|
| 58 | { { 0x0010, "tojkata" }, { 0, 1,0x0010 } },
|
|---|
| 59 | #endif
|
|---|
| 60 | { { 0x0080, "tolower" }, { 0, 1,0x0080 } },
|
|---|
| 61 | { { 0x00EC, "toupper" }, { 0, 1,0x00CC } },
|
|---|
| 62 | { { 0x00CC, "tolower" }, { 0, 1,0x00EC } },
|
|---|
| 63 | { .is_last = 1 }
|
|---|
| 64 | }
|
|---|
| 65 | },
|
|---|
| 66 | {
|
|---|
| 67 | { Ttowctrans, TST_LOC_enUS },
|
|---|
| 68 | {
|
|---|
| 69 | #ifdef SHOJI_IS_RIGHT
|
|---|
| 70 | { { 0x0010, "xxxxxxx" }, { EINVAL,1,0x0010 } },
|
|---|
| 71 | #else
|
|---|
| 72 | { { 0x0010, "xxxxxxx" }, { 0, 1,0x0010 } },
|
|---|
| 73 | #endif
|
|---|
| 74 | { { 0x007F, "tolower" }, { 0, 1,0x007F } },
|
|---|
| 75 | { { 0x0061, "toupper" }, { 0, 1,0x0041 } },
|
|---|
| 76 | { { 0x0041, "tolower" }, { 0, 1,0x0061 } },
|
|---|
| 77 | { .is_last = 1 }
|
|---|
| 78 | }
|
|---|
| 79 | },
|
|---|
| 80 | {
|
|---|
| 81 | { Ttowctrans, TST_LOC_eucJP },
|
|---|
| 82 | {
|
|---|
| 83 | { { 0xFF21, "tolower" }, { 0, 1,0xFF41 } },
|
|---|
| 84 | { { 0xFF41, "toupper" }, { 0, 1,0xFF21 } },
|
|---|
| 85 | { { 0x30A1, "tojhira" }, { 0, 1,0x3041 } },
|
|---|
| 86 | { { 0x3041, "tojkata" }, { 0, 1,0x30A1 } },
|
|---|
| 87 | { .is_last = 1 }
|
|---|
| 88 | }
|
|---|
| 89 | },
|
|---|
| 90 | {
|
|---|
| 91 | { Ttowctrans, TST_LOC_end }
|
|---|
| 92 | }
|
|---|
| 93 | };
|
|---|