Update.
[glibc.git] / localedata / tests-mbwc / dat_swscanf.c
blobcce5b336e64e53719386f105c3249cf6506d2bfd
1 /*
2 * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
4 * FILE: dat_swscanf.c
6 * SWSCANF: int swscanf (const wchar_t *s, const wchar_t *fmt, ...);
7 */
10 #include <errno.h>
11 #include <stdlib.h>
12 #include "tst_types.h"
13 #include "tgn_locdef.h"
16 TST_SWSCANF tst_swscanf_loc [] =
19 { Tswscanf, TST_LOC_de },
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: "ÄÜ" */
29 L"%d:%u:%f:%c:%s", 0
31 { 1,0,1,5,
32 -1, 2, 3.3, 'ä', "ÄÜ", { 0x0000, },
35 /*------------------------ 02 -----------------------*/
36 { { {
37 0x00E4, 0x00C4, 0x0000 /* "äÄ" */
39 L"%lc", 'C'
41 { 1,0,1,1,
42 0,0,0,0,"", { 0x00E4, 0x0000 },
45 /*------------------------ 03 -----------------------*/
46 { { {
47 0x00E4, 0x00C4, 0x0000 /* "äÄ" */
49 L"%ls", 'S'
51 { 1,0,1,1,
52 0,0,0,0,"", { 0x00E4, 0x00C4, 0x0000 },
55 /*------------------------ 04 -----------------------*/
56 /* <NO_WAIVER> x 2 */
57 { { {
58 0x00E4, 0x00C4, 0x0000 /* "äÄ" */
60 L"1%d:2%d:3%d:4%d:5%d:6%d:7%d:8%d:9%d", 0
62 #ifdef SHOJI_IS_RIGHT
63 { 1,EINVAL,1,WEOF,
64 0,0,0,0,"", { 0x0000 },
65 #else
66 { 0,0,1,0,
67 0,0,0,0,"", { 0x0000 },
68 #endif
71 /*---------------------------------------------------*/
72 { is_last: 1} /* Last element. */
76 { Tswscanf, TST_LOC_enUS },
78 /*------------------------ 01 -----------------------*/
79 { { { 0x002D, 0x0031, 0x003A,
80 0x0032, 0x003A,
81 0x0035, 0x0034, 0x002E, 0x0033, 0x0045, 0x002D, 0x0031, 0x003A,
82 0x0041, 0x003A,
83 0x0061, 0x0062, 0x0000, 0x0000,
85 L"%d:%u:%f:%c:%s", 0
87 { 1,0,1,5,
88 -1, 2, 5.43, 'A', "ab", { 0x0000 },
91 /*------------------------ 02 -----------------------*/
92 /* <NO_WAIVER> x 2 */
93 { { {
94 0x0063, 0x0064, 0x0000
96 L"%C", 'C'
98 { 1,0,1,1,
99 0,0,0,0,"", { 0x0063, 0x0000 },
102 /*------------------------ 03 -----------------------*/
103 { { {
104 0x0063, 0x0064, 0x0000
106 L"%S", 'S'
108 { 1,0,1,1,
109 0,0,0,0,"", { 0x0063, 0x0064, 0x0000 },
112 /*---------------------------------------------------*/
113 { is_last: 1} /* Last element. */
117 { Tswscanf, TST_LOC_eucJP },
119 /*------------------------ 01 -----------------------*/
120 { { { 0x002D, 0x0031, 0x003A,
121 0x0032, 0x003A,
122 0x0033, 0x002E, 0x0033, 0x003A,
123 0x0062, 0x003A,
124 0x0061, 0x0062, 0x0000, 0x0000,
126 L"%d:%u:%f:%c:%s", 0
128 { 1,0,1,5,
129 -1, 2, 3.3, 'b', "ab", { 0x0000 }
132 /*------------------------ 02 -----------------------*/
133 { { {
134 0x30A2, 0x30A4, 0x0000
136 L"%ls", 'S'
138 { 1,0,1,1,
139 0,0,0,0,"", { 0x30A2, 0x30A4, 0x0000 }
142 /*------------------------ 03 -----------------------*/
143 { { {
144 0x0031, 0x003A,
145 0x0030, 0x003A,
146 0x0033, 0x002E, 0x0039, 0x003A,
147 0x0061, 0x003A,
148 0x0063, 0x0064, 0x0000, 0x0000,
150 L"%2$d:%1$u:%3$f:%4$c:%5$s", 0
152 { 1,0,1,5,
153 0, 1, 3.9, 'a', "cd", { 0x0000 }
156 #ifdef SHOJI_IS_RIGHT
157 /* XXX This test does not make sense. The format string is
158 L"\x1\x2\x25\x53" and it is supposed to match the words
159 0x30A2, 0x30A4, 0x0001. */
160 /*------------------------ 04 -----------------------*/
161 /* <NO_WAIVER> x 2 */
162 { { {
163 0x30A2, 0x30A4, 0x0001, 0x0000
165 { 0x0001,0x0002,0x0025,0x0053,0x0000 }, 'S'
167 { 1,EILSEQ,1,EOF,
168 0,0,0,0,"", { 0x0000 }
171 #endif
172 /*---------------------------------------------------*/
173 { is_last: 1} /* Last element. */
177 { Tswscanf, TST_LOC_end }