Initialize Tizen 2.3
[framework/base/tizen-locale.git] / localedata / tests-mbwc / dat_strxfrm.c
1 /*
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
26 TST_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   {
88     { Tstrxfrm, TST_LOC_eucJP },         /* ??? */
89     {
90       {
91         /* #01 */
92         /*inp*/ { "\244\242\244\241",  "\244\241\244\242",   5,  5 },
93         /*exp*/ { 0,0,0,                       },
94       },
95       {
96         /* #02 */
97         /*inp*/ { "\244\241\244\242",  "\244\242\244\241",   5,  5 },
98         /*exp*/ { 0,0,0,                       },
99       },
100       {
101         /* #03 */
102         /*inp*/ { "\244\242\216\261",  "\216\261\244\242",   5,  5 },
103         /*exp*/ { 0,0,0,                       },
104       },
105 #ifdef NO_WAIVER
106       {
107         /*inp*/ { "AAA", "\216\217",     5,  5 },  /* #04 */ /* <WAIVER> */
108         /*exp*/ { EINVAL,0,0,                  },
109       },
110 #endif
111       { .is_last = 1 }
112     }
113   },
114   {
115     { Tstrxfrm, TST_LOC_end }
116   }
117 };