lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY |
| 3 | * |
| 4 | * FILE: dat_swscanf.c |
| 5 | * |
| 6 | * SWSCANF: int swscanf (const wchar_t *s, const wchar_t *fmt, ...); |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | #include <errno.h> |
| 11 | #include <stdlib.h> |
| 12 | #include "tst_types.h" |
| 13 | #include "tgn_locdef.h" |
| 14 | |
| 15 | |
| 16 | TST_SWSCANF tst_swscanf_loc [] = |
| 17 | { |
| 18 | { |
| 19 | { Tswscanf, TST_LOC_de }, |
| 20 | { |
| 21 | /*------------------------ 01 -----------------------*/ |
| 22 | { { { |
| 23 | 0x002D, 0x0031, 0x003A, /* %d: -1 */ |
| 24 | 0x0032, 0x003A, /* %u: 2 */ |
| 25 | 0x0033, 0x002C, 0x0033, 0x003A, /* %f: 3.3 */ |
| 26 | 0x00E4, 0x003A, /* %c: 'ä' */ |
| 27 | 0x00C4, 0x00DC, 0x0000, 0x0000, /* %s: "ÄÜ" */ |
| 28 | }, |
| 29 | L"%d:%u:%f:%c:%s", 0 |
| 30 | }, |
| 31 | { /* The fields are: err_val, ret_flag, ret_val, |
| 32 | val_int, val_uns, val_flt, val_c, val_s, val_S. */ |
| 33 | 0,1,5, |
| 34 | -1, 2, 3.3, 'ä', "ÄÜ", { 0x0000, }, |
| 35 | }, |
| 36 | }, |
| 37 | /*------------------------ 02 -----------------------*/ |
| 38 | { { { |
| 39 | 0x00E4, 0x00C4, 0x0000 /* "äÄ" */ |
| 40 | }, |
| 41 | L"%lc", 'C' |
| 42 | }, |
| 43 | { 0,1,1, |
| 44 | 0,0,0,0,"", { 0x00E4, 0x0000 }, |
| 45 | }, |
| 46 | }, |
| 47 | /*------------------------ 03 -----------------------*/ |
| 48 | { { { |
| 49 | 0x00E4, 0x00C4, 0x0000 /* "äÄ" */ |
| 50 | }, |
| 51 | L"%ls", 'S' |
| 52 | }, |
| 53 | { 0,1,1, |
| 54 | 0,0,0,0,"", { 0x00E4, 0x00C4, 0x0000 }, |
| 55 | }, |
| 56 | }, |
| 57 | /*------------------------ 04 -----------------------*/ |
| 58 | /* <NO_WAIVER> x 2 */ |
| 59 | { { { |
| 60 | 0x00E4, 0x00C4, 0x0000 /* "äÄ" */ |
| 61 | }, |
| 62 | L"1%d:2%d:3%d:4%d:5%d:6%d:7%d:8%d:9%d", 0 |
| 63 | }, |
| 64 | #ifdef SHOJI_IS_RIGHT |
| 65 | { 1,EINVAL,1,WEOF, |
| 66 | 0,0,0,0,"", { 0x0000 }, |
| 67 | #else |
| 68 | { 0,1,0, |
| 69 | 0,0,0,0,"", { 0x0000 }, |
| 70 | #endif |
| 71 | }, |
| 72 | }, |
| 73 | /*---------------------------------------------------*/ |
| 74 | { .is_last = 1} /* Last element. */ |
| 75 | } |
| 76 | }, |
| 77 | { |
| 78 | { Tswscanf, TST_LOC_enUS }, |
| 79 | { |
| 80 | /*------------------------ 01 -----------------------*/ |
| 81 | { { { 0x002D, 0x0031, 0x003A, |
| 82 | 0x0032, 0x003A, |
| 83 | 0x0035, 0x0034, 0x002E, 0x0033, 0x0045, 0x002D, 0x0031, 0x003A, |
| 84 | 0x0041, 0x003A, |
| 85 | 0x0061, 0x0062, 0x0000, 0x0000, |
| 86 | }, |
| 87 | L"%d:%u:%f:%c:%s", 0 |
| 88 | }, |
| 89 | { 0,1,5, |
| 90 | -1, 2, 5.43, 'A', "ab", { 0x0000 }, |
| 91 | }, |
| 92 | }, |
| 93 | /*------------------------ 02 -----------------------*/ |
| 94 | /* <NO_WAIVER> x 2 */ |
| 95 | { { { |
| 96 | 0x0063, 0x0064, 0x0000 |
| 97 | }, |
| 98 | L"%C", 'C' |
| 99 | }, |
| 100 | { 0,1,1, |
| 101 | 0,0,0,0,"", { 0x0063, 0x0000 }, |
| 102 | }, |
| 103 | }, |
| 104 | /*------------------------ 03 -----------------------*/ |
| 105 | { { { |
| 106 | 0x0063, 0x0064, 0x0000 |
| 107 | }, |
| 108 | L"%S", 'S' |
| 109 | }, |
| 110 | { 0,1,1, |
| 111 | 0,0,0,0,"", { 0x0063, 0x0064, 0x0000 }, |
| 112 | }, |
| 113 | }, |
| 114 | /*---------------------------------------------------*/ |
| 115 | { .is_last = 1} /* Last element. */ |
| 116 | } |
| 117 | }, |
| 118 | { |
| 119 | #if 0 |
| 120 | { Tswscanf, TST_LOC_eucJP }, |
| 121 | #else |
| 122 | { Tswscanf, TST_LOC_ja_UTF8 }, |
| 123 | #endif |
| 124 | { |
| 125 | /*------------------------ 01 -----------------------*/ |
| 126 | { { { 0x002D, 0x0031, 0x003A, |
| 127 | 0x0032, 0x003A, |
| 128 | 0x0033, 0x002E, 0x0033, 0x003A, |
| 129 | 0x0062, 0x003A, |
| 130 | 0x0061, 0x0062, 0x0000, 0x0000, |
| 131 | }, |
| 132 | L"%d:%u:%f:%c:%s", 0 |
| 133 | }, |
| 134 | { 0,1,5, |
| 135 | -1, 2, 3.3, 'b', "ab", { 0x0000 } |
| 136 | }, |
| 137 | }, |
| 138 | /*------------------------ 02 -----------------------*/ |
| 139 | { { { |
| 140 | 0x30A2, 0x30A4, 0x0000 |
| 141 | }, |
| 142 | L"%ls", 'S' |
| 143 | }, |
| 144 | { 0,1,1, |
| 145 | 0,0,0,0,"", { 0x30A2, 0x30A4, 0x0000 } |
| 146 | }, |
| 147 | }, |
| 148 | /*------------------------ 03 -----------------------*/ |
| 149 | { { { |
| 150 | 0x0031, 0x003A, |
| 151 | 0x0030, 0x003A, |
| 152 | 0x0033, 0x002E, 0x0039, 0x003A, |
| 153 | 0x0061, 0x003A, |
| 154 | 0x0063, 0x0064, 0x0000, 0x0000, |
| 155 | }, |
| 156 | L"%2$d:%1$u:%3$f:%4$c:%5$s", 0 |
| 157 | }, |
| 158 | { 0,1,5, |
| 159 | 0, 1, 3.9, 'a', "cd", { 0x0000 } |
| 160 | }, |
| 161 | }, |
| 162 | #ifdef SHOJI_IS_RIGHT |
| 163 | /* XXX This test does not make sense. The format string is |
| 164 | L"\x1\x2\x25\x53" and it is supposed to match the words |
| 165 | 0x30A2, 0x30A4, 0x0001. */ |
| 166 | /*------------------------ 04 -----------------------*/ |
| 167 | /* <NO_WAIVER> x 2 */ |
| 168 | { { { |
| 169 | 0x30A2, 0x30A4, 0x0001, 0x0000 |
| 170 | }, |
| 171 | { 0x0001,0x0002,0x0025,0x0053,0x0000 }, 'S' |
| 172 | }, |
| 173 | { EILSEQ,1,EOF, |
| 174 | 0,0,0,0,"", { 0x0000 } |
| 175 | }, |
| 176 | }, |
| 177 | #endif |
| 178 | /*---------------------------------------------------*/ |
| 179 | { .is_last = 1} /* Last element. */ |
| 180 | } |
| 181 | }, |
| 182 | { |
| 183 | { Tswscanf, TST_LOC_end } |
| 184 | } |
| 185 | }; |