blob: 0c672d3d79719ab94c7eb9a39cee7663e31058d9 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
2 * TEST SUITE FOR MB/WC FUNCTIONS IN CLIBRARY
3 *
4 * FILE: dat_strxfrm.c
5 *
6 * STRXFRM: size_t strxfrm (char *s1, const char s2, size_t n);
7 */
8
9
10/*
11 * NOTE:
12 *
13 * Return value and errno value are checked only for 2nd string:
14 * org2[]; n1 and n2 don't mean bytes to be translated.
15 * It means a buffer size including a null character.
16 * Results of this test depens on results of strcoll().
17 * If you got errors, check both test results.
18 *
19 * The buffer size should be enough to contain a string including a
20 * null char. Returns the number of bytes of the string (NOT
21 * including a null char).
22 */
23
24
25
26TST_STRXFRM tst_strxfrm_loc [] = {
27 {
28 { Tstrxfrm, TST_LOC_de },
29 {
30 { /*inp*/ { "\xf6\xc4\xe4\xfc", "\xf6\xc4\xe4\xfc", 17, 17 }, /* #01 */
31 /*exp*/ { 0,0,0, },
32 },
33 { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */
34 /*exp*/ { 0,0,0 , },
35 },
36 { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */
37 /*exp*/ { 0,0,0, },
38 },
39 { /*inp*/ { "abc", "", 13, 13 }, /* #04 */
40 /*exp*/ { 0,0,0, },
41 },
42 { /*inp*/ { "a", "B", 7, 7 }, /* #05 */
43 /*exp*/ { 0,0,0, },
44 },
45 { /*inp*/ { "B", "a", 7, 7 }, /* #06 */
46 /*exp*/ { 0,0,0, },
47 },
48 {
49 /* hiragana == latin1 */
50 /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */
51 /*exp*/ { 0,0,0, },
52 },
53 { .is_last = 1 }
54 }
55 },
56 {
57 { Tstrxfrm, TST_LOC_enUS },
58 {
59 { /*inp*/ { "abcd", "abcd", 17, 17 }, /* #01 */
60 /*exp*/ { 0,0,0, },
61 },
62 { /*inp*/ { "aA", "Aa", 10, 10 }, /* #02 */
63 /*exp*/ { 0,0,0 , },
64 },
65 { /*inp*/ { "Aa", "aA", 10, 10 }, /* #03 */
66 /*exp*/ { 0,0,0, },
67 },
68 { /*inp*/ { "abc", "", 13, 13 }, /* #04 */
69 /*exp*/ { 0,0,0, },
70 },
71 { /*inp*/ { "a", "B", 7, 7 }, /* #05 */
72 /*exp*/ { 0,0,0, },
73 },
74 { /*inp*/ { "B", "a", 7, 7 }, /* #06 */
75 /*exp*/ { 0,0,0, },
76 },
77#ifdef NO_WAIVER
78 {
79 /* <WAIVER> */
80 /*inp*/ { "abc", "\244\241\244\242", 13, 9 }, /* #07 */
81 /*exp*/ { EINVAL,0,0, },
82 },
83#endif
84 { .is_last = 1 }
85 }
86 },
87#if 0
88 {
89 { Tstrxfrm, TST_LOC_eucJP }, /* ??? */
90 {
91 {
92 /* #01 */
93 /*inp*/ { "\244\242\244\241", "\244\241\244\242", 5, 5 },
94 /*exp*/ { 0,0,0, },
95 },
96 {
97 /* #02 */
98 /*inp*/ { "\244\241\244\242", "\244\242\244\241", 5, 5 },
99 /*exp*/ { 0,0,0, },
100 },
101 {
102 /* #03 */
103 /*inp*/ { "\244\242\216\261", "\216\261\244\242", 5, 5 },
104 /*exp*/ { 0,0,0, },
105 },
106#ifdef NO_WAIVER
107 {
108 /*inp*/ { "AAA", "\216\217", 5, 5 }, /* #04 */ /* <WAIVER> */
109 /*exp*/ { EINVAL,0,0, },
110 },
111#endif
112 { .is_last = 1 }
113 }
114 },
115#else
116 {
117 { Tstrxfrm, TST_LOC_ja_UTF8 }, /* ??? */
118 {
119 {
120 /* #01 */
121 /*inp*/ { "\343\201\202\343\201\201", "\343\201\201\343\201\202", 7, 7 },
122 /*exp*/ { 0,0,0, },
123 },
124 {
125 /* #02 */
126 /*inp*/ { "\343\201\201\343\201\202", "\343\201\202\343\201\201", 7, 7 },
127 /*exp*/ { 0,0,0, },
128 },
129 {
130 /* #03 */
131 /*inp*/ { "\343\201\202\357\275\261", "\357\275\261343\201\202", 7, 7 },
132 /*exp*/ { 0,0,0, },
133 },
134#ifdef NO_WAIVER
135 {
136 /*inp*/ { "AAA", "\340\277\220", 5, 5 }, /* #04 */ /* <WAIVER> */
137 /*exp*/ { EINVAL,0,0, },
138 },
139#endif
140 { .is_last = 1 }
141 }
142 },
143#endif
144 {
145 { Tstrxfrm, TST_LOC_end }
146 }
147};