1 /* 2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY 3 * 4 * FILE: dat_strcoll.c 5 * 6 * STRCOLL: int strcoll (const char *s1, const char *s2); 7 */ 8 9 /* 10 NOTE: 11 12 If a return value is expected to be 0, set ret_flg=1 and the 13 expected value = 0. If a return value is expected to be a 14 positive/negative value, set ret_flg=0, and set the expected value 15 = +1/-1. 16 There is inconsistensy between tst_strcoll() and tst_wcscoll()(it 17 has cmp_flg) for input data. I'll fix it. 18 19 Assuming en_US to be en_US.ascii. (maybe, should be iso8859-1). 20 21 22 23 ASCII CODE : A,B,C, ... , a, b, c, ... B,a:-1 a,B:+1 24 DICTIONARY : A,a,B,b,C,c,.... a,B:-1 B,a:+1 */ 25 26 TST_STRCOLL tst_strcoll_loc [] = { 27 { 28 { Tstrcoll, TST_LOC_de }, 29 { 30 { /*input.*/ { "�BCDEFG", "�BCDEFG" }, /* #1 */ 31 /*expect*/ { 0,1,0, }, 32 }, 33 { /*input.*/ { "XX � XX", "XX B XX" }, /* #2 */ 34 /*expect*/ { 0,0,-1, }, 35 }, 36 { /*input.*/ { "XX B XX", "XX � XX" }, /* #3 */ 37 /*expect*/ { 0,0,+1, }, 38 }, 39 { /*input.*/ { "B", "a" }, /* #4 */ 40 /*expect*/ { 0,0,+1, }, 41 }, 42 { /*input.*/ { "a", "B" }, /* #5 */ 43 /*expect*/ { 0,0,-1, }, 44 }, 45 { /*input.*/ { "b", "A" }, /* #6 */ 46 /*expect*/ { 0,0,+1, }, 47 }, 48 { /*input.*/ { "A", "b" }, /* #7 */ 49 /*expect*/ { 0,0,-1, }, 50 }, 51 { /*input.*/ { "�", "B" }, /* #8 */ 52 /*expect*/ { 0,0,-1, }, 53 }, 54 { /*input.*/ { "B", "�" }, /* #9 */ 55 /*expect*/ { 0,0,+1, }, 56 }, 57 { .is_last = 1 } /* Last element. */ 58 } 59 }, 60 { 61 { Tstrcoll, TST_LOC_enUS }, 62 { 63 { /*input.*/ { "ABCDEFG", "ABCDEFG" }, /* #1 */ 64 /*expect*/ { 0,1,0, }, 65 }, 66 { /*input.*/ { "XX a XX", "XX B XX" }, /* #2 */ 67 /*expect*/ { 0,0,-1, }, 68 }, 69 { /*input.*/ { "XX B XX", "XX a XX" }, /* #3 */ 70 /*expect*/ { 0,0,+1, }, 71 }, 72 { 73 /* <WAIVER> */ 74 /*input.*/ { "B", "a" }, /* #4 */ 75 /* XXX We are not testing the C locale. */ 76 /*expect*/ { 0,0,+1, }, 77 }, 78 { 79 /* <WAIVER> */ 80 /*input.*/ { "a", "B" }, /* #5 */ 81 /* XXX We are not testing the C locale. */ 82 /*expect*/ { 0,0,-1, }, 83 }, 84 { /*input.*/ { "b", "A" }, /* #6 */ 85 /*expect*/ { 0,0,+1, }, 86 }, 87 { /*input.*/ { "A", "b" }, /* #7 */ 88 /*expect*/ { 0,0,-1, }, 89 }, 90 #ifdef NO_WAIVER 91 /* XXX I do not yet know whether strcoll really should reject 92 characters outside the multibyte character range. */ 93 { 94 /* #8 */ /* <WAIVER> */ 95 /*input.*/ { "\244\242\244\244\244\246\244\250\244\252", "ABCDEFG" }, 96 /*expect*/ { EINVAL,0,0, }, 97 }, 98 { 99 /* #9 */ /* <WAIVER> */ 100 /*input.*/ { "ABCZEFG", "\244\242\244\244\244\246\244\250\244\252" }, 101 /*expect*/ { EINVAL,0,0, }, 102 }, 103 #endif 104 { .is_last = 1 } /* Last element. */ 105 } 106 }, 107 { 108 { Tstrcoll, TST_LOC_eucJP }, 109 { 110 { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252", 111 "\244\242\244\244\244\246\244\250\244\252" }, /* #1 */ 112 /*expect*/ { 0,1,0, }, 113 }, 114 { /*input.*/ { "\244\242\244\244\244\246\244\250\244\252", 115 "\244\242\244\244\244\363\244\250\244\252" }, /* #2 */ 116 /*expect*/ { 0,0,-1, }, 117 }, 118 { /*input.*/ { "\244\242\244\244\244\363\244\250\244\252", 119 "\244\242\244\244\244\246\244\250\244\252" }, /* #3 */ 120 /*expect*/ { 0,0,+1, }, 121 }, 122 { /*input.*/ { "B", "a" }, /* #4 */ 123 /*expect*/ { 0,0,-1, }, 124 }, 125 { /*input.*/ { "a", "B" }, /* #5 */ 126 /*expect*/ { 0,0,+1, }, 127 }, 128 { /*input.*/ { "b", "A" }, /* #6 */ 129 /*expect*/ { 0,0,+1, }, 130 }, 131 { /*input.*/ { "A", "b" }, /* #7 */ 132 /*expect*/ { 0,0,-1, }, 133 }, 134 #ifdef NO_WAIVER 135 /* XXX I do not yet know whether strcoll really should reject 136 characters outside the multibyte character range. */ 137 { 138 /* <WAIVER> */ 139 /*input.*/ { "\200\216\217", "ABCDEFG" }, /* #8 */ 140 /*expect*/ { EINVAL,0,0, }, 141 }, 142 { 143 /* <WAIVER> */ 144 /*input.*/ { "ABCZEFG", "\200\216\217" }, /* #9 */ 145 /*expect*/ { EINVAL,0,0, }, 146 }, 147 #endif 148 { .is_last = 1 } /* Last element. */ 149 } 150 }, 151 { 152 { Tstrcoll, TST_LOC_end } 153 } 154 }; 155