]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
57a6839d A |
3 | /* |
4 | ******************************************************************************* | |
2ca993e8 | 5 | * Copyright (C) 2014-2016, International Business Machines Corporation and * |
57a6839d A |
6 | * others. All Rights Reserved. * |
7 | ******************************************************************************* | |
8 | * | |
9 | * File MEASFMTTEST.CPP | |
10 | * | |
11 | ******************************************************************************* | |
12 | */ | |
13 | #include <stdio.h> | |
14 | #include <stdlib.h> | |
15 | ||
16 | #include "intltest.h" | |
17 | ||
18 | #if !UCONFIG_NO_FORMATTING | |
19 | ||
20 | #include "unicode/decimfmt.h" | |
21 | #include "unicode/measfmt.h" | |
22 | #include "unicode/measure.h" | |
23 | #include "unicode/measunit.h" | |
f3c0d7a5 | 24 | #include "unicode/strenum.h" |
57a6839d | 25 | #include "unicode/tmunit.h" |
b331163b | 26 | #include "unicode/plurrule.h" |
f3c0d7a5 | 27 | #include "unicode/ustring.h" |
57a6839d | 28 | #include "charstr.h" |
f3c0d7a5 | 29 | #include "cstr.h" |
b331163b | 30 | #include "unicode/reldatefmt.h" |
57a6839d A |
31 | |
32 | struct ExpectedResult { | |
33 | const Measure *measures; | |
34 | int32_t count; | |
35 | const char *expected; | |
36 | }; | |
37 | ||
38 | class MeasureFormatTest : public IntlTest { | |
39 | public: | |
40 | MeasureFormatTest() { | |
41 | } | |
42 | ||
43 | void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0); | |
44 | private: | |
45 | void TestBasic(); | |
f3c0d7a5 A |
46 | void TestCompatible53(); |
47 | void TestCompatible54(); | |
48 | void TestCompatible55(); | |
49 | void TestCompatible56(); | |
50 | void TestCompatible57(); | |
51 | void TestCompatible58(); | |
52 | void TestCompatible59(); | |
3d1f044b A |
53 | void TestCompatible63(); |
54 | void TestCompatible64(); | |
57a6839d A |
55 | void TestGetAvailable(); |
56 | void TestExamplesInDocs(); | |
57 | void TestFormatPeriodEn(); | |
58 | void Test10219FractionalPlurals(); | |
59 | void TestGreek(); | |
60 | void TestFormatSingleArg(); | |
61 | void TestFormatMeasuresZeroArg(); | |
b331163b A |
62 | void TestSimplePer(); |
63 | void TestNumeratorPlurals(); | |
57a6839d | 64 | void TestMultiples(); |
2ca993e8 | 65 | void TestManyLocaleDurations(); |
57a6839d A |
66 | void TestGram(); |
67 | void TestCurrencies(); | |
f3c0d7a5 | 68 | void TestDisplayNames(); |
57a6839d A |
69 | void TestFieldPosition(); |
70 | void TestFieldPositionMultiple(); | |
71 | void TestBadArg(); | |
72 | void TestEquality(); | |
b331163b | 73 | void TestGroupingSeparator(); |
57a6839d | 74 | void TestDoubleZero(); |
b331163b | 75 | void TestUnitPerUnitResolution(); |
2ca993e8 | 76 | void TestIndividualPluralFallback(); |
3d1f044b | 77 | void Test20332_PersonUnits(); |
57a6839d A |
78 | void verifyFormat( |
79 | const char *description, | |
80 | const MeasureFormat &fmt, | |
81 | const Measure *measures, | |
82 | int32_t measureCount, | |
83 | const char *expected); | |
84 | void verifyFormatWithPrefix( | |
85 | const char *description, | |
86 | const MeasureFormat &fmt, | |
87 | const UnicodeString &prefix, | |
88 | const Measure *measures, | |
89 | int32_t measureCount, | |
90 | const char *expected); | |
91 | void verifyFormat( | |
92 | const char *description, | |
93 | const MeasureFormat &fmt, | |
94 | const ExpectedResult *expectedResults, | |
95 | int32_t count); | |
b331163b A |
96 | void helperTestSimplePer( |
97 | const Locale &locale, | |
98 | UMeasureFormatWidth width, | |
99 | double value, | |
100 | const MeasureUnit &unit, | |
101 | const MeasureUnit &perUnit, | |
102 | const char *expected); | |
103 | void helperTestSimplePer( | |
104 | const Locale &locale, | |
105 | UMeasureFormatWidth width, | |
106 | double value, | |
107 | const MeasureUnit &unit, | |
108 | const MeasureUnit &perUnit, | |
109 | const char *expected, | |
110 | int32_t field, | |
111 | int32_t expected_start, | |
112 | int32_t expected_end); | |
57a6839d A |
113 | void helperTestMultiples( |
114 | const Locale &locale, | |
115 | UMeasureFormatWidth width, | |
116 | const char *expected); | |
2ca993e8 A |
117 | void helperTestManyLocaleDurations( |
118 | const char *localeID, | |
119 | UMeasureFormatWidth width, | |
120 | const Measure *measures, | |
121 | int32_t measureCount, | |
122 | const char *expected); | |
f3c0d7a5 A |
123 | void helperTestDisplayName( |
124 | const MeasureUnit *unit, | |
125 | const char *localeID, | |
126 | UMeasureFormatWidth width, | |
127 | const char *expected); | |
57a6839d A |
128 | void verifyFieldPosition( |
129 | const char *description, | |
130 | const MeasureFormat &fmt, | |
131 | const UnicodeString &prefix, | |
132 | const Measure *measures, | |
133 | int32_t measureCount, | |
134 | NumberFormat::EAlignmentFields field, | |
135 | int32_t start, | |
136 | int32_t end); | |
137 | }; | |
138 | ||
139 | void MeasureFormatTest::runIndexedTest( | |
140 | int32_t index, UBool exec, const char *&name, char *) { | |
141 | if (exec) { | |
142 | logln("TestSuite MeasureFormatTest: "); | |
143 | } | |
144 | TESTCASE_AUTO_BEGIN; | |
145 | TESTCASE_AUTO(TestBasic); | |
f3c0d7a5 A |
146 | TESTCASE_AUTO(TestCompatible53); |
147 | TESTCASE_AUTO(TestCompatible54); | |
148 | TESTCASE_AUTO(TestCompatible55); | |
149 | TESTCASE_AUTO(TestCompatible56); | |
150 | TESTCASE_AUTO(TestCompatible57); | |
151 | TESTCASE_AUTO(TestCompatible58); | |
152 | TESTCASE_AUTO(TestCompatible59); | |
3d1f044b A |
153 | TESTCASE_AUTO(TestCompatible63); |
154 | TESTCASE_AUTO(TestCompatible64); | |
57a6839d A |
155 | TESTCASE_AUTO(TestGetAvailable); |
156 | TESTCASE_AUTO(TestExamplesInDocs); | |
157 | TESTCASE_AUTO(TestFormatPeriodEn); | |
158 | TESTCASE_AUTO(Test10219FractionalPlurals); | |
159 | TESTCASE_AUTO(TestGreek); | |
160 | TESTCASE_AUTO(TestFormatSingleArg); | |
161 | TESTCASE_AUTO(TestFormatMeasuresZeroArg); | |
b331163b A |
162 | TESTCASE_AUTO(TestSimplePer); |
163 | TESTCASE_AUTO(TestNumeratorPlurals); | |
57a6839d | 164 | TESTCASE_AUTO(TestMultiples); |
2ca993e8 | 165 | TESTCASE_AUTO(TestManyLocaleDurations); |
57a6839d A |
166 | TESTCASE_AUTO(TestGram); |
167 | TESTCASE_AUTO(TestCurrencies); | |
f3c0d7a5 | 168 | TESTCASE_AUTO(TestDisplayNames); |
57a6839d A |
169 | TESTCASE_AUTO(TestFieldPosition); |
170 | TESTCASE_AUTO(TestFieldPositionMultiple); | |
171 | TESTCASE_AUTO(TestBadArg); | |
172 | TESTCASE_AUTO(TestEquality); | |
b331163b | 173 | TESTCASE_AUTO(TestGroupingSeparator); |
57a6839d | 174 | TESTCASE_AUTO(TestDoubleZero); |
b331163b | 175 | TESTCASE_AUTO(TestUnitPerUnitResolution); |
2ca993e8 | 176 | TESTCASE_AUTO(TestIndividualPluralFallback); |
3d1f044b | 177 | TESTCASE_AUTO(Test20332_PersonUnits); |
57a6839d A |
178 | TESTCASE_AUTO_END; |
179 | } | |
180 | ||
f3c0d7a5 | 181 | void MeasureFormatTest::TestCompatible53() { |
b331163b A |
182 | UErrorCode status = U_ZERO_ERROR; |
183 | LocalPointer<MeasureUnit> measureUnit; | |
184 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
185 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
186 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
187 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
188 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
189 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
190 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
191 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
192 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
193 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
194 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
195 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
196 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
197 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
198 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
199 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
200 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
201 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
202 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
203 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
204 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
205 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
206 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
207 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
208 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
209 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
210 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
211 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
212 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
213 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
214 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
215 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
216 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
217 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
218 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
219 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
220 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
221 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
222 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
223 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
224 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
225 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
226 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
227 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
228 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
229 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
230 | assertSuccess("", status); | |
231 | } | |
232 | ||
f3c0d7a5 | 233 | void MeasureFormatTest::TestCompatible54() { |
b331163b A |
234 | UErrorCode status = U_ZERO_ERROR; |
235 | LocalPointer<MeasureUnit> measureUnit; | |
236 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
237 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
238 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
239 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
240 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
241 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
242 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
243 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
244 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
245 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
246 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
247 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
248 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
249 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
250 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
251 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
252 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
253 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); | |
254 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
255 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
256 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
257 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
258 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
259 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
260 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
261 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
262 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
263 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
264 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
265 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
266 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
267 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
268 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
269 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
270 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
271 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
272 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
273 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
274 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
275 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
276 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
277 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
278 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
279 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
280 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
281 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
282 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
283 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
284 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
285 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
286 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
287 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
288 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
289 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
290 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
291 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
292 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
293 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
294 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
295 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
296 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
297 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
298 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
299 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
300 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
301 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
302 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
303 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
304 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
305 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
306 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
307 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
308 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
309 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
310 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
311 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
312 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
313 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
314 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
315 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
316 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
317 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
318 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
319 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
320 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
321 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
322 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
323 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
324 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
325 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
326 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
327 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
328 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
329 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
330 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
331 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
332 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
333 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
334 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
335 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
336 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
337 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
338 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
339 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
340 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
341 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
342 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
343 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
344 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
345 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
346 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
347 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
348 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
349 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
350 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
351 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
352 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
353 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
354 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
355 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
356 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
357 | assertSuccess("", status); | |
358 | } | |
359 | ||
f3c0d7a5 | 360 | void MeasureFormatTest::TestCompatible55() { |
2ca993e8 A |
361 | UErrorCode status = U_ZERO_ERROR; |
362 | LocalPointer<MeasureUnit> measureUnit; | |
363 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
364 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
365 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
366 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
367 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
368 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
369 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
370 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
371 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
372 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
373 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
374 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
375 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
376 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
377 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
378 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
379 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
380 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); | |
381 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
382 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
383 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
384 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
385 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
386 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
387 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
388 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
389 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
390 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
391 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
392 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
393 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
394 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
395 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
396 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
397 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
398 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
399 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
400 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
401 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
402 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
403 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
404 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
405 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
406 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
407 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
408 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
409 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
410 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
411 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
412 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
413 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
414 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
415 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
416 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
417 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
418 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
419 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
420 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
421 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
422 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
423 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
424 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
425 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
426 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
427 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
428 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
429 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
430 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
431 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
432 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
433 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
434 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
435 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
436 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
437 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
438 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
439 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
440 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
441 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
442 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
443 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
444 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
445 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
446 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
447 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
448 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
449 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
450 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
451 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
452 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
453 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
454 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
455 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
456 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
457 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
458 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
459 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
460 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
461 | measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); | |
462 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
463 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
464 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
465 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
466 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
467 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
468 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
469 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
470 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
471 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
472 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
473 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
474 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
475 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
476 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
477 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
478 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
479 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
480 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
481 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
482 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
483 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
484 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
485 | assertSuccess("", status); | |
486 | } | |
487 | ||
f3c0d7a5 | 488 | void MeasureFormatTest::TestCompatible56() { |
2ca993e8 A |
489 | UErrorCode status = U_ZERO_ERROR; |
490 | LocalPointer<MeasureUnit> measureUnit; | |
491 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
492 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
493 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
494 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
495 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
496 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
497 | measureUnit.adoptInstead(MeasureUnit::createRevolutionAngle(status)); | |
498 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
499 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
500 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
501 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
502 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
503 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
504 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
505 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
506 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
507 | measureUnit.adoptInstead(MeasureUnit::createLiterPer100Kilometers(status)); | |
508 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
509 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
510 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); | |
511 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
512 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
513 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
514 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
515 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
516 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
517 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
518 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
519 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
520 | measureUnit.adoptInstead(MeasureUnit::createCentury(status)); | |
521 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
522 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
523 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
524 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
525 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
526 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
527 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
528 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
529 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
530 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
531 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
532 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
533 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
534 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
535 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
536 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
537 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
538 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
539 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
540 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
541 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
542 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
543 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
544 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
545 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
546 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
547 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
548 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
549 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
550 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
551 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
552 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
553 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
554 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
555 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
556 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
557 | measureUnit.adoptInstead(MeasureUnit::createMileScandinavian(status)); | |
558 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
559 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
560 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
561 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
562 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
563 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
564 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
565 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
566 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
567 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
568 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
569 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
570 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
571 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
572 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
573 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
574 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
575 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
576 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
577 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
578 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
579 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
580 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
581 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
582 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
583 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
584 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
585 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
586 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
587 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
588 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
589 | measureUnit.adoptInstead(MeasureUnit::createKnot(status)); | |
590 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
591 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
592 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
593 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
594 | measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); | |
595 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
596 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
597 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
598 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
599 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
600 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
601 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
602 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
603 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
604 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
605 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
606 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
607 | measureUnit.adoptInstead(MeasureUnit::createCupMetric(status)); | |
608 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
609 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
610 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
611 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
612 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
613 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
614 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
615 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
616 | measureUnit.adoptInstead(MeasureUnit::createPintMetric(status)); | |
617 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
618 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
619 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
620 | assertSuccess("", status); | |
621 | } | |
622 | ||
f3c0d7a5 A |
623 | void MeasureFormatTest::TestCompatible57() { |
624 | UErrorCode status = U_ZERO_ERROR; | |
625 | LocalPointer<MeasureUnit> measureUnit; | |
626 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
627 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
628 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
629 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
630 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
631 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
632 | measureUnit.adoptInstead(MeasureUnit::createRevolutionAngle(status)); | |
633 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
634 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
635 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
636 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
637 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
638 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
639 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
640 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
641 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
642 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
643 | measureUnit.adoptInstead(MeasureUnit::createMilligramPerDeciliter(status)); | |
644 | measureUnit.adoptInstead(MeasureUnit::createMillimolePerLiter(status)); | |
645 | measureUnit.adoptInstead(MeasureUnit::createPartPerMillion(status)); | |
646 | measureUnit.adoptInstead(MeasureUnit::createLiterPer100Kilometers(status)); | |
647 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
648 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
649 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallonImperial(status)); | |
650 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); | |
651 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
652 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
653 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
654 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
655 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
656 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
657 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
658 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
659 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
660 | measureUnit.adoptInstead(MeasureUnit::createCentury(status)); | |
661 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
662 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
663 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
664 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
665 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
666 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
667 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
668 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
669 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
670 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
671 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
672 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
673 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
674 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
675 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
676 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
677 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
678 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
679 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
680 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
681 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
682 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
683 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
684 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
685 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
686 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
687 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
688 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
689 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
690 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
691 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
692 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
693 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
694 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
695 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
696 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
697 | measureUnit.adoptInstead(MeasureUnit::createMileScandinavian(status)); | |
698 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
699 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
700 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
701 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
702 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
703 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
704 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
705 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
706 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
707 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
708 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
709 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
710 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
711 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
712 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
713 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
714 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
715 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
716 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
717 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
718 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
719 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
720 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
721 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
722 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
723 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
724 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
725 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
726 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
727 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
728 | measureUnit.adoptInstead(MeasureUnit::createKnot(status)); | |
729 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
730 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
731 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
732 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
733 | measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); | |
734 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
735 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
736 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
737 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
738 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
739 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
740 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
741 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
742 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
743 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
744 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
745 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
746 | measureUnit.adoptInstead(MeasureUnit::createCupMetric(status)); | |
747 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
748 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
749 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
750 | measureUnit.adoptInstead(MeasureUnit::createGallonImperial(status)); | |
751 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
752 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
753 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
754 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
755 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
756 | measureUnit.adoptInstead(MeasureUnit::createPintMetric(status)); | |
757 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
758 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
759 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
760 | assertSuccess("", status); | |
761 | } | |
762 | ||
763 | void MeasureFormatTest::TestCompatible58() { | |
2ca993e8 A |
764 | UErrorCode status = U_ZERO_ERROR; |
765 | LocalPointer<MeasureUnit> measureUnit; | |
766 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
767 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
768 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
769 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
770 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
771 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
772 | measureUnit.adoptInstead(MeasureUnit::createRevolutionAngle(status)); | |
773 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
774 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
775 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
776 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
777 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
778 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
779 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
780 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
781 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
782 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
783 | measureUnit.adoptInstead(MeasureUnit::createMilligramPerDeciliter(status)); | |
784 | measureUnit.adoptInstead(MeasureUnit::createMillimolePerLiter(status)); | |
785 | measureUnit.adoptInstead(MeasureUnit::createPartPerMillion(status)); | |
786 | measureUnit.adoptInstead(MeasureUnit::createLiterPer100Kilometers(status)); | |
787 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
788 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
789 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallonImperial(status)); | |
f3c0d7a5 A |
790 | // measureUnit.adoptInstead(MeasureUnit::createEast(status)); |
791 | // measureUnit.adoptInstead(MeasureUnit::createNorth(status)); | |
792 | // measureUnit.adoptInstead(MeasureUnit::createSouth(status)); | |
793 | // measureUnit.adoptInstead(MeasureUnit::createWest(status)); | |
2ca993e8 A |
794 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); |
795 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
796 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
797 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
798 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
799 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
800 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
801 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
802 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
803 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
804 | measureUnit.adoptInstead(MeasureUnit::createCentury(status)); | |
805 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
806 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
807 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
808 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
809 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
810 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
811 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
812 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
813 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
814 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
815 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
816 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
817 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
818 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
819 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
820 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
821 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
822 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
823 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
824 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
825 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
826 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
827 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
828 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
829 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
830 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
831 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
832 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
833 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
834 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
835 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
836 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
837 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
838 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
839 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
840 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
841 | measureUnit.adoptInstead(MeasureUnit::createMileScandinavian(status)); | |
842 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
843 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
844 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
845 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
846 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
847 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
848 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
849 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
850 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
851 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
852 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
853 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
854 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
855 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
856 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
857 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
858 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
859 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
860 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
861 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
862 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
863 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
864 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
865 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
866 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
867 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
868 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
869 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
870 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
871 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
872 | measureUnit.adoptInstead(MeasureUnit::createKnot(status)); | |
873 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
874 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
875 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
876 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
877 | measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); | |
878 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
879 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
880 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
881 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
882 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
883 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
884 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
885 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
886 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
887 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
888 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
889 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
890 | measureUnit.adoptInstead(MeasureUnit::createCupMetric(status)); | |
891 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
892 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
893 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
894 | measureUnit.adoptInstead(MeasureUnit::createGallonImperial(status)); | |
895 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
896 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
897 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
898 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
899 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
900 | measureUnit.adoptInstead(MeasureUnit::createPintMetric(status)); | |
901 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
902 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
903 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
904 | assertSuccess("", status); | |
905 | } | |
906 | ||
f3c0d7a5 A |
907 | void MeasureFormatTest::TestCompatible59() { |
908 | UErrorCode status = U_ZERO_ERROR; | |
909 | LocalPointer<MeasureUnit> measureUnit; | |
910 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
911 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
912 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
913 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
914 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
915 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
916 | measureUnit.adoptInstead(MeasureUnit::createRevolutionAngle(status)); | |
917 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
918 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
919 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
920 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
921 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
922 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
923 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
924 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
925 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
926 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
927 | measureUnit.adoptInstead(MeasureUnit::createMilligramPerDeciliter(status)); | |
928 | measureUnit.adoptInstead(MeasureUnit::createMillimolePerLiter(status)); | |
929 | measureUnit.adoptInstead(MeasureUnit::createPartPerMillion(status)); | |
930 | measureUnit.adoptInstead(MeasureUnit::createLiterPer100Kilometers(status)); | |
931 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
932 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
933 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallonImperial(status)); | |
934 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); | |
935 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
936 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
937 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
938 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
939 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
940 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
941 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
942 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
943 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
944 | measureUnit.adoptInstead(MeasureUnit::createCentury(status)); | |
945 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
946 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
947 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
948 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
949 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
950 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
951 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
952 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
953 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
954 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
955 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
956 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
957 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
958 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
959 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
960 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
961 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
962 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
963 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
964 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
965 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
966 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
967 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
968 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
969 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
970 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
971 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
972 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
973 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
974 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
975 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
976 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
977 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
978 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
979 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
980 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
981 | measureUnit.adoptInstead(MeasureUnit::createMileScandinavian(status)); | |
982 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
983 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
984 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
985 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
986 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
987 | measureUnit.adoptInstead(MeasureUnit::createPoint(status)); | |
988 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
989 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
990 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
991 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
992 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
993 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
994 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
995 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
996 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
997 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
998 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
999 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
1000 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
1001 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
1002 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
1003 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
1004 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
1005 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
1006 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
1007 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
1008 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
1009 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
1010 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
1011 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
1012 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
1013 | measureUnit.adoptInstead(MeasureUnit::createKnot(status)); | |
1014 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
1015 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
1016 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
1017 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
1018 | measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); | |
1019 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
1020 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
1021 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
1022 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
1023 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
1024 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
1025 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
1026 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
1027 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
1028 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
1029 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
1030 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
1031 | measureUnit.adoptInstead(MeasureUnit::createCupMetric(status)); | |
1032 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
1033 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
1034 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
1035 | measureUnit.adoptInstead(MeasureUnit::createGallonImperial(status)); | |
1036 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
1037 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
1038 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
1039 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
1040 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
1041 | measureUnit.adoptInstead(MeasureUnit::createPintMetric(status)); | |
1042 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
1043 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
1044 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
1045 | assertSuccess("", status); | |
1046 | } | |
1047 | ||
0f5d89e8 A |
1048 | // Note that TestCompatible60(), TestCompatible61(), TestCompatible62() |
1049 | // would be the same as TestCompatible59(), no need to add them. | |
1050 | ||
3d1f044b A |
1051 | void MeasureFormatTest::TestCompatible63() { |
1052 | UErrorCode status = U_ZERO_ERROR; | |
1053 | LocalPointer<MeasureUnit> measureUnit; | |
1054 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
1055 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
1056 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
1057 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
1058 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
1059 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
1060 | measureUnit.adoptInstead(MeasureUnit::createRevolutionAngle(status)); | |
1061 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
1062 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
1063 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
1064 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
1065 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
1066 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
1067 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
1068 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
1069 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
1070 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
1071 | measureUnit.adoptInstead(MeasureUnit::createMilligramPerDeciliter(status)); | |
1072 | measureUnit.adoptInstead(MeasureUnit::createMillimolePerLiter(status)); | |
1073 | measureUnit.adoptInstead(MeasureUnit::createPartPerMillion(status)); | |
1074 | measureUnit.adoptInstead(MeasureUnit::createPercent(status)); | |
1075 | measureUnit.adoptInstead(MeasureUnit::createPermille(status)); | |
1076 | measureUnit.adoptInstead(MeasureUnit::createLiterPer100Kilometers(status)); | |
1077 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
1078 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
1079 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallonImperial(status)); | |
1080 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); | |
1081 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
1082 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
1083 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
1084 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
1085 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
1086 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
1087 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
1088 | measureUnit.adoptInstead(MeasureUnit::createPetabyte(status)); | |
1089 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
1090 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
1091 | measureUnit.adoptInstead(MeasureUnit::createCentury(status)); | |
1092 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
1093 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
1094 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
1095 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
1096 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
1097 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
1098 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
1099 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
1100 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
1101 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
1102 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
1103 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
1104 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
1105 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
1106 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
1107 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
1108 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
1109 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
1110 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
1111 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
1112 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
1113 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
1114 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
1115 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
1116 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
1117 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
1118 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
1119 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
1120 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
1121 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
1122 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
1123 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
1124 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
1125 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
1126 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
1127 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
1128 | measureUnit.adoptInstead(MeasureUnit::createMileScandinavian(status)); | |
1129 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
1130 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
1131 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
1132 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
1133 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
1134 | measureUnit.adoptInstead(MeasureUnit::createPoint(status)); | |
1135 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
1136 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
1137 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
1138 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
1139 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
1140 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
1141 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
1142 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
1143 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
1144 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
1145 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
1146 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
1147 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
1148 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
1149 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
1150 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
1151 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
1152 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
1153 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
1154 | measureUnit.adoptInstead(MeasureUnit::createAtmosphere(status)); | |
1155 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
1156 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
1157 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
1158 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
1159 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
1160 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
1161 | measureUnit.adoptInstead(MeasureUnit::createKnot(status)); | |
1162 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
1163 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
1164 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
1165 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
1166 | measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); | |
1167 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
1168 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
1169 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
1170 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
1171 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
1172 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
1173 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
1174 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
1175 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
1176 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
1177 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
1178 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
1179 | measureUnit.adoptInstead(MeasureUnit::createCupMetric(status)); | |
1180 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
1181 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
1182 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
1183 | measureUnit.adoptInstead(MeasureUnit::createGallonImperial(status)); | |
1184 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
1185 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
1186 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
1187 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
1188 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
1189 | measureUnit.adoptInstead(MeasureUnit::createPintMetric(status)); | |
1190 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
1191 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
1192 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
1193 | assertSuccess("", status); | |
1194 | } | |
1195 | ||
1196 | void MeasureFormatTest::TestCompatible64() { | |
1197 | UErrorCode status = U_ZERO_ERROR; | |
1198 | LocalPointer<MeasureUnit> measureUnit; | |
1199 | MeasureUnit measureUnitValue; | |
1200 | measureUnit.adoptInstead(MeasureUnit::createGForce(status)); | |
1201 | measureUnitValue = MeasureUnit::getGForce(); | |
1202 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); | |
1203 | measureUnitValue = MeasureUnit::getMeterPerSecondSquared(); | |
1204 | measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); | |
1205 | measureUnitValue = MeasureUnit::getArcMinute(); | |
1206 | measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); | |
1207 | measureUnitValue = MeasureUnit::getArcSecond(); | |
1208 | measureUnit.adoptInstead(MeasureUnit::createDegree(status)); | |
1209 | measureUnitValue = MeasureUnit::getDegree(); | |
1210 | measureUnit.adoptInstead(MeasureUnit::createRadian(status)); | |
1211 | measureUnitValue = MeasureUnit::getRadian(); | |
1212 | measureUnit.adoptInstead(MeasureUnit::createRevolutionAngle(status)); | |
1213 | measureUnitValue = MeasureUnit::getRevolutionAngle(); | |
1214 | measureUnit.adoptInstead(MeasureUnit::createAcre(status)); | |
1215 | measureUnitValue = MeasureUnit::getAcre(); | |
1216 | measureUnit.adoptInstead(MeasureUnit::createDunam(status)); | |
1217 | measureUnitValue = MeasureUnit::getDunam(); | |
1218 | measureUnit.adoptInstead(MeasureUnit::createHectare(status)); | |
1219 | measureUnitValue = MeasureUnit::getHectare(); | |
1220 | measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); | |
1221 | measureUnitValue = MeasureUnit::getSquareCentimeter(); | |
1222 | measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); | |
1223 | measureUnitValue = MeasureUnit::getSquareFoot(); | |
1224 | measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); | |
1225 | measureUnitValue = MeasureUnit::getSquareInch(); | |
1226 | measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); | |
1227 | measureUnitValue = MeasureUnit::getSquareKilometer(); | |
1228 | measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); | |
1229 | measureUnitValue = MeasureUnit::getSquareMeter(); | |
1230 | measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); | |
1231 | measureUnitValue = MeasureUnit::getSquareMile(); | |
1232 | measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); | |
1233 | measureUnitValue = MeasureUnit::getSquareYard(); | |
1234 | measureUnit.adoptInstead(MeasureUnit::createKarat(status)); | |
1235 | measureUnitValue = MeasureUnit::getKarat(); | |
1236 | measureUnit.adoptInstead(MeasureUnit::createMilligramPerDeciliter(status)); | |
1237 | measureUnitValue = MeasureUnit::getMilligramPerDeciliter(); | |
1238 | measureUnit.adoptInstead(MeasureUnit::createMillimolePerLiter(status)); | |
1239 | measureUnitValue = MeasureUnit::getMillimolePerLiter(); | |
1240 | measureUnit.adoptInstead(MeasureUnit::createMole(status)); | |
1241 | measureUnitValue = MeasureUnit::getMole(); | |
1242 | measureUnit.adoptInstead(MeasureUnit::createPartPerMillion(status)); | |
1243 | measureUnitValue = MeasureUnit::getPartPerMillion(); | |
1244 | measureUnit.adoptInstead(MeasureUnit::createPercent(status)); | |
1245 | measureUnitValue = MeasureUnit::getPercent(); | |
1246 | measureUnit.adoptInstead(MeasureUnit::createPermille(status)); | |
1247 | measureUnitValue = MeasureUnit::getPermille(); | |
1248 | measureUnit.adoptInstead(MeasureUnit::createPermyriad(status)); | |
1249 | measureUnitValue = MeasureUnit::getPermyriad(); | |
1250 | measureUnit.adoptInstead(MeasureUnit::createLiterPer100Kilometers(status)); | |
1251 | measureUnitValue = MeasureUnit::getLiterPer100Kilometers(); | |
1252 | measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); | |
1253 | measureUnitValue = MeasureUnit::getLiterPerKilometer(); | |
1254 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); | |
1255 | measureUnitValue = MeasureUnit::getMilePerGallon(); | |
1256 | measureUnit.adoptInstead(MeasureUnit::createMilePerGallonImperial(status)); | |
1257 | measureUnitValue = MeasureUnit::getMilePerGallonImperial(); | |
1258 | measureUnit.adoptInstead(MeasureUnit::createBit(status)); | |
1259 | measureUnitValue = MeasureUnit::getBit(); | |
1260 | measureUnit.adoptInstead(MeasureUnit::createByte(status)); | |
1261 | measureUnitValue = MeasureUnit::getByte(); | |
1262 | measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); | |
1263 | measureUnitValue = MeasureUnit::getGigabit(); | |
1264 | measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); | |
1265 | measureUnitValue = MeasureUnit::getGigabyte(); | |
1266 | measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); | |
1267 | measureUnitValue = MeasureUnit::getKilobit(); | |
1268 | measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); | |
1269 | measureUnitValue = MeasureUnit::getKilobyte(); | |
1270 | measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); | |
1271 | measureUnitValue = MeasureUnit::getMegabit(); | |
1272 | measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); | |
1273 | measureUnitValue = MeasureUnit::getMegabyte(); | |
1274 | measureUnit.adoptInstead(MeasureUnit::createPetabyte(status)); | |
1275 | measureUnitValue = MeasureUnit::getPetabyte(); | |
1276 | measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); | |
1277 | measureUnitValue = MeasureUnit::getTerabit(); | |
1278 | measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); | |
1279 | measureUnitValue = MeasureUnit::getTerabyte(); | |
1280 | measureUnit.adoptInstead(MeasureUnit::createCentury(status)); | |
1281 | measureUnitValue = MeasureUnit::getCentury(); | |
1282 | measureUnit.adoptInstead(MeasureUnit::createDay(status)); | |
1283 | measureUnitValue = MeasureUnit::getDay(); | |
1284 | measureUnit.adoptInstead(MeasureUnit::createDayPerson(status)); | |
1285 | measureUnitValue = MeasureUnit::getDayPerson(); | |
1286 | measureUnit.adoptInstead(MeasureUnit::createHour(status)); | |
1287 | measureUnitValue = MeasureUnit::getHour(); | |
1288 | measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); | |
1289 | measureUnitValue = MeasureUnit::getMicrosecond(); | |
1290 | measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); | |
1291 | measureUnitValue = MeasureUnit::getMillisecond(); | |
1292 | measureUnit.adoptInstead(MeasureUnit::createMinute(status)); | |
1293 | measureUnitValue = MeasureUnit::getMinute(); | |
1294 | measureUnit.adoptInstead(MeasureUnit::createMonth(status)); | |
1295 | measureUnitValue = MeasureUnit::getMonth(); | |
1296 | measureUnit.adoptInstead(MeasureUnit::createMonthPerson(status)); | |
1297 | measureUnitValue = MeasureUnit::getMonthPerson(); | |
1298 | measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); | |
1299 | measureUnitValue = MeasureUnit::getNanosecond(); | |
1300 | measureUnit.adoptInstead(MeasureUnit::createSecond(status)); | |
1301 | measureUnitValue = MeasureUnit::getSecond(); | |
1302 | measureUnit.adoptInstead(MeasureUnit::createWeek(status)); | |
1303 | measureUnitValue = MeasureUnit::getWeek(); | |
1304 | measureUnit.adoptInstead(MeasureUnit::createWeekPerson(status)); | |
1305 | measureUnitValue = MeasureUnit::getWeekPerson(); | |
1306 | measureUnit.adoptInstead(MeasureUnit::createYear(status)); | |
1307 | measureUnitValue = MeasureUnit::getYear(); | |
1308 | measureUnit.adoptInstead(MeasureUnit::createYearPerson(status)); | |
1309 | measureUnitValue = MeasureUnit::getYearPerson(); | |
1310 | measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); | |
1311 | measureUnitValue = MeasureUnit::getAmpere(); | |
1312 | measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); | |
1313 | measureUnitValue = MeasureUnit::getMilliampere(); | |
1314 | measureUnit.adoptInstead(MeasureUnit::createOhm(status)); | |
1315 | measureUnitValue = MeasureUnit::getOhm(); | |
1316 | measureUnit.adoptInstead(MeasureUnit::createVolt(status)); | |
1317 | measureUnitValue = MeasureUnit::getVolt(); | |
1318 | measureUnit.adoptInstead(MeasureUnit::createBritishThermalUnit(status)); | |
1319 | measureUnitValue = MeasureUnit::getBritishThermalUnit(); | |
1320 | measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); | |
1321 | measureUnitValue = MeasureUnit::getCalorie(); | |
1322 | measureUnit.adoptInstead(MeasureUnit::createElectronvolt(status)); | |
1323 | measureUnitValue = MeasureUnit::getElectronvolt(); | |
1324 | measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); | |
1325 | measureUnitValue = MeasureUnit::getFoodcalorie(); | |
1326 | measureUnit.adoptInstead(MeasureUnit::createJoule(status)); | |
1327 | measureUnitValue = MeasureUnit::getJoule(); | |
1328 | measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); | |
1329 | measureUnitValue = MeasureUnit::getKilocalorie(); | |
1330 | measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); | |
1331 | measureUnitValue = MeasureUnit::getKilojoule(); | |
1332 | measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); | |
1333 | measureUnitValue = MeasureUnit::getKilowattHour(); | |
1334 | measureUnit.adoptInstead(MeasureUnit::createNewton(status)); | |
1335 | measureUnitValue = MeasureUnit::getNewton(); | |
1336 | measureUnit.adoptInstead(MeasureUnit::createPoundForce(status)); | |
1337 | measureUnitValue = MeasureUnit::getPoundForce(); | |
1338 | measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); | |
1339 | measureUnitValue = MeasureUnit::getGigahertz(); | |
1340 | measureUnit.adoptInstead(MeasureUnit::createHertz(status)); | |
1341 | measureUnitValue = MeasureUnit::getHertz(); | |
1342 | measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); | |
1343 | measureUnitValue = MeasureUnit::getKilohertz(); | |
1344 | measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); | |
1345 | measureUnitValue = MeasureUnit::getMegahertz(); | |
1346 | measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); | |
1347 | measureUnitValue = MeasureUnit::getAstronomicalUnit(); | |
1348 | measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); | |
1349 | measureUnitValue = MeasureUnit::getCentimeter(); | |
1350 | measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); | |
1351 | measureUnitValue = MeasureUnit::getDecimeter(); | |
1352 | measureUnit.adoptInstead(MeasureUnit::createFathom(status)); | |
1353 | measureUnitValue = MeasureUnit::getFathom(); | |
1354 | measureUnit.adoptInstead(MeasureUnit::createFoot(status)); | |
1355 | measureUnitValue = MeasureUnit::getFoot(); | |
1356 | measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); | |
1357 | measureUnitValue = MeasureUnit::getFurlong(); | |
1358 | measureUnit.adoptInstead(MeasureUnit::createInch(status)); | |
1359 | measureUnitValue = MeasureUnit::getInch(); | |
1360 | measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); | |
1361 | measureUnitValue = MeasureUnit::getKilometer(); | |
1362 | measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); | |
1363 | measureUnitValue = MeasureUnit::getLightYear(); | |
1364 | measureUnit.adoptInstead(MeasureUnit::createMeter(status)); | |
1365 | measureUnitValue = MeasureUnit::getMeter(); | |
1366 | measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); | |
1367 | measureUnitValue = MeasureUnit::getMicrometer(); | |
1368 | measureUnit.adoptInstead(MeasureUnit::createMile(status)); | |
1369 | measureUnitValue = MeasureUnit::getMile(); | |
1370 | measureUnit.adoptInstead(MeasureUnit::createMileScandinavian(status)); | |
1371 | measureUnitValue = MeasureUnit::getMileScandinavian(); | |
1372 | measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); | |
1373 | measureUnitValue = MeasureUnit::getMillimeter(); | |
1374 | measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); | |
1375 | measureUnitValue = MeasureUnit::getNanometer(); | |
1376 | measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); | |
1377 | measureUnitValue = MeasureUnit::getNauticalMile(); | |
1378 | measureUnit.adoptInstead(MeasureUnit::createParsec(status)); | |
1379 | measureUnitValue = MeasureUnit::getParsec(); | |
1380 | measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); | |
1381 | measureUnitValue = MeasureUnit::getPicometer(); | |
1382 | measureUnit.adoptInstead(MeasureUnit::createPoint(status)); | |
1383 | measureUnitValue = MeasureUnit::getPoint(); | |
1384 | measureUnit.adoptInstead(MeasureUnit::createSolarRadius(status)); | |
1385 | measureUnitValue = MeasureUnit::getSolarRadius(); | |
1386 | measureUnit.adoptInstead(MeasureUnit::createYard(status)); | |
1387 | measureUnitValue = MeasureUnit::getYard(); | |
1388 | measureUnit.adoptInstead(MeasureUnit::createLux(status)); | |
1389 | measureUnitValue = MeasureUnit::getLux(); | |
1390 | measureUnit.adoptInstead(MeasureUnit::createSolarLuminosity(status)); | |
1391 | measureUnitValue = MeasureUnit::getSolarLuminosity(); | |
1392 | measureUnit.adoptInstead(MeasureUnit::createCarat(status)); | |
1393 | measureUnitValue = MeasureUnit::getCarat(); | |
1394 | measureUnit.adoptInstead(MeasureUnit::createDalton(status)); | |
1395 | measureUnitValue = MeasureUnit::getDalton(); | |
1396 | measureUnit.adoptInstead(MeasureUnit::createEarthMass(status)); | |
1397 | measureUnitValue = MeasureUnit::getEarthMass(); | |
1398 | measureUnit.adoptInstead(MeasureUnit::createGram(status)); | |
1399 | measureUnitValue = MeasureUnit::getGram(); | |
1400 | measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); | |
1401 | measureUnitValue = MeasureUnit::getKilogram(); | |
1402 | measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); | |
1403 | measureUnitValue = MeasureUnit::getMetricTon(); | |
1404 | measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); | |
1405 | measureUnitValue = MeasureUnit::getMicrogram(); | |
1406 | measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); | |
1407 | measureUnitValue = MeasureUnit::getMilligram(); | |
1408 | measureUnit.adoptInstead(MeasureUnit::createOunce(status)); | |
1409 | measureUnitValue = MeasureUnit::getOunce(); | |
1410 | measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); | |
1411 | measureUnitValue = MeasureUnit::getOunceTroy(); | |
1412 | measureUnit.adoptInstead(MeasureUnit::createPound(status)); | |
1413 | measureUnitValue = MeasureUnit::getPound(); | |
1414 | measureUnit.adoptInstead(MeasureUnit::createSolarMass(status)); | |
1415 | measureUnitValue = MeasureUnit::getSolarMass(); | |
1416 | measureUnit.adoptInstead(MeasureUnit::createStone(status)); | |
1417 | measureUnitValue = MeasureUnit::getStone(); | |
1418 | measureUnit.adoptInstead(MeasureUnit::createTon(status)); | |
1419 | measureUnitValue = MeasureUnit::getTon(); | |
1420 | measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); | |
1421 | measureUnitValue = MeasureUnit::getGigawatt(); | |
1422 | measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); | |
1423 | measureUnitValue = MeasureUnit::getHorsepower(); | |
1424 | measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); | |
1425 | measureUnitValue = MeasureUnit::getKilowatt(); | |
1426 | measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); | |
1427 | measureUnitValue = MeasureUnit::getMegawatt(); | |
1428 | measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); | |
1429 | measureUnitValue = MeasureUnit::getMilliwatt(); | |
1430 | measureUnit.adoptInstead(MeasureUnit::createWatt(status)); | |
1431 | measureUnitValue = MeasureUnit::getWatt(); | |
1432 | measureUnit.adoptInstead(MeasureUnit::createAtmosphere(status)); | |
1433 | measureUnitValue = MeasureUnit::getAtmosphere(); | |
1434 | measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); | |
1435 | measureUnitValue = MeasureUnit::getHectopascal(); | |
1436 | measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); | |
1437 | measureUnitValue = MeasureUnit::getInchHg(); | |
1438 | measureUnit.adoptInstead(MeasureUnit::createKilopascal(status)); | |
1439 | measureUnitValue = MeasureUnit::getKilopascal(); | |
1440 | measureUnit.adoptInstead(MeasureUnit::createMegapascal(status)); | |
1441 | measureUnitValue = MeasureUnit::getMegapascal(); | |
1442 | measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); | |
1443 | measureUnitValue = MeasureUnit::getMillibar(); | |
1444 | measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); | |
1445 | measureUnitValue = MeasureUnit::getMillimeterOfMercury(); | |
1446 | measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); | |
1447 | measureUnitValue = MeasureUnit::getPoundPerSquareInch(); | |
1448 | measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); | |
1449 | measureUnitValue = MeasureUnit::getKilometerPerHour(); | |
1450 | measureUnit.adoptInstead(MeasureUnit::createKnot(status)); | |
1451 | measureUnitValue = MeasureUnit::getKnot(); | |
1452 | measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); | |
1453 | measureUnitValue = MeasureUnit::getMeterPerSecond(); | |
1454 | measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); | |
1455 | measureUnitValue = MeasureUnit::getMilePerHour(); | |
1456 | measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); | |
1457 | measureUnitValue = MeasureUnit::getCelsius(); | |
1458 | measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); | |
1459 | measureUnitValue = MeasureUnit::getFahrenheit(); | |
1460 | measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); | |
1461 | measureUnitValue = MeasureUnit::getGenericTemperature(); | |
1462 | measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); | |
1463 | measureUnitValue = MeasureUnit::getKelvin(); | |
1464 | measureUnit.adoptInstead(MeasureUnit::createNewtonMeter(status)); | |
1465 | measureUnitValue = MeasureUnit::getNewtonMeter(); | |
1466 | measureUnit.adoptInstead(MeasureUnit::createPoundFoot(status)); | |
1467 | measureUnitValue = MeasureUnit::getPoundFoot(); | |
1468 | measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); | |
1469 | measureUnitValue = MeasureUnit::getAcreFoot(); | |
1470 | measureUnit.adoptInstead(MeasureUnit::createBarrel(status)); | |
1471 | measureUnitValue = MeasureUnit::getBarrel(); | |
1472 | measureUnit.adoptInstead(MeasureUnit::createBushel(status)); | |
1473 | measureUnitValue = MeasureUnit::getBushel(); | |
1474 | measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); | |
1475 | measureUnitValue = MeasureUnit::getCentiliter(); | |
1476 | measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); | |
1477 | measureUnitValue = MeasureUnit::getCubicCentimeter(); | |
1478 | measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); | |
1479 | measureUnitValue = MeasureUnit::getCubicFoot(); | |
1480 | measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); | |
1481 | measureUnitValue = MeasureUnit::getCubicInch(); | |
1482 | measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); | |
1483 | measureUnitValue = MeasureUnit::getCubicKilometer(); | |
1484 | measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); | |
1485 | measureUnitValue = MeasureUnit::getCubicMeter(); | |
1486 | measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); | |
1487 | measureUnitValue = MeasureUnit::getCubicMile(); | |
1488 | measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); | |
1489 | measureUnitValue = MeasureUnit::getCubicYard(); | |
1490 | measureUnit.adoptInstead(MeasureUnit::createCup(status)); | |
1491 | measureUnitValue = MeasureUnit::getCup(); | |
1492 | measureUnit.adoptInstead(MeasureUnit::createCupMetric(status)); | |
1493 | measureUnitValue = MeasureUnit::getCupMetric(); | |
1494 | measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); | |
1495 | measureUnitValue = MeasureUnit::getDeciliter(); | |
1496 | measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); | |
1497 | measureUnitValue = MeasureUnit::getFluidOunce(); | |
1498 | measureUnit.adoptInstead(MeasureUnit::createFluidOunceImperial(status)); | |
1499 | measureUnitValue = MeasureUnit::getFluidOunceImperial(); | |
1500 | measureUnit.adoptInstead(MeasureUnit::createGallon(status)); | |
1501 | measureUnitValue = MeasureUnit::getGallon(); | |
1502 | measureUnit.adoptInstead(MeasureUnit::createGallonImperial(status)); | |
1503 | measureUnitValue = MeasureUnit::getGallonImperial(); | |
1504 | measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); | |
1505 | measureUnitValue = MeasureUnit::getHectoliter(); | |
1506 | measureUnit.adoptInstead(MeasureUnit::createLiter(status)); | |
1507 | measureUnitValue = MeasureUnit::getLiter(); | |
1508 | measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); | |
1509 | measureUnitValue = MeasureUnit::getMegaliter(); | |
1510 | measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); | |
1511 | measureUnitValue = MeasureUnit::getMilliliter(); | |
1512 | measureUnit.adoptInstead(MeasureUnit::createPint(status)); | |
1513 | measureUnitValue = MeasureUnit::getPint(); | |
1514 | measureUnit.adoptInstead(MeasureUnit::createPintMetric(status)); | |
1515 | measureUnitValue = MeasureUnit::getPintMetric(); | |
1516 | measureUnit.adoptInstead(MeasureUnit::createQuart(status)); | |
1517 | measureUnitValue = MeasureUnit::getQuart(); | |
1518 | measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); | |
1519 | measureUnitValue = MeasureUnit::getTablespoon(); | |
1520 | measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); | |
1521 | measureUnitValue = MeasureUnit::getTeaspoon(); | |
1522 | assertSuccess("", status); | |
1523 | } | |
1524 | ||
57a6839d A |
1525 | void MeasureFormatTest::TestBasic() { |
1526 | UErrorCode status = U_ZERO_ERROR; | |
1527 | MeasureUnit *ptr1 = MeasureUnit::createArcMinute(status); | |
1528 | MeasureUnit *ptr2 = MeasureUnit::createArcMinute(status); | |
1529 | if (!(*ptr1 == *ptr2)) { | |
1530 | errln("Expect == to work."); | |
1531 | } | |
1532 | if (*ptr1 != *ptr2) { | |
1533 | errln("Expect != to work."); | |
1534 | } | |
1535 | MeasureUnit *ptr3 = MeasureUnit::createMeter(status); | |
1536 | if (*ptr1 == *ptr3) { | |
1537 | errln("Expect == to work."); | |
1538 | } | |
1539 | if (!(*ptr1 != *ptr3)) { | |
1540 | errln("Expect != to work."); | |
1541 | } | |
1542 | MeasureUnit *ptr4 = (MeasureUnit *) ptr1->clone(); | |
1543 | if (*ptr1 != *ptr4) { | |
1544 | errln("Expect clone to work."); | |
1545 | } | |
1546 | MeasureUnit stack; | |
1547 | stack = *ptr1; | |
1548 | if (*ptr1 != stack) { | |
1549 | errln("Expect assignment to work."); | |
1550 | } | |
1551 | ||
1552 | delete ptr1; | |
1553 | delete ptr2; | |
1554 | delete ptr3; | |
1555 | delete ptr4; | |
1556 | } | |
1557 | ||
1558 | void MeasureFormatTest::TestGetAvailable() { | |
1559 | MeasureUnit *units = NULL; | |
1560 | UErrorCode status = U_ZERO_ERROR; | |
1561 | int32_t totalCount = MeasureUnit::getAvailable(units, 0, status); | |
1562 | while (status == U_BUFFER_OVERFLOW_ERROR) { | |
1563 | status = U_ZERO_ERROR; | |
1564 | delete [] units; | |
1565 | units = new MeasureUnit[totalCount]; | |
1566 | totalCount = MeasureUnit::getAvailable(units, totalCount, status); | |
1567 | } | |
1568 | if (U_FAILURE(status)) { | |
1569 | dataerrln("Failure creating format object - %s", u_errorName(status)); | |
1570 | delete [] units; | |
1571 | return; | |
1572 | } | |
1573 | if (totalCount < 200) { | |
1574 | errln("Expect at least 200 measure units including currencies."); | |
1575 | } | |
1576 | delete [] units; | |
1577 | StringEnumeration *types = MeasureUnit::getAvailableTypes(status); | |
1578 | if (U_FAILURE(status)) { | |
1579 | dataerrln("Failure getting types - %s", u_errorName(status)); | |
1580 | delete types; | |
1581 | return; | |
1582 | } | |
1583 | if (types->count(status) < 10) { | |
1584 | errln("Expect at least 10 distinct unit types."); | |
1585 | } | |
1586 | units = NULL; | |
1587 | int32_t unitCapacity = 0; | |
1588 | int32_t unitCountSum = 0; | |
1589 | for ( | |
1590 | const char* type = types->next(NULL, status); | |
1591 | type != NULL; | |
1592 | type = types->next(NULL, status)) { | |
1593 | int32_t unitCount = MeasureUnit::getAvailable(type, units, unitCapacity, status); | |
1594 | while (status == U_BUFFER_OVERFLOW_ERROR) { | |
1595 | status = U_ZERO_ERROR; | |
1596 | delete [] units; | |
1597 | units = new MeasureUnit[unitCount]; | |
1598 | unitCapacity = unitCount; | |
1599 | unitCount = MeasureUnit::getAvailable(type, units, unitCapacity, status); | |
1600 | } | |
1601 | if (U_FAILURE(status)) { | |
1602 | dataerrln("Failure getting units - %s", u_errorName(status)); | |
1603 | delete [] units; | |
1604 | delete types; | |
1605 | return; | |
1606 | } | |
1607 | if (unitCount < 1) { | |
1608 | errln("Expect at least one unit count per type."); | |
1609 | } | |
1610 | unitCountSum += unitCount; | |
1611 | } | |
1612 | if (unitCountSum != totalCount) { | |
1613 | errln("Expected total unit count to equal sum of unit counts by type."); | |
1614 | } | |
1615 | delete [] units; | |
1616 | delete types; | |
1617 | } | |
1618 | ||
1619 | void MeasureFormatTest::TestExamplesInDocs() { | |
1620 | UErrorCode status = U_ZERO_ERROR; | |
1621 | MeasureFormat fmtFr(Locale::getFrench(), UMEASFMT_WIDTH_SHORT, status); | |
1622 | MeasureFormat fmtFrFull( | |
1623 | Locale::getFrench(), UMEASFMT_WIDTH_WIDE, status); | |
1624 | MeasureFormat fmtFrNarrow( | |
1625 | Locale::getFrench(), UMEASFMT_WIDTH_NARROW, status); | |
1626 | MeasureFormat fmtEn(Locale::getUS(), UMEASFMT_WIDTH_WIDE, status); | |
1627 | if (!assertSuccess("Error creating formatters", status)) { | |
1628 | return; | |
1629 | } | |
f3c0d7a5 A |
1630 | Measure measureC((double)23, MeasureUnit::createCelsius(status), status); |
1631 | Measure measureF((double)70, MeasureUnit::createFahrenheit(status), status); | |
57a6839d | 1632 | Measure feetAndInches[] = { |
f3c0d7a5 A |
1633 | Measure((double)70, MeasureUnit::createFoot(status), status), |
1634 | Measure((double)5.3, MeasureUnit::createInch(status), status)}; | |
57a6839d | 1635 | Measure footAndInch[] = { |
f3c0d7a5 A |
1636 | Measure((double)1, MeasureUnit::createFoot(status), status), |
1637 | Measure((double)1, MeasureUnit::createInch(status), status)}; | |
57a6839d | 1638 | Measure inchAndFeet[] = { |
f3c0d7a5 A |
1639 | Measure((double)1, MeasureUnit::createInch(status), status), |
1640 | Measure((double)2, MeasureUnit::createFoot(status), status)}; | |
57a6839d A |
1641 | if (!assertSuccess("Error creating measurements.", status)) { |
1642 | return; | |
1643 | } | |
1644 | verifyFormat( | |
1645 | "Celsius", | |
1646 | fmtFr, | |
1647 | &measureC, | |
1648 | 1, | |
3d1f044b | 1649 | "23\\u202F\\u00B0C"); |
57a6839d A |
1650 | verifyFormatWithPrefix( |
1651 | "Celsius", | |
1652 | fmtFr, | |
1653 | "Prefix: ", | |
1654 | &measureC, | |
1655 | 1, | |
3d1f044b | 1656 | "Prefix: 23\\u202F\\u00B0C"); |
57a6839d A |
1657 | verifyFormat( |
1658 | "Fahrenheit", | |
1659 | fmtFr, | |
1660 | &measureF, | |
1661 | 1, | |
3d1f044b | 1662 | "70\\u202F\\u00B0F"); |
57a6839d A |
1663 | verifyFormat( |
1664 | "Feet and inches", | |
1665 | fmtFrFull, | |
1666 | feetAndInches, | |
b331163b | 1667 | UPRV_LENGTHOF(feetAndInches), |
3d1f044b | 1668 | "70 pieds et 5,3\\u00A0pouces"); |
57a6839d A |
1669 | verifyFormatWithPrefix( |
1670 | "Feet and inches", | |
1671 | fmtFrFull, | |
1672 | "Prefix: ", | |
1673 | feetAndInches, | |
b331163b | 1674 | UPRV_LENGTHOF(feetAndInches), |
3d1f044b | 1675 | "Prefix: 70 pieds et 5,3\\u00A0pouces"); |
57a6839d A |
1676 | verifyFormat( |
1677 | "Foot and inch", | |
1678 | fmtFrFull, | |
1679 | footAndInch, | |
b331163b | 1680 | UPRV_LENGTHOF(footAndInch), |
3d1f044b | 1681 | "1\\u00A0pied et 1\\u00A0pouce"); |
57a6839d A |
1682 | verifyFormat( |
1683 | "Foot and inch narrow", | |
1684 | fmtFrNarrow, | |
1685 | footAndInch, | |
b331163b | 1686 | UPRV_LENGTHOF(footAndInch), |
57a6839d A |
1687 | "1\\u2032 1\\u2033"); |
1688 | verifyFormat( | |
1689 | "Inch and feet", | |
1690 | fmtEn, | |
1691 | inchAndFeet, | |
b331163b | 1692 | UPRV_LENGTHOF(inchAndFeet), |
57a6839d A |
1693 | "1 inch, 2 feet"); |
1694 | } | |
1695 | ||
1696 | void MeasureFormatTest::TestFormatPeriodEn() { | |
1697 | UErrorCode status = U_ZERO_ERROR; | |
f3c0d7a5 | 1698 | Measure t_19m[] = {Measure((double)19, MeasureUnit::createMinute(status), status)}; |
57a6839d | 1699 | Measure t_1h_23_5s[] = { |
f3c0d7a5 A |
1700 | Measure((double)1.0, MeasureUnit::createHour(status), status), |
1701 | Measure((double)23.5, MeasureUnit::createSecond(status), status) | |
57a6839d A |
1702 | }; |
1703 | Measure t_1h_23_5m[] = { | |
f3c0d7a5 A |
1704 | Measure((double)1.0, MeasureUnit::createHour(status), status), |
1705 | Measure((double)23.5, MeasureUnit::createMinute(status), status) | |
57a6839d A |
1706 | }; |
1707 | Measure t_1h_0m_23s[] = { | |
1708 | Measure( | |
f3c0d7a5 | 1709 | (double)1.0, |
57a6839d A |
1710 | TimeUnit::createInstance( |
1711 | TimeUnit::UTIMEUNIT_HOUR, status), | |
1712 | status), | |
1713 | Measure( | |
f3c0d7a5 | 1714 | (double)0.0, |
57a6839d A |
1715 | TimeUnit::createInstance( |
1716 | TimeUnit::UTIMEUNIT_MINUTE, status), | |
1717 | status), | |
1718 | Measure( | |
f3c0d7a5 | 1719 | (double)23.0, |
57a6839d A |
1720 | TimeUnit::createInstance( |
1721 | TimeUnit::UTIMEUNIT_SECOND, status), | |
1722 | status) | |
1723 | }; | |
1724 | Measure t_2y_5M_3w_4d[] = { | |
1725 | Measure(2.0, MeasureUnit::createYear(status), status), | |
1726 | Measure(5.0, MeasureUnit::createMonth(status), status), | |
1727 | Measure(3.0, MeasureUnit::createWeek(status), status), | |
1728 | Measure(4.0, MeasureUnit::createDay(status), status) | |
1729 | }; | |
1730 | Measure t_1m_59_9996s[] = { | |
1731 | Measure(1.0, MeasureUnit::createMinute(status), status), | |
1732 | Measure(59.9996, MeasureUnit::createSecond(status), status) | |
1733 | }; | |
1734 | Measure t_5h_17m[] = { | |
1735 | Measure(5.0, MeasureUnit::createHour(status), status), | |
1736 | Measure(17.0, MeasureUnit::createMinute(status), status) | |
1737 | }; | |
1738 | Measure t_neg5h_17m[] = { | |
1739 | Measure(-5.0, MeasureUnit::createHour(status), status), | |
1740 | Measure(17.0, MeasureUnit::createMinute(status), status) | |
1741 | }; | |
1742 | Measure t_19m_28s[] = { | |
1743 | Measure(19.0, MeasureUnit::createMinute(status), status), | |
1744 | Measure(28.0, MeasureUnit::createSecond(status), status) | |
1745 | }; | |
1746 | Measure t_0h_0m_9s[] = { | |
1747 | Measure(0.0, MeasureUnit::createHour(status), status), | |
1748 | Measure(0.0, MeasureUnit::createMinute(status), status), | |
1749 | Measure(9.0, MeasureUnit::createSecond(status), status) | |
1750 | }; | |
1751 | Measure t_0h_0m_17s[] = { | |
1752 | Measure(0.0, MeasureUnit::createHour(status), status), | |
1753 | Measure(0.0, MeasureUnit::createMinute(status), status), | |
1754 | Measure(17.0, MeasureUnit::createSecond(status), status) | |
1755 | }; | |
1756 | Measure t_6h_56_92m[] = { | |
1757 | Measure(6.0, MeasureUnit::createHour(status), status), | |
1758 | Measure(56.92, MeasureUnit::createMinute(status), status) | |
1759 | }; | |
1760 | Measure t_3h_4s_5m[] = { | |
1761 | Measure(3.0, MeasureUnit::createHour(status), status), | |
1762 | Measure(4.0, MeasureUnit::createSecond(status), status), | |
1763 | Measure(5.0, MeasureUnit::createMinute(status), status) | |
1764 | }; | |
1765 | Measure t_6_7h_56_92m[] = { | |
1766 | Measure(6.7, MeasureUnit::createHour(status), status), | |
1767 | Measure(56.92, MeasureUnit::createMinute(status), status) | |
1768 | }; | |
1769 | ||
1770 | Measure t_3h_5h[] = { | |
1771 | Measure(3.0, MeasureUnit::createHour(status), status), | |
1772 | Measure(5.0, MeasureUnit::createHour(status), status) | |
1773 | }; | |
1774 | ||
1775 | if (!assertSuccess("Error creating Measure objects", status)) { | |
1776 | return; | |
1777 | } | |
2ca993e8 | 1778 | |
57a6839d | 1779 | ExpectedResult fullData[] = { |
b331163b A |
1780 | {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1 minute, 59.9996 seconds"}, |
1781 | {t_19m, UPRV_LENGTHOF(t_19m), "19 minutes"}, | |
1782 | {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1 hour, 23.5 seconds"}, | |
1783 | {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1 hour, 23.5 minutes"}, | |
1784 | {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1 hour, 0 minutes, 23 seconds"}, | |
1785 | {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2 years, 5 months, 3 weeks, 4 days"}}; | |
57a6839d A |
1786 | |
1787 | ExpectedResult abbrevData[] = { | |
b331163b A |
1788 | {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1 min, 59.9996 sec"}, |
1789 | {t_19m, UPRV_LENGTHOF(t_19m), "19 min"}, | |
1790 | {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1 hr, 23.5 sec"}, | |
1791 | {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1 hr, 23.5 min"}, | |
1792 | {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1 hr, 0 min, 23 sec"}, | |
1793 | {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2 yrs, 5 mths, 3 wks, 4 days"}}; | |
57a6839d A |
1794 | |
1795 | ExpectedResult narrowData[] = { | |
b331163b A |
1796 | {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1m 59.9996s"}, |
1797 | {t_19m, UPRV_LENGTHOF(t_19m), "19m"}, | |
1798 | {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1h 23.5s"}, | |
1799 | {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1h 23.5m"}, | |
1800 | {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1h 0m 23s"}, | |
f3c0d7a5 | 1801 | {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2y 5mo 3w 4d"}}; |
57a6839d A |
1802 | |
1803 | ExpectedResult numericData[] = { | |
b331163b A |
1804 | {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1:59.9996"}, |
1805 | {t_19m, UPRV_LENGTHOF(t_19m), "19m"}, | |
1806 | {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1:00:23.5"}, | |
1807 | {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1:23.5"}, | |
1808 | {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1:00:23"}, | |
1809 | {t_5h_17m, UPRV_LENGTHOF(t_5h_17m), "5:17"}, | |
1810 | {t_neg5h_17m, UPRV_LENGTHOF(t_neg5h_17m), "-5h 17m"}, | |
1811 | {t_19m_28s, UPRV_LENGTHOF(t_19m_28s), "19:28"}, | |
f3c0d7a5 | 1812 | {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2y 5mo 3w 4d"}, |
b331163b A |
1813 | {t_0h_0m_9s, UPRV_LENGTHOF(t_0h_0m_9s), "0:00:09"}, |
1814 | {t_6h_56_92m, UPRV_LENGTHOF(t_6h_56_92m), "6:56.92"}, | |
1815 | {t_6_7h_56_92m, UPRV_LENGTHOF(t_6_7h_56_92m), "6:56.92"}, | |
1816 | {t_3h_4s_5m, UPRV_LENGTHOF(t_3h_4s_5m), "3h 4s 5m"}, | |
1817 | {t_3h_5h, UPRV_LENGTHOF(t_3h_5h), "3h 5h"}}; | |
57a6839d A |
1818 | |
1819 | ExpectedResult fullDataDe[] = { | |
b331163b A |
1820 | {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1 Minute und 59,9996 Sekunden"}, |
1821 | {t_19m, UPRV_LENGTHOF(t_19m), "19 Minuten"}, | |
1822 | {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1 Stunde und 23,5 Sekunden"}, | |
1823 | {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1 Stunde und 23,5 Minuten"}, | |
1824 | {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1 Stunde, 0 Minuten und 23 Sekunden"}, | |
1825 | {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2 Jahre, 5 Monate, 3 Wochen und 4 Tage"}}; | |
57a6839d A |
1826 | |
1827 | ExpectedResult numericDataDe[] = { | |
b331163b A |
1828 | {t_1m_59_9996s, UPRV_LENGTHOF(t_1m_59_9996s), "1:59,9996"}, |
1829 | {t_19m, UPRV_LENGTHOF(t_19m), "19min"}, | |
1830 | {t_1h_23_5s, UPRV_LENGTHOF(t_1h_23_5s), "1:00:23,5"}, | |
1831 | {t_1h_23_5m, UPRV_LENGTHOF(t_1h_23_5m), "1:23,5"}, | |
1832 | {t_1h_0m_23s, UPRV_LENGTHOF(t_1h_0m_23s), "1:00:23"}, | |
1833 | {t_5h_17m, UPRV_LENGTHOF(t_5h_17m), "5:17"}, | |
1834 | {t_19m_28s, UPRV_LENGTHOF(t_19m_28s), "19:28"}, | |
1835 | {t_2y_5M_3w_4d, UPRV_LENGTHOF(t_2y_5M_3w_4d), "2J 5M 3W 4d"}, | |
1836 | {t_0h_0m_17s, UPRV_LENGTHOF(t_0h_0m_17s), "0:00:17"}, | |
1837 | {t_6h_56_92m, UPRV_LENGTHOF(t_6h_56_92m), "6:56,92"}, | |
1838 | {t_3h_5h, UPRV_LENGTHOF(t_3h_5h), "3h 5h"}}; | |
57a6839d A |
1839 | |
1840 | Locale en(Locale::getEnglish()); | |
1841 | LocalPointer<NumberFormat> nf(NumberFormat::createInstance(en, status)); | |
1842 | if (U_FAILURE(status)) { | |
1843 | dataerrln("Error creating number format en object - %s", u_errorName(status)); | |
1844 | return; | |
1845 | } | |
1846 | nf->setMaximumFractionDigits(4); | |
1847 | MeasureFormat mf(en, UMEASFMT_WIDTH_WIDE, (NumberFormat *) nf->clone(), status); | |
1848 | if (!assertSuccess("Error creating measure format en WIDE", status)) { | |
1849 | return; | |
1850 | } | |
b331163b | 1851 | verifyFormat("en WIDE", mf, fullData, UPRV_LENGTHOF(fullData)); |
57a6839d A |
1852 | |
1853 | // exercise copy constructor | |
1854 | { | |
1855 | MeasureFormat mf2(mf); | |
b331163b | 1856 | verifyFormat("en WIDE copy", mf2, fullData, UPRV_LENGTHOF(fullData)); |
57a6839d A |
1857 | } |
1858 | // exercise clone | |
1859 | { | |
1860 | MeasureFormat *mf3 = (MeasureFormat *) mf.clone(); | |
b331163b | 1861 | verifyFormat("en WIDE copy", *mf3, fullData, UPRV_LENGTHOF(fullData)); |
57a6839d A |
1862 | delete mf3; |
1863 | } | |
1864 | mf = MeasureFormat(en, UMEASFMT_WIDTH_SHORT, (NumberFormat *) nf->clone(), status); | |
1865 | if (!assertSuccess("Error creating measure format en SHORT", status)) { | |
1866 | return; | |
1867 | } | |
b331163b | 1868 | verifyFormat("en SHORT", mf, abbrevData, UPRV_LENGTHOF(abbrevData)); |
57a6839d A |
1869 | mf = MeasureFormat(en, UMEASFMT_WIDTH_NARROW, (NumberFormat *) nf->clone(), status); |
1870 | if (!assertSuccess("Error creating measure format en NARROW", status)) { | |
1871 | return; | |
1872 | } | |
b331163b | 1873 | verifyFormat("en NARROW", mf, narrowData, UPRV_LENGTHOF(narrowData)); |
57a6839d A |
1874 | mf = MeasureFormat(en, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status); |
1875 | if (!assertSuccess("Error creating measure format en NUMERIC", status)) { | |
1876 | return; | |
1877 | } | |
b331163b | 1878 | verifyFormat("en NUMERIC", mf, numericData, UPRV_LENGTHOF(numericData)); |
2ca993e8 | 1879 | |
57a6839d A |
1880 | Locale de(Locale::getGerman()); |
1881 | nf.adoptInstead(NumberFormat::createInstance(de, status)); | |
1882 | if (!assertSuccess("Error creating number format de object", status)) { | |
1883 | return; | |
1884 | } | |
1885 | nf->setMaximumFractionDigits(4); | |
1886 | mf = MeasureFormat(de, UMEASFMT_WIDTH_WIDE, (NumberFormat *) nf->clone(), status); | |
1887 | if (!assertSuccess("Error creating measure format de WIDE", status)) { | |
1888 | return; | |
1889 | } | |
b331163b | 1890 | verifyFormat("de WIDE", mf, fullDataDe, UPRV_LENGTHOF(fullDataDe)); |
57a6839d A |
1891 | mf = MeasureFormat(de, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status); |
1892 | if (!assertSuccess("Error creating measure format de NUMERIC", status)) { | |
1893 | return; | |
1894 | } | |
b331163b | 1895 | verifyFormat("de NUMERIC", mf, numericDataDe, UPRV_LENGTHOF(numericDataDe)); |
57a6839d A |
1896 | } |
1897 | ||
1898 | void MeasureFormatTest::Test10219FractionalPlurals() { | |
1899 | Locale en(Locale::getEnglish()); | |
1900 | double values[] = {1.588, 1.011}; | |
1901 | const char *expected[2][3] = { | |
1902 | {"1 minute", "1.5 minutes", "1.58 minutes"}, | |
1903 | {"1 minute", "1.0 minutes", "1.01 minutes"} | |
1904 | }; | |
1905 | UErrorCode status = U_ZERO_ERROR; | |
b331163b A |
1906 | for (int j = 0; j < UPRV_LENGTHOF(values); j++) { |
1907 | for (int i = 0; i < UPRV_LENGTHOF(expected[j]); i++) { | |
57a6839d A |
1908 | DecimalFormat *df = |
1909 | (DecimalFormat *) NumberFormat::createInstance(en, status); | |
1910 | if (U_FAILURE(status)) { | |
1911 | dataerrln("Error creating Number format - %s", u_errorName(status)); | |
1912 | return; | |
1913 | } | |
1914 | df->setRoundingMode(DecimalFormat::kRoundDown); | |
1915 | df->setMinimumFractionDigits(i); | |
1916 | df->setMaximumFractionDigits(i); | |
1917 | MeasureFormat mf(en, UMEASFMT_WIDTH_WIDE, df, status); | |
1918 | if (!assertSuccess("Error creating Measure format", status)) { | |
1919 | return; | |
1920 | } | |
1921 | Measure measure(values[j], MeasureUnit::createMinute(status), status); | |
1922 | if (!assertSuccess("Error creating Measure unit", status)) { | |
1923 | return; | |
1924 | } | |
1925 | verifyFormat("Test10219", mf, &measure, 1, expected[j][i]); | |
2ca993e8 | 1926 | } |
57a6839d A |
1927 | } |
1928 | } | |
1929 | ||
1930 | static MeasureUnit toMeasureUnit(MeasureUnit *adopted) { | |
1931 | MeasureUnit result(*adopted); | |
1932 | delete adopted; | |
1933 | return result; | |
1934 | } | |
1935 | ||
1936 | void MeasureFormatTest::TestGreek() { | |
1937 | Locale locales[] = {Locale("el_GR"), Locale("el")}; | |
1938 | UErrorCode status = U_ZERO_ERROR; | |
1939 | MeasureUnit units[] = { | |
1940 | toMeasureUnit(MeasureUnit::createSecond(status)), | |
1941 | toMeasureUnit(MeasureUnit::createMinute(status)), | |
1942 | toMeasureUnit(MeasureUnit::createHour(status)), | |
1943 | toMeasureUnit(MeasureUnit::createDay(status)), | |
1944 | toMeasureUnit(MeasureUnit::createWeek(status)), | |
1945 | toMeasureUnit(MeasureUnit::createMonth(status)), | |
1946 | toMeasureUnit(MeasureUnit::createYear(status))}; | |
1947 | if (!assertSuccess("Error creating Measure units", status)) { | |
1948 | return; | |
1949 | } | |
1950 | UMeasureFormatWidth styles[] = { | |
1951 | UMEASFMT_WIDTH_WIDE, | |
1952 | UMEASFMT_WIDTH_SHORT}; | |
1953 | int32_t numbers[] = {1, 7}; | |
1954 | const char *expected[] = { | |
b331163b | 1955 | // "el_GR" 1 wide |
57a6839d A |
1956 | "1 \\u03B4\\u03B5\\u03C5\\u03C4\\u03B5\\u03C1\\u03CC\\u03BB\\u03B5\\u03C0\\u03C4\\u03BF", |
1957 | "1 \\u03BB\\u03B5\\u03C0\\u03C4\\u03CC", | |
1958 | "1 \\u03CE\\u03C1\\u03B1", | |
1959 | "1 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B1", | |
1960 | "1 \\u03B5\\u03B2\\u03B4\\u03BF\\u03BC\\u03AC\\u03B4\\u03B1", | |
1961 | "1 \\u03BC\\u03AE\\u03BD\\u03B1\\u03C2", | |
1962 | "1 \\u03AD\\u03C4\\u03BF\\u03C2", | |
b331163b | 1963 | // "el_GR" 1 short |
57a6839d A |
1964 | "1 \\u03B4\\u03B5\\u03C5\\u03C4.", |
1965 | "1 \\u03BB\\u03B5\\u03C0.", | |
1966 | "1 \\u03CE\\u03C1\\u03B1", | |
1967 | "1 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B1", | |
1968 | "1 \\u03B5\\u03B2\\u03B4.", | |
1969 | "1 \\u03BC\\u03AE\\u03BD.", | |
b331163b A |
1970 | "1 \\u03AD\\u03C4.", // year (one) |
1971 | // "el_GR" 7 wide | |
57a6839d A |
1972 | "7 \\u03B4\\u03B5\\u03C5\\u03C4\\u03B5\\u03C1\\u03CC\\u03BB\\u03B5\\u03C0\\u03C4\\u03B1", |
1973 | "7 \\u03BB\\u03B5\\u03C0\\u03C4\\u03AC", | |
1974 | "7 \\u03CE\\u03C1\\u03B5\\u03C2", | |
1975 | "7 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B5\\u03C2", | |
1976 | "7 \\u03B5\\u03B2\\u03B4\\u03BF\\u03BC\\u03AC\\u03B4\\u03B5\\u03C2", | |
1977 | "7 \\u03BC\\u03AE\\u03BD\\u03B5\\u03C2", | |
1978 | "7 \\u03AD\\u03C4\\u03B7", | |
b331163b | 1979 | // "el_GR" 7 short |
57a6839d A |
1980 | "7 \\u03B4\\u03B5\\u03C5\\u03C4.", |
1981 | "7 \\u03BB\\u03B5\\u03C0.", | |
b331163b | 1982 | "7 \\u03CE\\u03C1.", // hour (other) |
57a6839d A |
1983 | "7 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B5\\u03C2", |
1984 | "7 \\u03B5\\u03B2\\u03B4.", | |
1985 | "7 \\u03BC\\u03AE\\u03BD.", | |
b331163b A |
1986 | "7 \\u03AD\\u03C4.", // year (other) |
1987 | ||
1988 | // "el" 1 wide | |
57a6839d A |
1989 | "1 \\u03B4\\u03B5\\u03C5\\u03C4\\u03B5\\u03C1\\u03CC\\u03BB\\u03B5\\u03C0\\u03C4\\u03BF", |
1990 | "1 \\u03BB\\u03B5\\u03C0\\u03C4\\u03CC", | |
1991 | "1 \\u03CE\\u03C1\\u03B1", | |
1992 | "1 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B1", | |
1993 | "1 \\u03B5\\u03B2\\u03B4\\u03BF\\u03BC\\u03AC\\u03B4\\u03B1", | |
1994 | "1 \\u03BC\\u03AE\\u03BD\\u03B1\\u03C2", | |
1995 | "1 \\u03AD\\u03C4\\u03BF\\u03C2", | |
b331163b | 1996 | // "el" 1 short |
57a6839d A |
1997 | "1 \\u03B4\\u03B5\\u03C5\\u03C4.", |
1998 | "1 \\u03BB\\u03B5\\u03C0.", | |
1999 | "1 \\u03CE\\u03C1\\u03B1", | |
2000 | "1 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B1", | |
2001 | "1 \\u03B5\\u03B2\\u03B4.", | |
2002 | "1 \\u03BC\\u03AE\\u03BD.", | |
b331163b A |
2003 | "1 \\u03AD\\u03C4.", // year (one) |
2004 | // "el" 7 wide | |
57a6839d A |
2005 | "7 \\u03B4\\u03B5\\u03C5\\u03C4\\u03B5\\u03C1\\u03CC\\u03BB\\u03B5\\u03C0\\u03C4\\u03B1", |
2006 | "7 \\u03BB\\u03B5\\u03C0\\u03C4\\u03AC", | |
2007 | "7 \\u03CE\\u03C1\\u03B5\\u03C2", | |
2008 | "7 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B5\\u03C2", | |
2009 | "7 \\u03B5\\u03B2\\u03B4\\u03BF\\u03BC\\u03AC\\u03B4\\u03B5\\u03C2", | |
2010 | "7 \\u03BC\\u03AE\\u03BD\\u03B5\\u03C2", | |
2011 | "7 \\u03AD\\u03C4\\u03B7", | |
b331163b | 2012 | // "el" 7 short |
57a6839d A |
2013 | "7 \\u03B4\\u03B5\\u03C5\\u03C4.", |
2014 | "7 \\u03BB\\u03B5\\u03C0.", | |
b331163b | 2015 | "7 \\u03CE\\u03C1.", // hour (other) |
57a6839d A |
2016 | "7 \\u03B7\\u03BC\\u03AD\\u03C1\\u03B5\\u03C2", |
2017 | "7 \\u03B5\\u03B2\\u03B4.", | |
2018 | "7 \\u03BC\\u03AE\\u03BD.", | |
b331163b | 2019 | "7 \\u03AD\\u03C4."}; // year (other) |
57a6839d A |
2020 | |
2021 | int32_t counter = 0; | |
b331163b A |
2022 | for (int32_t locIndex = 0; locIndex < UPRV_LENGTHOF(locales); ++locIndex ) { |
2023 | for( int32_t numIndex = 0; numIndex < UPRV_LENGTHOF(numbers); ++numIndex ) { | |
2024 | for ( int32_t styleIndex = 0; styleIndex < UPRV_LENGTHOF(styles); ++styleIndex ) { | |
2025 | for ( int32_t unitIndex = 0; unitIndex < UPRV_LENGTHOF(units); ++unitIndex ) { | |
57a6839d A |
2026 | Measure measure(numbers[numIndex], new MeasureUnit(units[unitIndex]), status); |
2027 | if (!assertSuccess("Error creating Measure", status)) { | |
2028 | return; | |
2029 | } | |
2030 | MeasureFormat fmt(locales[locIndex], styles[styleIndex], status); | |
2031 | if (!assertSuccess("Error creating Measure format", status)) { | |
2032 | return; | |
2033 | } | |
2034 | verifyFormat("TestGreek", fmt, &measure, 1, expected[counter]); | |
2035 | ++counter; | |
2036 | } | |
2037 | } | |
2038 | } | |
2039 | } | |
2040 | } | |
2041 | ||
2042 | void MeasureFormatTest::TestFormatSingleArg() { | |
2043 | UErrorCode status = U_ZERO_ERROR; | |
2044 | MeasureFormat fmt("en", UMEASFMT_WIDTH_WIDE, status); | |
2045 | if (!assertSuccess("Error creating formatter", status)) { | |
2046 | return; | |
2047 | } | |
2048 | UnicodeString buffer; | |
f3c0d7a5 | 2049 | FieldPosition pos(FieldPosition::DONT_CARE); |
57a6839d A |
2050 | fmt.format( |
2051 | new Measure(3.5, MeasureUnit::createFoot(status), status), | |
2052 | buffer, | |
2053 | pos, | |
2054 | status); | |
2055 | if (!assertSuccess("Error formatting", status)) { | |
2056 | return; | |
2057 | } | |
2058 | assertEquals( | |
2059 | "TestFormatSingleArg", | |
2060 | UnicodeString("3.5 feet"), | |
2061 | buffer); | |
2062 | } | |
2063 | ||
2064 | void MeasureFormatTest::TestFormatMeasuresZeroArg() { | |
2065 | UErrorCode status = U_ZERO_ERROR; | |
2066 | MeasureFormat fmt("en", UMEASFMT_WIDTH_WIDE, status); | |
2067 | verifyFormat("TestFormatMeasuresZeroArg", fmt, NULL, 0, ""); | |
2068 | } | |
2069 | ||
b331163b A |
2070 | void MeasureFormatTest::TestSimplePer() { |
2071 | Locale en("en"); | |
2072 | UErrorCode status = U_ZERO_ERROR; | |
2073 | LocalPointer<MeasureUnit> second(MeasureUnit::createSecond(status)); | |
2074 | LocalPointer<MeasureUnit> minute(MeasureUnit::createMinute(status)); | |
2075 | LocalPointer<MeasureUnit> pound(MeasureUnit::createPound(status)); | |
2076 | if (!assertSuccess("", status)) { | |
2077 | return; | |
2078 | } | |
2079 | ||
2080 | helperTestSimplePer( | |
2081 | en, UMEASFMT_WIDTH_WIDE, | |
2082 | 1.0, *pound, *second, "1 pound per second"); | |
2083 | helperTestSimplePer( | |
2084 | en, UMEASFMT_WIDTH_WIDE, | |
2085 | 2.0, *pound, *second, "2 pounds per second"); | |
2086 | helperTestSimplePer( | |
2087 | en, UMEASFMT_WIDTH_WIDE, | |
2088 | 1.0, *pound, *minute, "1 pound per minute"); | |
2089 | helperTestSimplePer( | |
2090 | en, UMEASFMT_WIDTH_WIDE, | |
2091 | 2.0, *pound, *minute, "2 pounds per minute"); | |
2092 | ||
2093 | helperTestSimplePer( | |
2ca993e8 | 2094 | en, UMEASFMT_WIDTH_SHORT, 1.0, *pound, *second, "1 lb/s"); |
b331163b | 2095 | helperTestSimplePer( |
2ca993e8 | 2096 | en, UMEASFMT_WIDTH_SHORT, 2.0, *pound, *second, "2 lb/s"); |
b331163b A |
2097 | helperTestSimplePer( |
2098 | en, UMEASFMT_WIDTH_SHORT, 1.0, *pound, *minute, "1 lb/min"); | |
2099 | helperTestSimplePer( | |
2100 | en, UMEASFMT_WIDTH_SHORT, 2.0, *pound, *minute, "2 lb/min"); | |
2101 | ||
2102 | helperTestSimplePer( | |
2103 | en, UMEASFMT_WIDTH_NARROW, 1.0, *pound, *second, "1#/s"); | |
2104 | helperTestSimplePer( | |
2105 | en, UMEASFMT_WIDTH_NARROW, 2.0, *pound, *second, "2#/s"); | |
2106 | helperTestSimplePer( | |
2ca993e8 | 2107 | en, UMEASFMT_WIDTH_NARROW, 1.0, *pound, *minute, "1#/min"); |
b331163b | 2108 | helperTestSimplePer( |
2ca993e8 | 2109 | en, UMEASFMT_WIDTH_NARROW, 2.0, *pound, *minute, "2#/min"); |
b331163b A |
2110 | |
2111 | helperTestSimplePer( | |
2112 | en, UMEASFMT_WIDTH_SHORT, | |
2ca993e8 | 2113 | 23.3, *pound, *second, "23.3 lb/s", |
b331163b A |
2114 | NumberFormat::kDecimalSeparatorField, |
2115 | 2, 3); | |
2116 | ||
2117 | helperTestSimplePer( | |
2118 | en, UMEASFMT_WIDTH_SHORT, | |
2ca993e8 | 2119 | 23.3, *pound, *second, "23.3 lb/s", |
b331163b A |
2120 | NumberFormat::kIntegerField, |
2121 | 0, 2); | |
2122 | ||
2123 | helperTestSimplePer( | |
2124 | en, UMEASFMT_WIDTH_SHORT, | |
2125 | 23.3, *pound, *minute, "23.3 lb/min", | |
2126 | NumberFormat::kDecimalSeparatorField, | |
2127 | 2, 3); | |
2128 | ||
2129 | helperTestSimplePer( | |
2130 | en, UMEASFMT_WIDTH_SHORT, | |
2131 | 23.3, *pound, *minute, "23.3 lb/min", | |
2132 | NumberFormat::kIntegerField, | |
2133 | 0, 2); | |
2134 | } | |
2135 | ||
2136 | void MeasureFormatTest::TestNumeratorPlurals() { | |
2137 | Locale pl("pl"); | |
2138 | UErrorCode status = U_ZERO_ERROR; | |
2139 | LocalPointer<MeasureUnit> second(MeasureUnit::createSecond(status)); | |
2140 | LocalPointer<MeasureUnit> foot(MeasureUnit::createFoot(status)); | |
2141 | if (!assertSuccess("", status)) { | |
2142 | return; | |
2143 | } | |
2144 | ||
2145 | helperTestSimplePer( | |
2146 | pl, | |
2147 | UMEASFMT_WIDTH_WIDE, | |
2148 | 1.0, *foot, *second, "1 stopa na sekund\\u0119"); | |
2149 | helperTestSimplePer( | |
2150 | pl, | |
2151 | UMEASFMT_WIDTH_WIDE, | |
2152 | 2.0, *foot, *second, "2 stopy na sekund\\u0119"); | |
2153 | helperTestSimplePer( | |
2154 | pl, | |
2155 | UMEASFMT_WIDTH_WIDE, | |
2156 | 5.0, *foot, *second, "5 st\\u00f3p na sekund\\u0119"); | |
2157 | helperTestSimplePer( | |
2158 | pl, UMEASFMT_WIDTH_WIDE, | |
2159 | 1.5, *foot, *second, "1,5 stopy na sekund\\u0119"); | |
2160 | } | |
2161 | ||
2162 | void MeasureFormatTest::helperTestSimplePer( | |
2163 | const Locale &locale, | |
2164 | UMeasureFormatWidth width, | |
2165 | double value, | |
2166 | const MeasureUnit &unit, | |
2167 | const MeasureUnit &perUnit, | |
2168 | const char *expected) { | |
2169 | helperTestSimplePer( | |
2170 | locale, | |
2171 | width, | |
2172 | value, | |
2173 | unit, | |
2174 | perUnit, | |
2175 | expected, | |
2176 | FieldPosition::DONT_CARE, | |
2177 | 0, | |
2178 | 0); | |
2179 | } | |
2180 | ||
2181 | void MeasureFormatTest::helperTestSimplePer( | |
2182 | const Locale &locale, | |
2183 | UMeasureFormatWidth width, | |
2184 | double value, | |
2185 | const MeasureUnit &unit, | |
2186 | const MeasureUnit &perUnit, | |
2187 | const char *expected, | |
2188 | int32_t field, | |
2189 | int32_t expected_start, | |
2190 | int32_t expected_end) { | |
2191 | UErrorCode status = U_ZERO_ERROR; | |
2192 | FieldPosition pos(field); | |
2193 | MeasureFormat fmt(locale, width, status); | |
2194 | if (!assertSuccess("Error creating format object", status)) { | |
2195 | return; | |
2196 | } | |
2197 | Measure measure(value, (MeasureUnit *) unit.clone(), status); | |
2198 | if (!assertSuccess("Error creating measure object", status)) { | |
2199 | return; | |
2200 | } | |
2201 | UnicodeString prefix("prefix: "); | |
2202 | UnicodeString buffer(prefix); | |
2203 | fmt.formatMeasurePerUnit( | |
2204 | measure, | |
2205 | perUnit, | |
2206 | buffer, | |
2207 | pos, | |
2208 | status); | |
2209 | if (!assertSuccess("Error formatting measures with per", status)) { | |
2210 | return; | |
2211 | } | |
2212 | UnicodeString uexpected(expected); | |
2213 | uexpected = prefix + uexpected; | |
2214 | assertEquals( | |
2215 | "TestSimplePer", | |
2216 | uexpected.unescape(), | |
2217 | buffer); | |
2218 | if (field != FieldPosition::DONT_CARE) { | |
2219 | assertEquals( | |
2220 | "Start", expected_start, pos.getBeginIndex() - prefix.length()); | |
2221 | assertEquals( | |
2222 | "End", expected_end, pos.getEndIndex() - prefix.length()); | |
2223 | } | |
2224 | } | |
2225 | ||
57a6839d A |
2226 | void MeasureFormatTest::TestMultiples() { |
2227 | Locale ru("ru"); | |
2228 | Locale en("en"); | |
0f5d89e8 A |
2229 | helperTestMultiples(en, UMEASFMT_WIDTH_WIDE, "2 miles, 1 foot, 2.3 inches"); |
2230 | helperTestMultiples(en, UMEASFMT_WIDTH_SHORT, "2 mi, 1 ft, 2.3 in"); | |
57a6839d | 2231 | helperTestMultiples(en, UMEASFMT_WIDTH_NARROW, "2mi 1\\u2032 2.3\\u2033"); |
0f5d89e8 | 2232 | helperTestMultiples(ru, UMEASFMT_WIDTH_WIDE, "2 \\u043C\\u0438\\u043B\\u0438, 1 \\u0444\\u0443\\u0442, 2,3 \\u0434\\u044E\\u0439\\u043C\\u0430"); |
3d1f044b A |
2233 | helperTestMultiples(ru, UMEASFMT_WIDTH_SHORT, "2 \\u043C\\u0438, 1 \\u0444\\u0442, 2,3 \\u0434\\u044E\\u0439\\u043C."); |
2234 | helperTestMultiples(ru, UMEASFMT_WIDTH_NARROW, "2 \\u043C\\u0438 1\\u2032 2,3\\u2033"); | |
57a6839d A |
2235 | } |
2236 | ||
2237 | void MeasureFormatTest::helperTestMultiples( | |
2238 | const Locale &locale, | |
2239 | UMeasureFormatWidth width, | |
2240 | const char *expected) { | |
2241 | UErrorCode status = U_ZERO_ERROR; | |
f3c0d7a5 | 2242 | FieldPosition pos(FieldPosition::DONT_CARE); |
57a6839d A |
2243 | MeasureFormat fmt(locale, width, status); |
2244 | if (!assertSuccess("Error creating format object", status)) { | |
2245 | return; | |
2246 | } | |
2247 | Measure measures[] = { | |
f3c0d7a5 A |
2248 | Measure(2.0, MeasureUnit::createMile(status), status), |
2249 | Measure(1.0, MeasureUnit::createFoot(status), status), | |
57a6839d A |
2250 | Measure(2.3, MeasureUnit::createInch(status), status)}; |
2251 | if (!assertSuccess("Error creating measures", status)) { | |
2252 | return; | |
2253 | } | |
2254 | UnicodeString buffer; | |
b331163b | 2255 | fmt.formatMeasures(measures, UPRV_LENGTHOF(measures), buffer, pos, status); |
57a6839d A |
2256 | if (!assertSuccess("Error formatting measures", status)) { |
2257 | return; | |
2258 | } | |
2259 | assertEquals("TestMultiples", UnicodeString(expected).unescape(), buffer); | |
2260 | } | |
2261 | ||
2ca993e8 A |
2262 | void MeasureFormatTest::TestManyLocaleDurations() { |
2263 | UErrorCode status = U_ZERO_ERROR; | |
2264 | Measure measures[] = { | |
f3c0d7a5 A |
2265 | Measure(5.0, MeasureUnit::createHour(status), status), |
2266 | Measure(37.0, MeasureUnit::createMinute(status), status)}; | |
2ca993e8 A |
2267 | if (!assertSuccess("Error creating measures", status)) { |
2268 | return; | |
2269 | } | |
2270 | helperTestManyLocaleDurations("da", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5 t. 37 m."); // Apple data change | |
2271 | helperTestManyLocaleDurations("da", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5.37"); | |
2272 | helperTestManyLocaleDurations("de", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5h 37min"); // Apple data change | |
2273 | helperTestManyLocaleDurations("de", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
2274 | helperTestManyLocaleDurations("en", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5h 37m"); | |
2275 | helperTestManyLocaleDurations("en", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
f3c0d7a5 A |
2276 | helperTestManyLocaleDurations("en_GB", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5h 37m"); |
2277 | helperTestManyLocaleDurations("en_GB", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
2ca993e8 A |
2278 | helperTestManyLocaleDurations("es", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5h 37min"); |
2279 | helperTestManyLocaleDurations("es", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
2280 | helperTestManyLocaleDurations("fi", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5t 37min"); | |
2281 | helperTestManyLocaleDurations("fi", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5.37"); | |
2282 | helperTestManyLocaleDurations("fr", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5h 37mn"); | |
0f5d89e8 | 2283 | helperTestManyLocaleDurations("fr", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); |
2ca993e8 A |
2284 | helperTestManyLocaleDurations("is", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5 klst. og 37 m\\u00EDn."); |
2285 | helperTestManyLocaleDurations("is", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
0f5d89e8 | 2286 | helperTestManyLocaleDurations("ja", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5\\u6642\\u959337\\u5206"); |
2ca993e8 | 2287 | helperTestManyLocaleDurations("ja", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); |
1a147d09 | 2288 | helperTestManyLocaleDurations("nb", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5 t, 37 m"); |
f3c0d7a5 | 2289 | helperTestManyLocaleDurations("nb", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); |
2ca993e8 A |
2290 | helperTestManyLocaleDurations("nl", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5 u, 37 m"); |
2291 | helperTestManyLocaleDurations("nl", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
0f5d89e8 | 2292 | helperTestManyLocaleDurations("nn", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5t og 37m"); |
f3c0d7a5 | 2293 | helperTestManyLocaleDurations("nn", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); |
2ca993e8 A |
2294 | helperTestManyLocaleDurations("sv", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5h 37m"); |
2295 | helperTestManyLocaleDurations("sv", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
2296 | helperTestManyLocaleDurations("zh", UMEASFMT_WIDTH_NARROW, measures, UPRV_LENGTHOF(measures), "5\\u5C0F\\u65F637\\u5206\\u949F"); | |
2297 | helperTestManyLocaleDurations("zh", UMEASFMT_WIDTH_NUMERIC, measures, UPRV_LENGTHOF(measures), "5:37"); | |
2298 | } | |
2299 | ||
2300 | void MeasureFormatTest::helperTestManyLocaleDurations( const char *localeID, | |
2301 | UMeasureFormatWidth width, | |
2302 | const Measure *measures, | |
2303 | int32_t measureCount, | |
2304 | const char *expected) { | |
2305 | UErrorCode status = U_ZERO_ERROR; | |
2306 | MeasureFormat fmt(Locale(localeID), width, status); | |
2307 | if (U_FAILURE(status)) { | |
2308 | errln("Could not create MeasureFormat for locale %s, width %d, status: %s", localeID, (int)width, u_errorName(status)); | |
2309 | return; | |
2310 | } | |
2311 | UnicodeString buffer; | |
f3c0d7a5 | 2312 | FieldPosition pos(FieldPosition::DONT_CARE); |
2ca993e8 A |
2313 | fmt.formatMeasures(measures, measureCount, buffer, pos, status); |
2314 | if (U_FAILURE(status)) { | |
2315 | errln("MeasureFormat::formatMeasures failed for locale %s, width %d, status: %s", localeID, (int)width, u_errorName(status)); | |
2316 | return; | |
2317 | } | |
2318 | UnicodeString expStr(UnicodeString(expected).unescape()); | |
2319 | if (buffer != expStr) { | |
2320 | errln("MeasureFormat::formatMeasures for locale " + UnicodeString(localeID) + ", width " + width + ", expected \"" + expStr + "\", got \"" + buffer + "\""); | |
2321 | } | |
2322 | } | |
2323 | ||
57a6839d A |
2324 | void MeasureFormatTest::TestGram() { |
2325 | UErrorCode status = U_ZERO_ERROR; | |
2326 | MeasureFormat fmt("en", UMEASFMT_WIDTH_SHORT, status); | |
2327 | if (!assertSuccess("Error creating format object", status)) { | |
2328 | return; | |
2329 | } | |
f3c0d7a5 A |
2330 | Measure gram((double)1, MeasureUnit::createGram(status), status); |
2331 | Measure gforce((double)1, MeasureUnit::createGForce(status), status); | |
57a6839d A |
2332 | if (!assertSuccess("Error creating measures", status)) { |
2333 | return; | |
2334 | } | |
2335 | verifyFormat("TestGram", fmt, &gram, 1, "1 g"); | |
2336 | verifyFormat("TestGram", fmt, &gforce, 1, "1 G"); | |
2337 | } | |
2338 | ||
2339 | void MeasureFormatTest::TestCurrencies() { | |
3d1f044b | 2340 | UChar USD[4] = {}; |
f3c0d7a5 | 2341 | u_uastrcpy(USD, "USD"); |
57a6839d | 2342 | UErrorCode status = U_ZERO_ERROR; |
3d1f044b A |
2343 | CurrencyUnit USD_unit(USD, status); |
2344 | assertEquals("Currency Unit", USD, USD_unit.getISOCurrency()); | |
2345 | if (!assertSuccess("Error creating CurrencyUnit", status)) { | |
2346 | return; | |
2347 | } | |
57a6839d | 2348 | CurrencyAmount USD_1(1.0, USD, status); |
f3c0d7a5 | 2349 | assertEquals("Currency Code", USD, USD_1.getISOCurrency()); |
57a6839d A |
2350 | CurrencyAmount USD_2(2.0, USD, status); |
2351 | CurrencyAmount USD_NEG_1(-1.0, USD, status); | |
f3c0d7a5 | 2352 | if (!assertSuccess("Error creating currencies", status)) { |
57a6839d A |
2353 | return; |
2354 | } | |
2355 | Locale en("en"); | |
2356 | MeasureFormat fmt(en, UMEASFMT_WIDTH_WIDE, status); | |
2357 | if (!assertSuccess("Error creating format object", status)) { | |
2358 | return; | |
2359 | } | |
2360 | verifyFormat("TestCurrenciesWide", fmt, &USD_NEG_1, 1, "-1.00 US dollars"); | |
2361 | verifyFormat("TestCurrenciesWide", fmt, &USD_1, 1, "1.00 US dollars"); | |
2362 | verifyFormat("TestCurrenciesWide", fmt, &USD_2, 1, "2.00 US dollars"); | |
2363 | fmt = MeasureFormat(en, UMEASFMT_WIDTH_SHORT, status); | |
2364 | if (!assertSuccess("Error creating format object", status)) { | |
2365 | return; | |
2366 | } | |
3d1f044b A |
2367 | verifyFormat("TestCurrenciesShort", fmt, &USD_NEG_1, 1, "-USD\\u00A01.00"); |
2368 | verifyFormat("TestCurrenciesShort", fmt, &USD_1, 1, "USD\\u00A01.00"); | |
2369 | verifyFormat("TestCurrenciesShort", fmt, &USD_2, 1, "USD\\u00A02.00"); | |
57a6839d A |
2370 | fmt = MeasureFormat(en, UMEASFMT_WIDTH_NARROW, status); |
2371 | if (!assertSuccess("Error creating format object", status)) { | |
2372 | return; | |
2373 | } | |
2374 | verifyFormat("TestCurrenciesNarrow", fmt, &USD_NEG_1, 1, "-$1.00"); | |
2375 | verifyFormat("TestCurrenciesNarrow", fmt, &USD_1, 1, "$1.00"); | |
2376 | verifyFormat("TestCurrenciesNarrow", fmt, &USD_2, 1, "$2.00"); | |
2377 | fmt = MeasureFormat(en, UMEASFMT_WIDTH_NUMERIC, status); | |
2378 | if (!assertSuccess("Error creating format object", status)) { | |
2379 | return; | |
2380 | } | |
2381 | verifyFormat("TestCurrenciesNumeric", fmt, &USD_NEG_1, 1, "-$1.00"); | |
2382 | verifyFormat("TestCurrenciesNumeric", fmt, &USD_1, 1, "$1.00"); | |
2383 | verifyFormat("TestCurrenciesNumeric", fmt, &USD_2, 1, "$2.00"); | |
2384 | } | |
2385 | ||
f3c0d7a5 A |
2386 | void MeasureFormatTest::TestDisplayNames() { |
2387 | UErrorCode status = U_ZERO_ERROR; | |
2388 | helperTestDisplayName( MeasureUnit::createYear(status), "en", UMEASFMT_WIDTH_WIDE, "years" ); | |
2389 | helperTestDisplayName( MeasureUnit::createYear(status), "ja", UMEASFMT_WIDTH_WIDE, "\\u5E74" ); | |
2390 | helperTestDisplayName( MeasureUnit::createYear(status), "es", UMEASFMT_WIDTH_WIDE, "a\\u00F1os" ); | |
2391 | helperTestDisplayName( MeasureUnit::createYear(status), "pt", UMEASFMT_WIDTH_WIDE, "anos" ); | |
2392 | helperTestDisplayName( MeasureUnit::createYear(status), "pt-PT", UMEASFMT_WIDTH_WIDE, "anos" ); | |
2393 | helperTestDisplayName( MeasureUnit::createAmpere(status), "en", UMEASFMT_WIDTH_WIDE, "amperes" ); | |
2394 | helperTestDisplayName( MeasureUnit::createAmpere(status), "ja", UMEASFMT_WIDTH_WIDE, "\\u30A2\\u30F3\\u30DA\\u30A2" ); | |
2395 | helperTestDisplayName( MeasureUnit::createAmpere(status), "es", UMEASFMT_WIDTH_WIDE, "amperios" ); | |
2396 | helperTestDisplayName( MeasureUnit::createAmpere(status), "pt", UMEASFMT_WIDTH_WIDE, "amperes" ); | |
2397 | helperTestDisplayName( MeasureUnit::createAmpere(status), "pt-PT", UMEASFMT_WIDTH_WIDE, "amperes" ); | |
2398 | helperTestDisplayName( MeasureUnit::createMeterPerSecondSquared(status), "pt", UMEASFMT_WIDTH_WIDE, "metros por segundo ao quadrado" ); | |
2399 | helperTestDisplayName( MeasureUnit::createMeterPerSecondSquared(status), "pt-PT", UMEASFMT_WIDTH_WIDE, "metros por segundo quadrado" ); | |
2400 | helperTestDisplayName( MeasureUnit::createSquareKilometer(status), "pt", UMEASFMT_WIDTH_NARROW, "km\\u00B2" ); | |
2401 | helperTestDisplayName( MeasureUnit::createSquareKilometer(status), "pt", UMEASFMT_WIDTH_SHORT, "km\\u00B2" ); | |
2402 | helperTestDisplayName( MeasureUnit::createSquareKilometer(status), "pt", UMEASFMT_WIDTH_WIDE, "quil\\u00F4metros quadrados" ); | |
2403 | helperTestDisplayName( MeasureUnit::createSecond(status), "pt-PT", UMEASFMT_WIDTH_NARROW, "s" ); | |
2404 | helperTestDisplayName( MeasureUnit::createSecond(status), "pt-PT", UMEASFMT_WIDTH_SHORT, "s" ); | |
2405 | helperTestDisplayName( MeasureUnit::createSecond(status), "pt-PT", UMEASFMT_WIDTH_WIDE, "segundos" ); | |
2406 | helperTestDisplayName( MeasureUnit::createSecond(status), "pt", UMEASFMT_WIDTH_NARROW, "seg" ); | |
0f5d89e8 | 2407 | helperTestDisplayName( MeasureUnit::createSecond(status), "pt", UMEASFMT_WIDTH_SHORT, "seg" ); |
f3c0d7a5 A |
2408 | helperTestDisplayName( MeasureUnit::createSecond(status), "pt", UMEASFMT_WIDTH_WIDE, "segundos" ); |
2409 | assertSuccess("Error creating measure units", status); | |
2410 | } | |
2411 | ||
2412 | void MeasureFormatTest::helperTestDisplayName(const MeasureUnit *unit, | |
2413 | const char *localeID, | |
2414 | UMeasureFormatWidth width, | |
2415 | const char *expected) { | |
2416 | UErrorCode status = U_ZERO_ERROR; | |
2417 | MeasureFormat fmt(Locale(localeID), width, status); | |
2418 | if (U_FAILURE(status)) { | |
2419 | errln("Could not create MeasureFormat for locale %s, width %d, status: %s", | |
2420 | localeID, (int)width, u_errorName(status)); | |
2421 | return; | |
2422 | } | |
2423 | ||
2424 | UnicodeString dnam = fmt.getUnitDisplayName(*unit, status); | |
2425 | if (U_FAILURE(status)) { | |
2426 | errln("MeasureFormat::getUnitDisplayName failed for unit %s-%s, locale %s, width %d, status: %s", | |
2427 | unit->getType(), unit->getSubtype(), localeID, (int)width, u_errorName(status)); | |
2428 | return; | |
2429 | } | |
2430 | ||
2431 | UnicodeString expStr(UnicodeString(expected).unescape()); | |
2432 | if (dnam != expStr) { | |
2433 | errln("MeasureFormat::getUnitDisplayName for unit %s-%s, locale %s, width %d: expected \"%s\", got \"%s\"", | |
2434 | unit->getType(), unit->getSubtype(), localeID, (int)width, CStr(expStr)(), CStr(dnam)()); | |
2435 | } | |
2436 | ||
2437 | // Delete the measure unit | |
2438 | delete unit; | |
2439 | } | |
2440 | ||
57a6839d A |
2441 | void MeasureFormatTest::TestFieldPosition() { |
2442 | UErrorCode status = U_ZERO_ERROR; | |
2443 | MeasureFormat fmt("en", UMEASFMT_WIDTH_SHORT, status); | |
2444 | if (!assertSuccess("Error creating format object", status)) { | |
2445 | return; | |
2446 | } | |
2447 | Measure measure(43.5, MeasureUnit::createFoot(status), status); | |
2448 | if (!assertSuccess("Error creating measure object 1", status)) { | |
2449 | return; | |
2450 | } | |
2451 | UnicodeString prefix("123456: "); | |
2452 | verifyFieldPosition( | |
2453 | "", | |
2454 | fmt, | |
2455 | prefix, | |
2456 | &measure, | |
2457 | 1, | |
2458 | NumberFormat::kDecimalSeparatorField, | |
2459 | 10, | |
2460 | 11); | |
f3c0d7a5 | 2461 | measure = Measure(43.0, MeasureUnit::createFoot(status), status); |
57a6839d A |
2462 | if (!assertSuccess("Error creating measure object 2", status)) { |
2463 | return; | |
2464 | } | |
2465 | verifyFieldPosition( | |
2466 | "", | |
2467 | fmt, | |
2468 | prefix, | |
2469 | &measure, | |
2470 | 1, | |
2471 | NumberFormat::kDecimalSeparatorField, | |
2472 | 0, | |
2473 | 0); | |
2474 | } | |
2475 | ||
2476 | void MeasureFormatTest::TestFieldPositionMultiple() { | |
2477 | UErrorCode status = U_ZERO_ERROR; | |
2478 | MeasureFormat fmt("en", UMEASFMT_WIDTH_SHORT, status); | |
2479 | if (!assertSuccess("Error creating format object", status)) { | |
2480 | return; | |
2481 | } | |
2482 | Measure first[] = { | |
f3c0d7a5 A |
2483 | Measure((double)354, MeasureUnit::createMeter(status), status), |
2484 | Measure((double)23, MeasureUnit::createCentimeter(status), status)}; | |
57a6839d | 2485 | Measure second[] = { |
f3c0d7a5 A |
2486 | Measure((double)354, MeasureUnit::createMeter(status), status), |
2487 | Measure((double)23, MeasureUnit::createCentimeter(status), status), | |
2488 | Measure((double)5.4, MeasureUnit::createMillimeter(status), status)}; | |
57a6839d | 2489 | Measure third[] = { |
f3c0d7a5 A |
2490 | Measure((double)3, MeasureUnit::createMeter(status), status), |
2491 | Measure((double)23, MeasureUnit::createCentimeter(status), status), | |
2492 | Measure((double)5, MeasureUnit::createMillimeter(status), status)}; | |
57a6839d A |
2493 | if (!assertSuccess("Error creating measure objects", status)) { |
2494 | return; | |
2495 | } | |
2496 | UnicodeString prefix("123456: "); | |
2497 | verifyFieldPosition( | |
2498 | "Integer", | |
2499 | fmt, | |
2500 | prefix, | |
2501 | first, | |
b331163b | 2502 | UPRV_LENGTHOF(first), |
57a6839d A |
2503 | NumberFormat::kIntegerField, |
2504 | 8, | |
2505 | 11); | |
2506 | verifyFieldPosition( | |
2507 | "Decimal separator", | |
2508 | fmt, | |
2509 | prefix, | |
2510 | second, | |
b331163b | 2511 | UPRV_LENGTHOF(second), |
57a6839d A |
2512 | NumberFormat::kDecimalSeparatorField, |
2513 | 23, | |
2514 | 24); | |
2515 | verifyFieldPosition( | |
2516 | "no decimal separator", | |
2517 | fmt, | |
2518 | prefix, | |
2519 | third, | |
b331163b | 2520 | UPRV_LENGTHOF(third), |
57a6839d A |
2521 | NumberFormat::kDecimalSeparatorField, |
2522 | 0, | |
2523 | 0); | |
2524 | } | |
2525 | ||
2526 | void MeasureFormatTest::TestBadArg() { | |
2527 | UErrorCode status = U_ZERO_ERROR; | |
2528 | MeasureFormat fmt("en", UMEASFMT_WIDTH_SHORT, status); | |
2529 | if (!assertSuccess("Error creating format object", status)) { | |
2530 | return; | |
2531 | } | |
f3c0d7a5 | 2532 | FieldPosition pos(FieldPosition::DONT_CARE); |
57a6839d A |
2533 | UnicodeString buffer; |
2534 | fmt.format( | |
2535 | 9.3, | |
2536 | buffer, | |
2537 | pos, | |
2538 | status); | |
2539 | if (status != U_ILLEGAL_ARGUMENT_ERROR) { | |
2540 | errln("Expected ILLEGAL_ARGUMENT_ERROR"); | |
2541 | } | |
2542 | } | |
2543 | ||
2544 | void MeasureFormatTest::TestEquality() { | |
2545 | UErrorCode status = U_ZERO_ERROR; | |
2546 | NumberFormat* nfeq = NumberFormat::createInstance("en", status); | |
2547 | NumberFormat* nfne = NumberFormat::createInstance("fr", status); | |
2548 | MeasureFormat fmt("en", UMEASFMT_WIDTH_SHORT, status); | |
2549 | MeasureFormat fmtEq2("en", UMEASFMT_WIDTH_SHORT, nfeq, status); | |
2550 | MeasureFormat fmtne1("en", UMEASFMT_WIDTH_WIDE, status); | |
2551 | MeasureFormat fmtne2("fr", UMEASFMT_WIDTH_SHORT, status); | |
2552 | MeasureFormat fmtne3("en", UMEASFMT_WIDTH_SHORT, nfne, status); | |
2553 | if (U_FAILURE(status)) { | |
2554 | dataerrln("Error creating MeasureFormats - %s", u_errorName(status)); | |
2555 | return; | |
2556 | } | |
2557 | MeasureFormat fmtEq(fmt); | |
2558 | assertTrue("Equal", fmt == fmtEq); | |
2559 | assertTrue("Equal2", fmt == fmtEq2); | |
2560 | assertFalse("Equal Neg", fmt != fmtEq); | |
2561 | assertTrue("Not Equal 1", fmt != fmtne1); | |
2562 | assertFalse("Not Equal Neg 1", fmt == fmtne1); | |
2563 | assertTrue("Not Equal 2", fmt != fmtne2); | |
2564 | assertTrue("Not Equal 3", fmt != fmtne3); | |
2565 | } | |
2566 | ||
b331163b A |
2567 | void MeasureFormatTest::TestGroupingSeparator() { |
2568 | UErrorCode status = U_ZERO_ERROR; | |
2569 | Locale en("en"); | |
2570 | MeasureFormat fmt(en, UMEASFMT_WIDTH_SHORT, status); | |
2571 | if (!assertSuccess("Error creating format object", status)) { | |
2572 | return; | |
2573 | } | |
2574 | Measure ms[] = { | |
2575 | Measure((int32_t)INT32_MAX, MeasureUnit::createYear(status), status), | |
2576 | Measure((int32_t)INT32_MIN, MeasureUnit::createMonth(status), status), | |
f3c0d7a5 A |
2577 | Measure(-987.0, MeasureUnit::createDay(status), status), |
2578 | Measure(1362.0, MeasureUnit::createHour(status), status), | |
2579 | Measure(987.0, MeasureUnit::createMinute(status), status)}; | |
b331163b A |
2580 | FieldPosition pos(NumberFormat::kGroupingSeparatorField); |
2581 | UnicodeString appendTo; | |
2582 | fmt.formatMeasures(ms, 5, appendTo, pos, status); | |
2583 | if (!assertSuccess("Error formatting", status)) { | |
2584 | return; | |
2585 | } | |
2586 | assertEquals( | |
2587 | "grouping separator", | |
2588 | "2,147,483,647 yrs, -2,147,483,648 mths, -987 days, 1,362 hr, 987 min", | |
2589 | appendTo); | |
3d1f044b A |
2590 | assertEquals("begin index", 1, pos.getBeginIndex()); |
2591 | assertEquals("end index", 2, pos.getEndIndex()); | |
b331163b A |
2592 | } |
2593 | ||
57a6839d A |
2594 | void MeasureFormatTest::TestDoubleZero() { |
2595 | UErrorCode status = U_ZERO_ERROR; | |
2596 | Measure measures[] = { | |
2597 | Measure(4.7, MeasureUnit::createHour(status), status), | |
f3c0d7a5 A |
2598 | Measure(23.0, MeasureUnit::createMinute(status), status), |
2599 | Measure(16.0, MeasureUnit::createSecond(status), status)}; | |
57a6839d A |
2600 | Locale en("en"); |
2601 | NumberFormat *nf = NumberFormat::createInstance(en, status); | |
2602 | MeasureFormat fmt("en", UMEASFMT_WIDTH_WIDE, nf, status); | |
2603 | UnicodeString appendTo; | |
2604 | FieldPosition pos(FieldPosition::DONT_CARE); | |
2605 | if (U_FAILURE(status)) { | |
2606 | dataerrln("Error creating formatter - %s", u_errorName(status)); | |
2607 | return; | |
2608 | } | |
2609 | nf->setMinimumFractionDigits(2); | |
2610 | nf->setMaximumFractionDigits(2); | |
b331163b | 2611 | fmt.formatMeasures(measures, UPRV_LENGTHOF(measures), appendTo, pos, status); |
57a6839d A |
2612 | if (!assertSuccess("Error formatting", status)) { |
2613 | return; | |
2614 | } | |
2615 | assertEquals( | |
2616 | "TestDoubleZero", | |
2617 | UnicodeString("4 hours, 23 minutes, 16.00 seconds"), | |
2618 | appendTo); | |
2619 | measures[0] = Measure(-4.7, MeasureUnit::createHour(status), status); | |
2620 | appendTo.remove(); | |
b331163b | 2621 | fmt.formatMeasures(measures, UPRV_LENGTHOF(measures), appendTo, pos, status); |
57a6839d A |
2622 | if (!assertSuccess("Error formatting", status)) { |
2623 | return; | |
2624 | } | |
2625 | assertEquals( | |
2626 | "TestDoubleZero", | |
2627 | UnicodeString("-4 hours, 23 minutes, 16.00 seconds"), | |
2628 | appendTo); | |
2629 | } | |
2630 | ||
b331163b A |
2631 | void MeasureFormatTest::TestUnitPerUnitResolution() { |
2632 | UErrorCode status = U_ZERO_ERROR; | |
2633 | Locale en("en"); | |
2634 | MeasureFormat fmt("en", UMEASFMT_WIDTH_SHORT, status); | |
f3c0d7a5 | 2635 | Measure measure(50.0, MeasureUnit::createPound(status), status); |
b331163b A |
2636 | LocalPointer<MeasureUnit> sqInch(MeasureUnit::createSquareInch(status)); |
2637 | if (!assertSuccess("Create of format unit and per unit", status)) { | |
2638 | return; | |
2639 | } | |
f3c0d7a5 | 2640 | FieldPosition pos(FieldPosition::DONT_CARE); |
b331163b A |
2641 | UnicodeString actual; |
2642 | fmt.formatMeasurePerUnit( | |
2643 | measure, | |
2644 | *sqInch, | |
2645 | actual, | |
2646 | pos, | |
2647 | status); | |
2648 | assertEquals("", "50 psi", actual); | |
2649 | } | |
2650 | ||
2ca993e8 A |
2651 | void MeasureFormatTest::TestIndividualPluralFallback() { |
2652 | // See ticket #11986 "incomplete fallback in MeasureFormat". | |
2653 | // In CLDR 28, fr_CA temperature-generic/short has only the "one" form, | |
2654 | // and falls back to fr for the "other" form. | |
2655 | IcuTestErrorCode errorCode(*this, "TestIndividualPluralFallback"); | |
2656 | MeasureFormat mf("fr_CA", UMEASFMT_WIDTH_SHORT, errorCode); | |
2657 | LocalPointer<Measure> twoDeg( | |
f3c0d7a5 | 2658 | new Measure(2.0, MeasureUnit::createGenericTemperature(errorCode), errorCode), errorCode); |
2ca993e8 A |
2659 | UnicodeString expected = UNICODE_STRING_SIMPLE("2\\u00B0").unescape(); |
2660 | UnicodeString actual; | |
2661 | assertEquals("2 deg temp in fr_CA", expected, mf.format(twoDeg.orphan(), actual, errorCode), TRUE); | |
2662 | } | |
2663 | ||
3d1f044b A |
2664 | void MeasureFormatTest::Test20332_PersonUnits() { |
2665 | IcuTestErrorCode status(*this, "Test20332_PersonUnits"); | |
2666 | const struct TestCase { | |
2667 | const char* locale; | |
2668 | MeasureUnit* unitToAdopt; | |
2669 | UMeasureFormatWidth width; | |
2670 | const char* expected; | |
2671 | } cases[] = { | |
2672 | {"en-us", MeasureUnit::createYearPerson(status), UMEASFMT_WIDTH_NARROW, "25y"}, | |
2673 | {"en-us", MeasureUnit::createYearPerson(status), UMEASFMT_WIDTH_SHORT, "25 yrs"}, | |
2674 | {"en-us", MeasureUnit::createYearPerson(status), UMEASFMT_WIDTH_WIDE, "25 years"}, | |
2675 | {"en-us", MeasureUnit::createMonthPerson(status), UMEASFMT_WIDTH_NARROW, "25mo"}, | |
2676 | {"en-us", MeasureUnit::createMonthPerson(status), UMEASFMT_WIDTH_SHORT, "25 mths"}, | |
2677 | {"en-us", MeasureUnit::createMonthPerson(status), UMEASFMT_WIDTH_WIDE, "25 months"}, | |
2678 | {"en-us", MeasureUnit::createWeekPerson(status), UMEASFMT_WIDTH_NARROW, "25w"}, | |
2679 | {"en-us", MeasureUnit::createWeekPerson(status), UMEASFMT_WIDTH_SHORT, "25 wks"}, | |
2680 | {"en-us", MeasureUnit::createWeekPerson(status), UMEASFMT_WIDTH_WIDE, "25 weeks"}, | |
2681 | {"en-us", MeasureUnit::createDayPerson(status), UMEASFMT_WIDTH_NARROW, "25d"}, | |
2682 | {"en-us", MeasureUnit::createDayPerson(status), UMEASFMT_WIDTH_SHORT, "25 days"}, | |
2683 | {"en-us", MeasureUnit::createDayPerson(status), UMEASFMT_WIDTH_WIDE, "25 days"} | |
2684 | }; | |
2685 | for (const auto& cas : cases) { | |
2686 | MeasureFormat mf(cas.locale, cas.width, status); | |
2687 | if (status.errIfFailureAndReset()) { return; } | |
2688 | Measure measure(25, cas.unitToAdopt, status); | |
2689 | if (status.errIfFailureAndReset()) { return; } | |
2690 | verifyFormat(cas.locale, mf, &measure, 1, cas.expected); | |
2691 | } | |
2692 | } | |
2693 | ||
2694 | ||
57a6839d A |
2695 | void MeasureFormatTest::verifyFieldPosition( |
2696 | const char *description, | |
2697 | const MeasureFormat &fmt, | |
2698 | const UnicodeString &prefix, | |
2699 | const Measure *measures, | |
2700 | int32_t measureCount, | |
2701 | NumberFormat::EAlignmentFields field, | |
2702 | int32_t start, | |
2703 | int32_t end) { | |
2704 | // 8 char lead | |
2705 | UnicodeString result(prefix); | |
2706 | FieldPosition pos(field); | |
2707 | UErrorCode status = U_ZERO_ERROR; | |
2708 | CharString ch; | |
2709 | const char *descPrefix = ch.append(description, status) | |
2710 | .append(": ", status).data(); | |
2711 | CharString beginIndex; | |
2712 | beginIndex.append(descPrefix, status).append("beginIndex", status); | |
2713 | CharString endIndex; | |
2714 | endIndex.append(descPrefix, status).append("endIndex", status); | |
2715 | fmt.formatMeasures(measures, measureCount, result, pos, status); | |
2716 | if (!assertSuccess("Error formatting", status)) { | |
2717 | return; | |
2718 | } | |
2719 | assertEquals(beginIndex.data(), start, pos.getBeginIndex()); | |
2720 | assertEquals(endIndex.data(), end, pos.getEndIndex()); | |
2721 | } | |
2722 | ||
2723 | void MeasureFormatTest::verifyFormat( | |
2724 | const char *description, | |
2725 | const MeasureFormat &fmt, | |
2726 | const Measure *measures, | |
2727 | int32_t measureCount, | |
2728 | const char *expected) { | |
2729 | verifyFormatWithPrefix( | |
2730 | description, | |
2731 | fmt, | |
2732 | "", | |
2733 | measures, | |
2734 | measureCount, | |
2735 | expected); | |
2736 | } | |
2737 | ||
2738 | void MeasureFormatTest::verifyFormatWithPrefix( | |
2739 | const char *description, | |
2740 | const MeasureFormat &fmt, | |
2741 | const UnicodeString &prefix, | |
2742 | const Measure *measures, | |
2743 | int32_t measureCount, | |
2744 | const char *expected) { | |
2745 | UnicodeString result(prefix); | |
f3c0d7a5 | 2746 | FieldPosition pos(FieldPosition::DONT_CARE); |
57a6839d A |
2747 | UErrorCode status = U_ZERO_ERROR; |
2748 | fmt.formatMeasures(measures, measureCount, result, pos, status); | |
2749 | if (!assertSuccess("Error formatting", status)) { | |
2750 | return; | |
2751 | } | |
f3c0d7a5 | 2752 | assertEquals(description, ctou(expected), result); |
57a6839d A |
2753 | } |
2754 | ||
2755 | void MeasureFormatTest::verifyFormat( | |
2756 | const char *description, | |
2757 | const MeasureFormat &fmt, | |
2758 | const ExpectedResult *expectedResults, | |
2759 | int32_t count) { | |
2760 | for (int32_t i = 0; i < count; ++i) { | |
2761 | verifyFormat(description, fmt, expectedResults[i].measures, expectedResults[i].count, expectedResults[i].expected); | |
2762 | } | |
2763 | } | |
2764 | ||
2765 | extern IntlTest *createMeasureFormatTest() { | |
2766 | return new MeasureFormatTest(); | |
2767 | } | |
2768 | ||
2769 | #endif | |
2770 |