lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY |
| 3 | * |
| 4 | * FILE: dat_mbstowcs.c |
| 5 | * |
| 6 | * MBSTOWCS: size_t mbstowcs (wchar_t *ws, char *s, size_t n); |
| 7 | */ |
| 8 | |
| 9 | #include <limits.h> |
| 10 | |
| 11 | TST_MBSTOWCS tst_mbstowcs_loc [] = { |
| 12 | { |
| 13 | { Tmbstowcs, TST_LOC_de }, |
| 14 | { |
| 15 | { /*----------------- #01 -----------------*/ |
| 16 | { |
| 17 | { |
| 18 | { 1, 1, "ABC", 4 }, |
| 19 | { 1, 1, "ABC", 3 }, |
| 20 | { 1, 1, "ABC", 2 }, |
| 21 | } |
| 22 | }, |
| 23 | { |
| 24 | { |
| 25 | { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 26 | { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 27 | { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 28 | } |
| 29 | } |
| 30 | }, |
| 31 | { /*----------------- #02 -----------------*/ |
| 32 | { |
| 33 | { |
| 34 | { 1, 1, "ABC", 4 }, |
| 35 | { 1, 1, "", 1 }, |
| 36 | { 0, 1, "ABC", 4 }, |
| 37 | } |
| 38 | }, |
| 39 | { |
| 40 | { |
| 41 | { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 42 | { 0,1,0, { 0x0000 } }, |
| 43 | { 0,1,3, { 0x0000 } }, |
| 44 | } |
| 45 | } |
| 46 | }, |
| 47 | { .is_last = 1 } |
| 48 | } |
| 49 | }, |
| 50 | { |
| 51 | { Tmbstowcs, TST_LOC_enUS }, |
| 52 | { |
| 53 | { /*----------------- #01 -----------------*/ |
| 54 | { |
| 55 | { |
| 56 | { 1, 1, "ABC", 4 }, |
| 57 | { 1, 1, "ABC", 3 }, |
| 58 | { 1, 1, "ABC", 2 }, |
| 59 | } |
| 60 | }, |
| 61 | { |
| 62 | { |
| 63 | { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 64 | { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 65 | { 0,1,2, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 66 | } |
| 67 | } |
| 68 | }, |
| 69 | { /*----------------- #02 -----------------*/ |
| 70 | { |
| 71 | { |
| 72 | { 1, 1, "ABC", 4 }, |
| 73 | { 1, 1, "", 1 }, |
| 74 | { 0, 1, "ABC", 4 }, |
| 75 | } |
| 76 | }, |
| 77 | { |
| 78 | { |
| 79 | { 0,1,3, { 0x0041,0x0042,0x0043,0x0000 } }, |
| 80 | { 0,1,0, { 0x0000 } }, |
| 81 | { 0,1,3, { 0x0000 } }, |
| 82 | } |
| 83 | } |
| 84 | }, |
| 85 | { .is_last = 1 } |
| 86 | } |
| 87 | }, |
| 88 | #if 0 |
| 89 | { |
| 90 | { Tmbstowcs, TST_LOC_eucJP }, |
| 91 | { |
| 92 | { /*----------------- #01 -----------------*/ |
| 93 | { |
| 94 | { |
| 95 | { 1, 1, "\244\242\244\244\244\246ABC", 7 }, |
| 96 | { 1, 1, "\244\242\244\244\244\246ABC", 6 }, |
| 97 | { 1, 1, "\244\242\244\244\244\246ABC", 4 }, |
| 98 | } |
| 99 | }, |
| 100 | { |
| 101 | { |
| 102 | { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }}, |
| 103 | { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }}, |
| 104 | { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } }, |
| 105 | } |
| 106 | } |
| 107 | }, |
| 108 | { /*----------------- #02 -----------------*/ |
| 109 | { |
| 110 | { |
| 111 | #ifdef SHOJI_IS_RIGHT |
| 112 | /* XXX I really don't understand the first and third line. |
| 113 | the result of the first line is the same as the first |
| 114 | in the last test (i.e., returns 6). Also, the third |
| 115 | test will simply convert everything. */ |
| 116 | { 1, 1, "\244\242\244\244\244\246ABC", 7 }, |
| 117 | { 1, 1, "", 1 }, |
| 118 | { 0, 1, "\244\242\244\244\244\246ABC", 7 }, |
| 119 | #else |
| 120 | { 1, 1, "\244\242\244\244\244\246ABC", 4 }, |
| 121 | { 1, 1, "", 1 }, |
| 122 | { 0, 1, "\244\242\244\244\244\246ABC", 0 }, |
| 123 | #endif |
| 124 | } |
| 125 | }, |
| 126 | { |
| 127 | { |
| 128 | { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } }, |
| 129 | { 0,1,0, { 0x0000 } }, |
| 130 | { 0,1,6, { 0x0000 } }, |
| 131 | } |
| 132 | } |
| 133 | }, |
| 134 | { .is_last = 1 } |
| 135 | } |
| 136 | }, |
| 137 | #else |
| 138 | { |
| 139 | { Tmbstowcs, TST_LOC_ja_UTF8 }, |
| 140 | { |
| 141 | { /*----------------- #01 -----------------*/ |
| 142 | { |
| 143 | { |
| 144 | { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 7 }, |
| 145 | { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 6 }, |
| 146 | { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 4 }, |
| 147 | } |
| 148 | }, |
| 149 | { |
| 150 | { |
| 151 | { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }}, |
| 152 | { 0,1,6, { 0x3042,0x3044,0x3046,0x0041,0x0042,0x0043,0x0000 }}, |
| 153 | { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } }, |
| 154 | } |
| 155 | } |
| 156 | }, |
| 157 | { /*----------------- #02 -----------------*/ |
| 158 | { |
| 159 | { |
| 160 | #ifdef SHOJI_IS_RIGHT |
| 161 | /* XXX I really don't understand the first and third line. |
| 162 | the result of the first line is the same as the first |
| 163 | in the last test (i.e., returns 6). Also, the third |
| 164 | test will simply convert everything. */ |
| 165 | { 1, 1, "\244\242\244\244\244\246ABC", 7 }, |
| 166 | { 1, 1, "", 1 }, |
| 167 | { 0, 1, "\244\242\244\244\244\246ABC", 7 }, |
| 168 | #else |
| 169 | { 1, 1, "\343\201\202\343\201\204\343\201\206ABC", 4 }, |
| 170 | { 1, 1, "", 1 }, |
| 171 | { 0, 1, "\343\201\202\343\201\204\343\201\206ABC", 7 }, |
| 172 | #endif |
| 173 | } |
| 174 | }, |
| 175 | { |
| 176 | { |
| 177 | { 0,1,4, { 0x3042,0x3044,0x3046,0x0041,0x0000 } }, |
| 178 | { 0,1,0, { 0x0000 } }, |
| 179 | { 0,1,6, { 0x0000 } }, |
| 180 | } |
| 181 | } |
| 182 | }, |
| 183 | { .is_last = 1 } |
| 184 | } |
| 185 | }, |
| 186 | #endif |
| 187 | { |
| 188 | { Tmbstowcs, TST_LOC_end } |
| 189 | } |
| 190 | }; |