OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2012-2013, International Business Machines | 4 * Copyright (C) 2012-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: listformattertest.cpp | 8 * file name: listformattertest.cpp |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 2012aug27 | 13 * created on: 2012aug27 |
14 * created by: Umesh P. Nair | 14 * created by: Umesh P. Nair |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 CheckFourCases("ml", one, two, three, four, results); | 176 CheckFourCases("ml", one, two, three, four, results); |
177 } | 177 } |
178 | 178 |
179 // Formatting in Zulu. | 179 // Formatting in Zulu. |
180 // "and" is used before the last element, and all elements up to (and including)
the penultimate are followed by a comma. | 180 // "and" is used before the last element, and all elements up to (and including)
the penultimate are followed by a comma. |
181 void ListFormatterTest::TestZulu() { | 181 void ListFormatterTest::TestZulu() { |
182 UnicodeString results[4] = { | 182 UnicodeString results[4] = { |
183 one, | 183 one, |
184 "I-" + one + " ne-" + two, | 184 "I-" + one + " ne-" + two, |
185 one + ", " + two + ", no-" + three, | 185 one + ", " + two + ", ne-" + three, |
186 one + ", " + two + ", " + three + ", no-" + four | 186 one + ", " + two + ", " + three + ", ne-" + four |
187 }; | 187 }; |
188 | 188 |
189 CheckFourCases("zu", one, two, three, four, results); | 189 CheckFourCases("zu", one, two, three, four, results); |
190 } | 190 } |
191 | 191 |
192 void ListFormatterTest::TestOutOfOrderPatterns() { | 192 void ListFormatterTest::TestOutOfOrderPatterns() { |
193 UnicodeString results[4] = { | 193 UnicodeString results[4] = { |
194 one, | 194 one, |
195 two + " after " + one, | 195 two + " after " + one, |
196 three + " in the last after " + two + " after the first " + one, | 196 three + " in the last after " + two + " after the first " + one, |
197 four + " in the last after " + three + " after " + two + " after the fir
st " + one | 197 four + " in the last after " + three + " after " + two + " after the fir
st " + one |
198 }; | 198 }; |
199 | 199 |
200 ListFormatData data("{1} after {0}", "{1} after the first {0}", | 200 ListFormatData data("{1} after {0}", "{1} after the first {0}", |
201 "{1} after {0}", "{1} in the last after {0}"); | 201 "{1} after {0}", "{1} in the last after {0}"); |
202 ListFormatter formatter(&data); | 202 ListFormatter formatter(data); |
203 | 203 |
204 UnicodeString input1[] = {one}; | 204 UnicodeString input1[] = {one}; |
205 CheckFormatting(&formatter, input1, 1, results[0]); | 205 CheckFormatting(&formatter, input1, 1, results[0]); |
206 | 206 |
207 UnicodeString input2[] = {one, two}; | 207 UnicodeString input2[] = {one, two}; |
208 CheckFormatting(&formatter, input2, 2, results[1]); | 208 CheckFormatting(&formatter, input2, 2, results[1]); |
209 | 209 |
210 UnicodeString input3[] = {one, two, three}; | 210 UnicodeString input3[] = {one, two, three}; |
211 CheckFormatting(&formatter, input3, 3, results[2]); | 211 CheckFormatting(&formatter, input3, 3, results[2]); |
212 | 212 |
(...skipping 10 matching lines...) Expand all Loading... |
223 case 3: name = "TestEnglishUS"; if (exec) TestEnglishUS(); break; | 223 case 3: name = "TestEnglishUS"; if (exec) TestEnglishUS(); break; |
224 case 4: name = "TestRussian"; if (exec) TestRussian(); break; | 224 case 4: name = "TestRussian"; if (exec) TestRussian(); break; |
225 case 5: name = "TestMalayalam"; if (exec) TestMalayalam(); break; | 225 case 5: name = "TestMalayalam"; if (exec) TestMalayalam(); break; |
226 case 6: name = "TestZulu"; if (exec) TestZulu(); break; | 226 case 6: name = "TestZulu"; if (exec) TestZulu(); break; |
227 case 7: name = "TestOutOfOrderPatterns"; if (exec) TestOutOfOrderPattern
s(); break; | 227 case 7: name = "TestOutOfOrderPatterns"; if (exec) TestOutOfOrderPattern
s(); break; |
228 case 8: name = "Test9946"; if (exec) Test9946(); break; | 228 case 8: name = "Test9946"; if (exec) Test9946(); break; |
229 | 229 |
230 default: name = ""; break; | 230 default: name = ""; break; |
231 } | 231 } |
232 } | 232 } |
OLD | NEW |