Lines Matching refs:status

104     UErrorCode* status = &st;  in TestInt64Parse()  local
116 nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, status); in TestInt64Parse()
118 if(U_FAILURE(*status)) in TestInt64Parse()
120 log_data_err("Error in unum_open() %s \n", myErrorName(*status)); in TestInt64Parse()
126 a = unum_parseInt64(nf, text, size, 0, status); in TestInt64Parse()
130 if(!U_FAILURE(*status)) in TestInt64Parse()
132 log_err("Error in unum_parseInt64(): %s \n", myErrorName(*status)); in TestInt64Parse()
171 UErrorCode status=U_ZERO_ERROR; in TestNumberFormat() local
178 status = U_ZERO_ERROR; in TestNumberFormat()
180 def=unum_open(style, NULL,0,NULL, NULL,&status); in TestNumberFormat()
183 if(U_FAILURE(status)) in TestNumberFormat()
185 …eating default NumberFormat using unum_open(): %s (Are you missing data?)\n", myErrorName(status)); in TestNumberFormat()
190 fr=unum_open(style,NULL,0, "fr_FR",NULL, &status); in TestNumberFormat()
191 if(U_FAILURE(status)) in TestNumberFormat()
192 log_err("Error: could not create NumberFormat (french): %s\n", myErrorName(status)); in TestNumberFormat()
197 cur_def=unum_open(style, NULL,0,"en_US", NULL, &status); in TestNumberFormat()
198 if(U_FAILURE(status)) in TestNumberFormat()
200 myErrorName(status) ); in TestNumberFormat()
203 cur_fr=unum_open(style,NULL,0, "fr_FR", NULL, &status); in TestNumberFormat()
204 if(U_FAILURE(status)) in TestNumberFormat()
206 myErrorName(status)); in TestNumberFormat()
210 per_def=unum_open(style,NULL,0, NULL,NULL, &status); in TestNumberFormat()
211 if(U_FAILURE(status)) in TestNumberFormat()
212 …could not create NumberFormat using unum_open(percent, NULL, &status): %s\n", myErrorName(status)); in TestNumberFormat()
215 per_fr=unum_open(style, NULL,0,"fr_FR", NULL,&status); in TestNumberFormat()
216 if(U_FAILURE(status)) in TestNumberFormat()
217 …uld not create NumberFormat using unum_open(percent, french, &status): %s\n", myErrorName(status)); in TestNumberFormat()
221 spellout_def=unum_open(style, NULL, 0, "en_US", NULL, &status); in TestNumberFormat()
222 if(U_FAILURE(status)) in TestNumberFormat()
223 …ould not create NumberFormat using unum_open(spellout, NULL, &status): %s\n", myErrorName(status)); in TestNumberFormat()
227 status = U_ZERO_ERROR; in TestNumberFormat()
228 myclone = unum_clone(def,&status); in TestNumberFormat()
229 if(U_FAILURE(status)) in TestNumberFormat()
230 log_err("Error: could not clone unum_clone(def, &status): %s\n", myErrorName(status)); in TestNumberFormat()
261 resultlengthneeded=unum_format(cur_def, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
262 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
264 status=U_ZERO_ERROR; in TestNumberFormat()
269 unum_format(cur_def, l, result, resultlength, &pos1, &status); in TestNumberFormat()
273 if(U_FAILURE(status)) in TestNumberFormat()
275 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status) ); in TestNumberFormat()
294 resultlengthneeded=unum_formatDouble(cur_def, d, NULL, resultlength, &pos2, &status); in TestNumberFormat()
295 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
297 status=U_ZERO_ERROR; in TestNumberFormat()
302 unum_formatDouble(cur_def, d, result, resultlength, &pos2, &status); in TestNumberFormat()
305 if(U_FAILURE(status)) in TestNumberFormat()
307 log_err("Error in formatting using unum_formatDouble(.....): %s\n", myErrorName(status)); in TestNumberFormat()
327 d1=unum_parseDouble(cur_def, result, u_strlen(result), &parsepos, &status); in TestNumberFormat()
331 if(U_FAILURE(status)) { in TestNumberFormat()
332 …epos=%d. The error is : %s\n", aescstrdup(result,u_strlen(result)),parsepos, myErrorName(status)); in TestNumberFormat()
343 status = U_ZERO_ERROR; in TestNumberFormat()
351 …resultlengthneeded=unum_formatDoubleCurrency(cur_def, a, temp, NULL, resultlength, &pos2, &status); in TestNumberFormat()
352 if (status==U_BUFFER_OVERFLOW_ERROR) { in TestNumberFormat()
353 status=U_ZERO_ERROR; in TestNumberFormat()
356 unum_formatDoubleCurrency(cur_def, a, temp, result, resultlength, &pos2, &status); in TestNumberFormat()
358 if (U_FAILURE(status)) { in TestNumberFormat()
359 … log_err("Error in formatting using unum_formatDoubleCurrency(.....): %s\n", myErrorName(status)); in TestNumberFormat()
380 d1=unum_parseDoubleCurrency(cur_def, result, u_strlen(result), &parsepos, temp2, &status); in TestNumberFormat()
381 if (U_FAILURE(status)) { in TestNumberFormat()
382 …ncy '%s' failed. The error is : %s\n", aescstrdup(result, u_strlen(result)), myErrorName(status)); in TestNumberFormat()
396 status = U_ZERO_ERROR; /* reset */ in TestNumberFormat()
408 d1=unum_parseDouble(cur_def, temp1, resultlength, &parsepos, &status); in TestNumberFormat()
410 if(U_FAILURE(status)) in TestNumberFormat()
412 …eDouble('%s') failed. The error is : %s\n", aescstrdup(temp1, resultlength), myErrorName(status)); in TestNumberFormat()
430 d1=unum_parseDouble(cur_def, temp1, u_strlen(temp1), &parsepos, &status); in TestNumberFormat()
431 if(U_SUCCESS(status)) in TestNumberFormat()
433 log_err("Error in unum_parseDouble(..., %s, ...): %s\n", temp1, myErrorName(status)); in TestNumberFormat()
438 status=U_ZERO_ERROR; in TestNumberFormat()
441 resultlengthneeded=unum_format(per_fr, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
442 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
444 status=U_ZERO_ERROR; in TestNumberFormat()
449 unum_format(per_fr, l, result, resultlength, &pos1, &status); in TestNumberFormat()
452 if(U_FAILURE(status)) in TestNumberFormat()
454 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status)); in TestNumberFormat()
462 l1=unum_parse(per_fr, result, u_strlen(result), &parsepos, &status); in TestNumberFormat()
464 if(U_FAILURE(status)) in TestNumberFormat()
466 log_err("parse failed. The error is : %s\n", myErrorName(status)); in TestNumberFormat()
479 pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), NULL, NULL,&status); in TestNumberFormat()
480 if(U_FAILURE(status)) in TestNumberFormat()
482 log_err("error in unum_openPattern(): %s\n", myErrorName(status) );; in TestNumberFormat()
490 resultlengthneeded=unum_toPattern(pattern, FALSE, NULL, resultlength, &status); in TestNumberFormat()
491 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
493 status=U_ZERO_ERROR; in TestNumberFormat()
496 unum_toPattern(pattern, FALSE, result, resultlength, &status); in TestNumberFormat()
498 if(U_FAILURE(status)) in TestNumberFormat()
500 log_err("error in extracting the pattern from UNumberFormat: %s\n", myErrorName(status)); in TestNumberFormat()
515 resultlengthneeded=unum_toPattern(cur_def, FALSE, NULL, resultlength, &status); in TestNumberFormat()
516 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
518 status=U_ZERO_ERROR; in TestNumberFormat()
521 unum_toPattern(cur_def, FALSE, result, resultlength, &status); in TestNumberFormat()
523 if(U_FAILURE(status)) in TestNumberFormat()
525 log_err("error in extracting the pattern from UNumberFormat: %s\n", myErrorName(status)); in TestNumberFormat()
528 status=U_ZERO_ERROR; in TestNumberFormat()
529 cur_frpattern=unum_open(UNUM_IGNORE,result, u_strlen(result), "fr_FR",NULL, &status); in TestNumberFormat()
530 if(U_FAILURE(status)) in TestNumberFormat()
532 log_err("error in unum_openPattern(): %s\n", myErrorName(status)); in TestNumberFormat()
540 status=U_ZERO_ERROR; in TestNumberFormat()
541 unum_getSymbol(cur_def, symType, temp1, sizeof(temp1), &status); in TestNumberFormat()
542 unum_setSymbol(cur_frpattern, symType, temp1, -1, &status); in TestNumberFormat()
543 if(U_FAILURE(status)) in TestNumberFormat()
545 log_err("Error in get/set symbols: %s\n", myErrorName(status)); in TestNumberFormat()
551 resultlengthneeded=unum_format(cur_def, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
552 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
554 status=U_ZERO_ERROR; in TestNumberFormat()
557 unum_format(cur_def, l, result, resultlength, &pos1, &status); in TestNumberFormat()
559 if(U_FAILURE(status)) in TestNumberFormat()
561 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status)); in TestNumberFormat()
564 if(U_FAILURE(status)){ in TestNumberFormat()
565 log_err("Fail: error in unum_setSymbols: %s\n", myErrorName(status)); in TestNumberFormat()
570 status=U_ZERO_ERROR; in TestNumberFormat()
571 unum_getSymbol(cur_def, symType, temp1, sizeof(temp1), &status); in TestNumberFormat()
572 unum_getSymbol(cur_frpattern, symType, temp2, sizeof(temp2), &status); in TestNumberFormat()
573 if(U_FAILURE(status) || u_strcmp(temp1, temp2) != 0) in TestNumberFormat()
584 resultlengthneeded=unum_format(cur_frpattern, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
585 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
587 status=U_ZERO_ERROR; in TestNumberFormat()
589 unum_format(cur_frpattern, l, temp1, resultlength, &pos1, &status); in TestNumberFormat()
591 if(U_FAILURE(status)) in TestNumberFormat()
593 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status)); in TestNumberFormat()
617 unum_setSymbol(cur_frpattern, (UNumberFormatSymbol)i, symbol, 2, &status); in TestNumberFormat()
618 if(U_FAILURE(status)) { in TestNumberFormat()
619 log_err("Error from unum_setSymbol(%d): %s\n", i, myErrorName(status)); in TestNumberFormat()
624 …th = unum_getSymbol(cur_frpattern, (UNumberFormatSymbol)i, symbol, UPRV_LENGTHOF(symbol), &status); in TestNumberFormat()
625 if(U_FAILURE(status)) { in TestNumberFormat()
626 log_err("Error from unum_getSymbol(%d): %s\n", i, myErrorName(status)); in TestNumberFormat()
634 unum_getSymbol(cur_frpattern, (UNumberFormatSymbol)i, symbol, UPRV_LENGTHOF(symbol), &status); in TestNumberFormat()
635 if(U_SUCCESS(status)){ in TestNumberFormat()
638 if(U_FAILURE(status)){ in TestNumberFormat()
639 if(status != U_ILLEGAL_ARGUMENT_ERROR){ in TestNumberFormat()
640 …og_err("Error: Expected U_ILLEGAL_ARGUMENT_ERROR for bogus symbol, Got %s\n", myErrorName(status)); in TestNumberFormat()
643 status=U_ZERO_ERROR; in TestNumberFormat()
648 unum_getTextAttribute(cur_fr, UNUM_NEGATIVE_SUFFIX, temp, resultlength, &status); in TestNumberFormat()
649 if(U_FAILURE(status)) in TestNumberFormat()
651 … log_err("Failure in gettting the Text attributes of number format: %s\n", myErrorName(status)); in TestNumberFormat()
653 unum_setTextAttribute(cur_def, UNUM_NEGATIVE_SUFFIX, temp, u_strlen(temp), &status); in TestNumberFormat()
654 if(U_FAILURE(status)) in TestNumberFormat()
656 … log_err("Failure in gettting the Text attributes of number format: %s\n", myErrorName(status)); in TestNumberFormat()
658 unum_getTextAttribute(cur_def, UNUM_NEGATIVE_SUFFIX, suffix, resultlength, &status); in TestNumberFormat()
659 if(U_FAILURE(status)) in TestNumberFormat()
661 … log_err("Failure in gettting the Text attributes of number format: %s\n", myErrorName(status)); in TestNumberFormat()
669 unum_setTextAttribute(cur_def, UNUM_NEGATIVE_SUFFIX, temp, u_strlen(temp), &status); in TestNumberFormat()
673 unum_setTextAttribute(def, UNUM_POSITIVE_PREFIX, prefix, u_strlen(prefix) , &status); in TestNumberFormat()
674 if(U_FAILURE(status)) in TestNumberFormat()
676 log_err("error in setting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
678 unum_getTextAttribute(def, UNUM_POSITIVE_PREFIX, temp, resultlength, &status); in TestNumberFormat()
679 if(U_FAILURE(status)) in TestNumberFormat()
681 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
690 unum_setTextAttribute(def, UNUM_NEGATIVE_PREFIX, prefix, u_strlen(prefix), &status); in TestNumberFormat()
691 if(U_FAILURE(status)) in TestNumberFormat()
693 log_err("error in setting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
695 unum_getTextAttribute(def, UNUM_NEGATIVE_PREFIX, temp, resultlength, &status); in TestNumberFormat()
696 if(U_FAILURE(status)) in TestNumberFormat()
698 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
706 unum_setTextAttribute(def, UNUM_NEGATIVE_SUFFIX, suffix, u_strlen(suffix) , &status); in TestNumberFormat()
707 if(U_FAILURE(status)) in TestNumberFormat()
709 log_err("error in setting the text attributes: %s\n", myErrorName(status)); in TestNumberFormat()
712 unum_getTextAttribute(def, UNUM_NEGATIVE_SUFFIX, temp, resultlength, &status); in TestNumberFormat()
713 if(U_FAILURE(status)) in TestNumberFormat()
715 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
723 unum_setTextAttribute(def, UNUM_POSITIVE_SUFFIX, suffix, u_strlen(suffix) , &status); in TestNumberFormat()
724 if(U_FAILURE(status)) in TestNumberFormat()
726 log_err("error in setting the text attributes: %s\n", myErrorName(status)); in TestNumberFormat()
729 unum_getTextAttribute(def, UNUM_POSITIVE_SUFFIX, temp, resultlength, &status); in TestNumberFormat()
730 if(U_FAILURE(status)) in TestNumberFormat()
732 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
789 status = U_ZERO_ERROR; in TestNumberFormat()
790 len = unum_format(spellout_def, value, buffer, UPRV_LENGTHOF(buffer), NULL, &status); in TestNumberFormat()
791 if(U_FAILURE(status)) { in TestNumberFormat()
792 … log_err("Error in formatting using unum_format(spellout_fmt, ...): %s\n", myErrorName(status)); in TestNumberFormat()
799 parseResult = unum_parse(spellout_def, buffer, len, &pp, &status); in TestNumberFormat()
800 if (U_FAILURE(status)) { in TestNumberFormat()
801 … log_err("Error in parsing using unum_format(spellout_fmt, ...): %s\n", myErrorName(status)); in TestNumberFormat()
818 status=U_ZERO_ERROR; in TestNumberFormat()
819 dec_en = unum_open(UNUM_DECIMAL, NULL, 0, "en_US", NULL, &status); in TestNumberFormat()
821 unum_setSymbol(dec_en, UNUM_GROUPING_SEPARATOR_SYMBOL, groupingSep, 0, &status); in TestNumberFormat()
822 parseResult = unum_parseDouble(dec_en, numPercent, -1, NULL, &status); in TestNumberFormat()
824 if ( U_FAILURE(status) || parseResult != 12.0 ) { in TestNumberFormat()
826 myErrorName(status), parseResult); in TestNumberFormat()
849 status = U_ZERO_ERROR; in TestNumberFormat()
851 fmt = unum_open(UNUM_PATTERN_DECIMAL, dest, -1, "en", NULL /*parseError*/, &status); in TestNumberFormat()
852 …if (U_FAILURE(status)) log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName( in TestNumberFormat()
854 resultSize = unum_formatDecimal(fmt, numInitial, -1, dest, DESTCAPACITY, NULL, &status); in TestNumberFormat()
855 if (U_FAILURE(status)) { in TestNumberFormat()
856 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
871 … resultSize = unum_formatDecimal(fmt, numInitial, -1, dest, DESTCAPACITY, &fieldPos, &status); in TestNumberFormat()
872 if (U_FAILURE(status)) { in TestNumberFormat()
873 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
891 status = U_ZERO_ERROR; in TestNumberFormat()
893 resultSize = unum_parseDecimal(fmt, dest, -1, NULL, desta, DESTCAPACITY, &status); in TestNumberFormat()
894 if (U_FAILURE(status)) { in TestNumberFormat()
895 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
908 status = U_ZERO_ERROR; in TestNumberFormat()
912 resultSize = unum_parseDecimal(fmt, dest, -1, &parsePos, desta, DESTCAPACITY, &status); in TestNumberFormat()
913 if (U_FAILURE(status)) { in TestNumberFormat()
914 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
928 status = U_ZERO_ERROR; in TestNumberFormat()
935 UNumberFormat *fmt = unum_open(UNUM_DEFAULT, NULL, 0, NULL, NULL, &status); in TestNumberFormat()
936 if (U_FAILURE(status)) { in TestNumberFormat()
937 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
939 unum_getSymbol(fmt, (UNumberFormatSymbol)badsymbolLarge, NULL, 0, &status); in TestNumberFormat()
940 …if (U_SUCCESS(status)) log_err("unum_getSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
942 status = U_ZERO_ERROR; in TestNumberFormat()
943 unum_getSymbol(fmt, (UNumberFormatSymbol)badsymbolSmall, NULL, 0, &status); in TestNumberFormat()
944 …if (U_SUCCESS(status)) log_err("unum_getSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
946 status = U_ZERO_ERROR; in TestNumberFormat()
947 unum_setSymbol(fmt, (UNumberFormatSymbol)badsymbolLarge, value, valueLength, &status); in TestNumberFormat()
948 …if (U_SUCCESS(status)) log_err("unum_setSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
950 status = U_ZERO_ERROR; in TestNumberFormat()
951 unum_setSymbol(fmt, (UNumberFormatSymbol)badsymbolSmall, value, valueLength, &status); in TestNumberFormat()
952 …if (U_SUCCESS(status)) log_err("unum_setSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
1055 UErrorCode status; in TestParseCurrency() local
1061 status = U_ZERO_ERROR; in TestParseCurrency()
1062 unum = unum_open(UNUM_CURRENCY, NULL, 0, itemPtr->locale, NULL, &status); in TestParseCurrency()
1063 if (U_SUCCESS(status)) { in TestParseCurrency()
1064 status = U_ZERO_ERROR; in TestParseCurrency()
1066 parseVal = unum_parseDouble(unum, itemPtr->currStr, -1, &parsePos, &status); in TestParseCurrency()
1067 …if (status != itemPtr->parsDoubExpectErr || parsePos != itemPtr->parsDoubExpectPos || parseVal != … in TestParseCurrency()
1071 u_errorName(status), parsePos, parseVal ); in TestParseCurrency()
1073 status = U_ZERO_ERROR; in TestParseCurrency()
1076 … parseVal = unum_parseDoubleCurrency(unum, itemPtr->currStr, -1, &parsePos, parseCurr, &status); in TestParseCurrency()
1078 …if (status != itemPtr->parsCurrExpectErr || parsePos != itemPtr->parsCurrExpectPos || parseVal != … in TestParseCurrency()
1083 u_errorName(status), parsePos, parseVal, parseCurrB ); in TestParseCurrency()
1087 …ted error in unum_open UNUM_CURRENCY for locale %s: '%s'\n", itemPtr->locale, u_errorName(status)); in TestParseCurrency()
1091 status = U_ZERO_ERROR; in TestParseCurrency()
1092 unum = unum_open(UNUM_CURRENCY_PLURAL, NULL, 0, itemPtr->locale, NULL, &status); in TestParseCurrency()
1093 if (U_SUCCESS(status)) { in TestParseCurrency()
1094 status = U_ZERO_ERROR; in TestParseCurrency()
1096 parseVal = unum_parseDouble(unum, itemPtr->plurStr, -1, &parsePos, &status); in TestParseCurrency()
1097 … if (status != itemPtr->parsDoubExpectErr || parseVal != itemPtr->parsDoubExpectVal) { in TestParseCurrency()
1101 u_errorName(status), parseVal ); in TestParseCurrency()
1103 status = U_ZERO_ERROR; in TestParseCurrency()
1106 … parseVal = unum_parseDoubleCurrency(unum, itemPtr->plurStr, -1, &parsePos, parseCurr, &status); in TestParseCurrency()
1108 … if (status != itemPtr->parsCurrExpectErr || parseVal != itemPtr->parsCurrExpectVal || in TestParseCurrency()
1113 u_errorName(status), parseVal, parseCurrB ); in TestParseCurrency()
1117 …or in unum_open UNUM_CURRENCY_PLURAL for locale %s: '%s'\n", itemPtr->locale, u_errorName(status)); in TestParseCurrency()
1130 UErrorCode status; member
1164 UErrorCode status = U_ZERO_ERROR; in TestSpelloutNumberParse() local
1166 UNumberFormat *nf = unum_open(UNUM_SPELLOUT, NULL, 0, testPtr->locale, NULL, &status); in TestSpelloutNumberParse()
1167 if (U_FAILURE(status)) { in TestSpelloutNumberParse()
1168 …log_err_status(status, "unum_open fails for UNUM_SPELLOUT with locale %s, status %s\n", testPtr->l… in TestSpelloutNumberParse()
1171 status = U_ZERO_ERROR; in TestSpelloutNumberParse()
1172 value = unum_parse(nf, testPtr->source, -1, &position, &status); in TestSpelloutNumberParse()
1173 if ( value != testPtr->value || position != testPtr->endPos || status != testPtr->status ) { in TestSpelloutNumberParse()
1176 testPtr->value, testPtr->endPos, myErrorName(testPtr->status), in TestSpelloutNumberParse()
1177 value, position, myErrorName(status) ); in TestSpelloutNumberParse()
1188 UErrorCode status = U_ZERO_ERROR; in TestSignificantDigits() local
1194 fmt=unum_open(UNUM_IGNORE, temp, -1, NULL, NULL,&status); in TestSignificantDigits()
1195 if (U_FAILURE(status)) { in TestSignificantDigits()
1196 log_data_err("got unexpected error for unum_open: '%s'\n", u_errorName(status)); in TestSignificantDigits()
1204 resultlengthneeded=unum_formatDouble(fmt, d, NULL, resultlength, NULL, &status); in TestSignificantDigits()
1205 if(status==U_BUFFER_OVERFLOW_ERROR) in TestSignificantDigits()
1207 status=U_ZERO_ERROR; in TestSignificantDigits()
1210 unum_formatDouble(fmt, d, result, resultlength, NULL, &status); in TestSignificantDigits()
1212 if(U_FAILURE(status)) in TestSignificantDigits()
1214 log_err("Error in formatting using unum_formatDouble(.....): %s\n", myErrorName(status)); in TestSignificantDigits()
1227 UErrorCode status = U_ZERO_ERROR; in TestSigDigRounding() local
1235 fmt=unum_open(UNUM_DECIMAL, NULL, 0, NULL /* "en_US"*/, NULL, &status); in TestSigDigRounding()
1236 if (U_FAILURE(status)) { in TestSigDigRounding()
1237 log_data_err("got unexpected error for unum_open: '%s'\n", u_errorName(status)); in TestSigDigRounding()
1248 (void)unum_formatDouble(fmt, d, result, UPRV_LENGTHOF(result), NULL, &status); in TestSigDigRounding()
1249 if(U_FAILURE(status)) in TestSigDigRounding()
1251 log_err("Error in formatting using unum_formatDouble(.....): %s\n", myErrorName(status)); in TestSigDigRounding()
1267 UErrorCode status=U_ZERO_ERROR; in TestNumberFormatPadding() local
1279 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1280 pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), NULL, NULL,&status); in TestNumberFormatPadding()
1281 if(U_SUCCESS(status)) in TestNumberFormatPadding()
1283 log_err("error in unum_openPattern(%s): %s\n", temp1, myErrorName(status) ); in TestNumberFormatPadding()
1292 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1293 pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), "en_US",NULL, &status); in TestNumberFormatPadding()
1294 if(U_FAILURE(status)) in TestNumberFormatPadding()
1296 …log_err_status(status, "error in padding unum_openPattern(%s): %s\n", temp1, myErrorName(status) )… in TestNumberFormatPadding()
1304 resultlengthneeded=unum_toPattern(pattern, FALSE, NULL, resultlength, &status); in TestNumberFormatPadding()
1305 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormatPadding()
1307 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1310 unum_toPattern(pattern, FALSE, result, resultlength, &status); in TestNumberFormatPadding()
1312 if(U_FAILURE(status)) in TestNumberFormatPadding()
1314 … log_err("error in extracting the padding pattern from UNumberFormat: %s\n", myErrorName(status)); in TestNumberFormatPadding()
1328 resultlengthneeded=unum_formatDouble(pattern, d, NULL, resultlength, &pos1, &status); in TestNumberFormatPadding()
1329 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormatPadding()
1331 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1334 unum_formatDouble(pattern, d, result, resultlength, NULL, &status); in TestNumberFormatPadding()
1336 if(U_FAILURE(status)) in TestNumberFormatPadding()
1338 …err("Error in formatting using unum_formatDouble(.....) with padding : %s\n", myErrorName(status)); in TestNumberFormatPadding()
1356 d1=unum_parseDouble(pattern, result, u_strlen(result), &parsepos, &status); in TestNumberFormatPadding()
1357 if(U_FAILURE(status)) in TestNumberFormatPadding()
1359 log_err("padding parse failed. The error is : %s\n", myErrorName(status)); in TestNumberFormatPadding()
1382 UErrorCode status = U_ZERO_ERROR; in TestInt64Format() local
1394 fmt = unum_open(UNUM_IGNORE, temp1, u_strlen(temp1), "en_US", NULL, &status); in TestInt64Format()
1395 if(U_FAILURE(status)) { in TestInt64Format()
1396 log_data_err("error in unum_openPattern() - %s\n", myErrorName(status)); in TestInt64Format()
1399 unum_formatInt64(fmt, U_INT64_MAX, result, 512, NULL, &status); in TestInt64Format()
1400 if (U_FAILURE(status)) { in TestInt64Format()
1401 log_err("error in unum_format(): %s\n", myErrorName(status)); in TestInt64Format()
1405 val32 = unum_parse(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1406 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1407 log_err("parse didn't report error: %s\n", myErrorName(status)); in TestInt64Format()
1412 status = U_ZERO_ERROR; in TestInt64Format()
1414 val64 = unum_parseInt64(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1415 if (U_FAILURE(status)) { in TestInt64Format()
1416 log_err("parseInt64 returned error: %s\n", myErrorName(status)); in TestInt64Format()
1421 status = U_ZERO_ERROR; in TestInt64Format()
1423 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1424 if (U_FAILURE(status)) { in TestInt64Format()
1425 log_err("parseDouble returned error: %s\n", myErrorName(status)); in TestInt64Format()
1431 unum_formatInt64(fmt, U_INT64_MIN, result, 512, NULL, &status); in TestInt64Format()
1432 if (U_FAILURE(status)) { in TestInt64Format()
1433 log_err("error in unum_format(): %s\n", myErrorName(status)); in TestInt64Format()
1437 val32 = unum_parse(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1438 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1439 log_err("parse didn't report error: %s\n", myErrorName(status)); in TestInt64Format()
1444 status = U_ZERO_ERROR; in TestInt64Format()
1446 val64 = unum_parseInt64(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1447 if (U_FAILURE(status)) { in TestInt64Format()
1448 log_err("parseInt64 returned error: %s\n", myErrorName(status)); in TestInt64Format()
1453 status = U_ZERO_ERROR; in TestInt64Format()
1455 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1456 if (U_FAILURE(status)) { in TestInt64Format()
1457 log_err("parseDouble returned error: %s\n", myErrorName(status)); in TestInt64Format()
1463 unum_formatDouble(fmt, doubleBig, result, 512, NULL, &status); in TestInt64Format()
1464 if (U_FAILURE(status)) { in TestInt64Format()
1465 log_err("error in unum_format(): %s\n", myErrorName(status)); in TestInt64Format()
1469 val32 = unum_parse(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1470 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1471 log_err("parse didn't report error: %s\n", myErrorName(status)); in TestInt64Format()
1476 status = U_ZERO_ERROR; in TestInt64Format()
1478 val64 = unum_parseInt64(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1479 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1480 log_err("parseInt64 didn't report error error: %s\n", myErrorName(status)); in TestInt64Format()
1485 status = U_ZERO_ERROR; in TestInt64Format()
1487 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1488 if (U_FAILURE(status)) { in TestInt64Format()
1489 log_err("parseDouble returned error: %s\n", myErrorName(status)); in TestInt64Format()
1497 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1498 if (U_FAILURE(status)) { in TestInt64Format()
1499 log_err("parseDouble() returned error: %s\n", myErrorName(status)); in TestInt64Format()
1518 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1519 unum_formatDouble(fmt, vals[i], buffer, BUFSIZE, NULL, &status); in test_fmt()
1520 if (U_FAILURE(status)) { in test_fmt()
1521 log_err("failed to format: %g, returned %s\n", vals[i], u_errorName(status)); in test_fmt()
1530 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1533 unum_applyPattern(fmt, FALSE, buffer, -1, &perr, &status); in test_fmt()
1534 if (isDecimal ? U_FAILURE(status) : (status != U_UNSUPPORTED_ERROR)) { in test_fmt()
1535 log_err("got unexpected error for applyPattern: '%s'\n", u_errorName(status)); in test_fmt()
1571 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1572 int len = unum_getTextAttribute(fmt, UNUM_DEFAULT_RULESET, buffer, BUFSIZE, &status); in test_fmt()
1573 if (isDecimal ? (status != U_UNSUPPORTED_ERROR) : U_FAILURE(status)) { in test_fmt()
1574 log_err("got unexpected error for get default ruleset: '%s'\n", u_errorName(status)); in test_fmt()
1576 if (U_SUCCESS(status)) { in test_fmt()
1581 status = U_ZERO_ERROR; in test_fmt()
1582 len = unum_getTextAttribute(fmt, UNUM_PUBLIC_RULESETS, buffer, BUFSIZE, &status); in test_fmt()
1583 if (isDecimal ? (status != U_UNSUPPORTED_ERROR) : U_FAILURE(status)) { in test_fmt()
1584 log_err("got unexpected error for get public rulesets: '%s'\n", u_errorName(status)); in test_fmt()
1586 if (U_SUCCESS(status)) { in test_fmt()
1596 unum_setTextAttribute(fmt, UNUM_DEFAULT_RULESET, buffer, -1, &status); in test_fmt()
1597 if (U_FAILURE(status)) { in test_fmt()
1598 … log_err("unexpected error setting default ruleset: '%s'\n", u_errorName(status)); in test_fmt()
1600 … int len2 = unum_getTextAttribute(fmt, UNUM_DEFAULT_RULESET, buffer, BUFSIZE, &status); in test_fmt()
1601 if (U_FAILURE(status)) { in test_fmt()
1602 log_err("could not fetch default ruleset: '%s'\n", u_errorName(status)); in test_fmt()
1608 status = U_ZERO_ERROR; in test_fmt()
1609 unum_formatDouble(fmt, vals[i], buffer, BUFSIZE, NULL, &status); in test_fmt()
1610 if (U_FAILURE(status)) { in test_fmt()
1611 … log_err("failed to format: %g, returned %s\n", vals[i], u_errorName(status)); in test_fmt()
1625 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1626 unum_toPattern(fmt, FALSE, buffer, BUFSIZE, &status); in test_fmt()
1627 if (U_SUCCESS(status)) { in test_fmt()
1630 } else if (status != U_BUFFER_OVERFLOW_ERROR) { in test_fmt()
1631 log_err("toPattern failed unexpectedly: %s\n", u_errorName(status)); in test_fmt()
1638 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1639 int len = unum_getSymbol(fmt, UNUM_CURRENCY_SYMBOL, buffer, BUFSIZE, &status); in test_fmt()
1640 if (isDecimal ? U_FAILURE(status) : (status != U_UNSUPPORTED_ERROR)) { in test_fmt()
1641 log_err("unexpected error getting symbol: '%s'\n", u_errorName(status)); in test_fmt()
1644 unum_setSymbol(fmt, UNUM_CURRENCY_SYMBOL, buffer, len, &status); in test_fmt()
1645 if (isDecimal ? U_FAILURE(status) : (status != U_UNSUPPORTED_ERROR)) { in test_fmt()
1646 log_err("unexpected error setting symbol: '%s'\n", u_errorName(status)); in test_fmt()
1653 UErrorCode status = U_ZERO_ERROR; in TestNonExistentCurrency() local
1658 format = unum_open(UNUM_CURRENCY, NULL, 0, "th_TH@currency=QQQ", NULL, &status); in TestNonExistentCurrency()
1659 if (format == NULL || U_FAILURE(status)) { in TestNonExistentCurrency()
1660 … result for non-existent requested currency: '%s' (Are you missing data?)\n", u_errorName(status)); in TestNonExistentCurrency()
1667 &status); in TestNonExistentCurrency()
1676 UErrorCode status; in TestRBNFFormat() local
1689 status = U_ZERO_ERROR; in TestRBNFFormat()
1691 formats[0] = unum_open(UNUM_PATTERN_DECIMAL, pat, -1, "en_US", &perr, &status); in TestRBNFFormat()
1692 if (U_FAILURE(status)) { in TestRBNFFormat()
1693 log_err_status(status, "unable to open decimal pattern -> %s\n", u_errorName(status)); in TestRBNFFormat()
1697 status = U_ZERO_ERROR; in TestRBNFFormat()
1698 formats[1] = unum_open(UNUM_SPELLOUT, NULL, 0, "en_US", &perr, &status); in TestRBNFFormat()
1699 if (U_FAILURE(status)) { in TestRBNFFormat()
1700 log_err_status(status, "unable to open spellout -> %s\n", u_errorName(status)); in TestRBNFFormat()
1704 status = U_ZERO_ERROR; in TestRBNFFormat()
1705 formats[2] = unum_open(UNUM_ORDINAL, NULL, 0, "en_US", &perr, &status); in TestRBNFFormat()
1706 if (U_FAILURE(status)) { in TestRBNFFormat()
1707 log_err_status(status, "unable to open ordinal -> %s\n", u_errorName(status)); in TestRBNFFormat()
1711 status = U_ZERO_ERROR; in TestRBNFFormat()
1712 formats[3] = unum_open(UNUM_DURATION, NULL, 0, "en_US", &perr, &status); in TestRBNFFormat()
1713 if (U_FAILURE(status)) { in TestRBNFFormat()
1714 log_err_status(status, "unable to open duration %s\n", u_errorName(status)); in TestRBNFFormat()
1718 status = U_ZERO_ERROR; in TestRBNFFormat()
1756 formats[4] = unum_open(UNUM_PATTERN_RULEBASED, pat, -1, "en_US", &perr, &status); in TestRBNFFormat()
1757 if (U_FAILURE(status)) { in TestRBNFFormat()
1758 log_err_status(status, "unable to open rulebased pattern -> %s\n", u_errorName(status)); in TestRBNFFormat()
1760 if (U_FAILURE(status)) { in TestRBNFFormat()
1761 log_err_status(status, "Something failed with %s\n", u_errorName(status)); in TestRBNFFormat()
1775 status = U_ZERO_ERROR; in TestRBNFFormat()
1776 len = unum_formatDouble(formats[1], nanvalue, fmtbuf, FORMAT_BUF_CAPACITY, NULL, &status); in TestRBNFFormat()
1777 if (U_FAILURE(status)) { in TestRBNFFormat()
1778 log_err_status(status, "unum_formatDouble NAN failed with %s\n", u_errorName(status)); in TestRBNFFormat()
1815 UErrorCode status = U_ZERO_ERROR; in TestCurrencyRegression() local
1820 cur = unum_open(UNUM_CURRENCY, NULL,0,"en_US", NULL, &status); in TestCurrencyRegression()
1822 if(U_FAILURE(status)) { in TestCurrencyRegression()
1823 log_data_err("unum_open failed: %s (Are you missing data?)\n", u_errorName(status)); in TestCurrencyRegression()
1827 status = U_ZERO_ERROR; /* so we can test it later. */ in TestCurrencyRegression()
1835 &status); in TestCurrencyRegression()
1839 if(U_FAILURE(status) || (pos != expected)) { in TestCurrencyRegression()
1841 expected, d, u_errorName(status), pos, acurrency); in TestCurrencyRegression()
1843 …rency failed, value %.9f err %s, pos %d, currency [%s]\n", d, u_errorName(status), pos, acurrency); in TestCurrencyRegression()
1854 UErrorCode status = U_ZERO_ERROR; in TestTextAttributeCrash() local
1855 UNumberFormat *nf = unum_open(UNUM_CURRENCY, NULL, 0, "en_US", NULL, &status); in TestTextAttributeCrash()
1856 if (U_FAILURE(status)) { in TestTextAttributeCrash()
1857 log_data_err("FAILED 1 -> %s (Are you missing data?)\n", u_errorName(status)); in TestTextAttributeCrash()
1860 unum_setTextAttribute(nf, UNUM_CURRENCY_CODE, ubuffer, 3, &status); in TestTextAttributeCrash()
1865 used = unum_getTextAttribute(nf, UNUM_NEGATIVE_PREFIX, ubuffer, 64, &status); in TestTextAttributeCrash()
1866 unum_setTextAttribute(nf, UNUM_NEGATIVE_PREFIX, ubuffer, used, &status); in TestTextAttributeCrash()
1867 if (U_FAILURE(status)) { in TestTextAttributeCrash()
1871 used = unum_formatDouble(nf, -1234.5, ubuffer, 64, NULL, &status); in TestTextAttributeCrash()
1872 if (U_FAILURE(status) || 64 < used) { in TestTextAttributeCrash()
1873 log_err("Failed formatting %s\n", u_errorName(status)); in TestTextAttributeCrash()
1879 used = unum_formatDouble(nf, 1234.5, ubuffer, 64, NULL, &status); in TestTextAttributeCrash()
1880 if (U_FAILURE(status) || 64 < used) { in TestTextAttributeCrash()
1881 log_err("Failed formatting %s\n", u_errorName(status)); in TestTextAttributeCrash()
1891 UErrorCode status = U_ZERO_ERROR; in TestNBSPPatternRtNum() local
1895 unum_formatDouble(nf, myNumber, myString, 20, NULL, &status); in TestNBSPPatternRtNum()
1897 if(U_FAILURE(status)) { in TestNBSPPatternRtNum()
1898 … log_err("%s:%d: failed format of %.2g with %s\n", testcase, line, myNumber, u_errorName(status)); in TestNBSPPatternRtNum()
1901 aNumber = unum_parse(nf, myString, -1, NULL, &status); in TestNBSPPatternRtNum()
1902 if(U_FAILURE(status)) { in TestNBSPPatternRtNum()
1903 log_err("%s:%d: failed parse with %s\n", testcase, line, u_errorName(status)); in TestNBSPPatternRtNum()
1919 UErrorCode status = U_ZERO_ERROR; in TestNBSPInPattern() local
1925 nf = unum_open(UNUM_CURRENCY, NULL, -1, "ar_AE", NULL, &status); in TestNBSPInPattern()
1926 if(U_FAILURE(status) || nf == NULL) { in TestNBSPInPattern()
1927 …open failed with %s (Are you missing data?)\n", __FILE__, __LINE__, testcase, u_errorName(status)); in TestNBSPInPattern()
1938 unum_applyPattern(nf, FALSE, pat, -1, NULL, &status); in TestNBSPInPattern()
1939 if(U_FAILURE(status)) { in TestNBSPInPattern()
1940 log_err("%s: unum_applyPattern failed with %s\n", testcase, u_errorName(status)); in TestNBSPInPattern()
1946 unum_close(nf); status = U_ZERO_ERROR; in TestNBSPInPattern()
1949 nf = unum_open(UNUM_DECIMAL, NULL, -1, "ar_AE", NULL, &status); in TestNBSPInPattern()
1950 if(U_FAILURE(status)) { in TestNBSPInPattern()
1951 log_err("%s: unum_open failed with %s\n", testcase, u_errorName(status)); in TestNBSPInPattern()
1954 unum_close(nf); status = U_ZERO_ERROR; in TestNBSPInPattern()
1957 nf = unum_open(UNUM_PERCENT, NULL, -1, "ar_AE", NULL, &status); in TestNBSPInPattern()
1958 if(U_FAILURE(status)) { in TestNBSPInPattern()
1959 log_err("%s: unum_open failed with %s\n", testcase, u_errorName(status)); in TestNBSPInPattern()
1962 unum_close(nf); status = U_ZERO_ERROR; in TestNBSPInPattern()
1970 UErrorCode status = U_ZERO_ERROR; in TestCloneWithRBNF() local
2017 pform = unum_open(UNUM_PATTERN_RULEBASED, pattern, -1, "en_US", NULL, &status); in TestCloneWithRBNF()
2018 unum_formatDouble(pform, 3600, buffer, 256, NULL, &status); in TestCloneWithRBNF()
2020 pform_cloned = unum_clone(pform,&status); in TestCloneWithRBNF()
2021 unum_formatDouble(pform_cloned, 3600, buffer_cloned, 256, NULL, &status); in TestCloneWithRBNF()
2033 UErrorCode status = U_ZERO_ERROR; in TestNoExponent() local
2041 fmt = unum_open(UNUM_DECIMAL, NULL, -1, "en_US", NULL, &status); in TestNoExponent()
2043 if(U_FAILURE(status) || fmt == NULL) { in TestNoExponent()
2044 …:%d: unum_open failed with %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status)); in TestNoExponent()
2052 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2054 if(U_FAILURE(status)) { in TestNoExponent()
2055 …e failed with %s for %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status), cstr); in TestNoExponent()
2071 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2079 status = U_ZERO_ERROR; in TestNoExponent()
2084 fmt = unum_open(UNUM_SCIENTIFIC, NULL, -1, "en_US", NULL, &status); in TestNoExponent()
2085 assertSuccess("unum_open(UNUM_SCIENTIFIC, ...)", &status); in TestNoExponent()
2093 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2095 if(U_FAILURE(status)) { in TestNoExponent()
2096 …e failed with %s for %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status), cstr); in TestNoExponent()
2113 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2115 if(U_FAILURE(status)) { in TestNoExponent()
2116 …e failed with %s for %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status), cstr); in TestNoExponent()
2127 UErrorCode status = U_ZERO_ERROR; in TestMaxInt() local
2138 &status); in TestMaxInt()
2139 if(U_FAILURE(status) || fmt == NULL) { in TestMaxInt()
2140 … failed with %s (Are you missing data?)\n", __FILE__, __LINE__, "TestMaxInt", u_errorName(status)); in TestMaxInt()
2146 status = U_ZERO_ERROR; in TestMaxInt()
2148 len1 = unum_formatInt64(fmt, 1997, result1, 1024, NULL, &status); in TestMaxInt()
2150 if(U_FAILURE(status) || u_strcmp(expect, result1)) { in TestMaxInt()
2151 …t64 Expected %s but got %s status %s\n", austrdup(expect), austrdup(result1), u_errorName(status)); in TestMaxInt()
2154 status = U_ZERO_ERROR; in TestMaxInt()
2156 len2 = unum_formatDouble(fmt, 1997.0, result2, 1024, NULL, &status); in TestMaxInt()
2158 if(U_FAILURE(status) || u_strcmp(expect, result2)) { in TestMaxInt()
2159 …ble Expected %s but got %s status %s\n", austrdup(expect), austrdup(result2), u_errorName(status)); in TestMaxInt()
2171 status = U_ZERO_ERROR; in TestMaxInt()
2173 len1 = unum_formatInt64(fmt, 1997, result1, 1024, NULL, &status); in TestMaxInt()
2174 ASSERT_TRUE(status==U_ILLEGAL_ARGUMENT_ERROR); in TestMaxInt()
2175 status = U_ZERO_ERROR; in TestMaxInt()
2180 len1 = unum_formatInt64(fmt, 97, result1, 1024, NULL, &status); in TestMaxInt()
2182 if(U_FAILURE(status) || u_strcmp(expect, result1)) { in TestMaxInt()
2183 …t64 Expected %s but got %s status %s\n", austrdup(expect), austrdup(result1), u_errorName(status)); in TestMaxInt()
2186 status = U_ZERO_ERROR; in TestMaxInt()
2188 len2 = unum_formatDouble(fmt, 97.0, result2, 1024, NULL, &status); in TestMaxInt()
2190 if(U_FAILURE(status) || u_strcmp(expect, result2)) { in TestMaxInt()
2191 …ble Expected %s but got %s status %s\n", austrdup(expect), austrdup(result2), u_errorName(status)); in TestMaxInt()
2202 UErrorCode status = U_ZERO_ERROR; in TestUFormattable() local
2203 UNumberFormat *unum = unum_open(UNUM_DEFAULT, NULL, -1, "en_US_POSIX", NULL, &status); in TestUFormattable()
2204 if(assertSuccessCheck("calling unum_open()", &status, TRUE)) { in TestUFormattable()
2208 UFormattable *ufmt = ufmt_open(&status); in TestUFormattable()
2209 unum_parseToUFormattable(unum, ufmt, str, -1, NULL, &status); in TestUFormattable()
2211 result = ufmt_getLong(ufmt, &status); /* == 123 */ in TestUFormattable()
2222 UErrorCode status = U_ZERO_ERROR; in TestUFormattable() local
2227 ufmt = ufmt_open(&status); in TestUFormattable()
2228 unum = unum_open(UNUM_DEFAULT, NULL, -1, "en_US_POSIX", NULL, &status); in TestUFormattable()
2229 if(assertSuccessCheck("calling ufmt_open() || unum_open()", &status, TRUE)) { in TestUFormattable()
2234 unum_parseToUFormattable(unum, ufmt, buffer, -1, NULL, &status); in TestUFormattable()
2235 if(assertSuccess("unum_parseToUFormattable(31337)", &status)) { in TestUFormattable()
2236 assertTrue("ufmt_getLong()=31337", ufmt_getLong(ufmt, &status) == 31337); in TestUFormattable()
2237 assertTrue("ufmt_getType()=UFMT_LONG", ufmt_getType(ufmt, &status) == UFMT_LONG); in TestUFormattable()
2238 log_verbose("long = %d\n", ufmt_getLong(ufmt, &status)); in TestUFormattable()
2239 assertSuccess("ufmt_getLong()", &status); in TestUFormattable()
2241 unum_formatUFormattable(unum, ufmt, out2k, 2048, NULL, &status); in TestUFormattable()
2242 if(assertSuccess("unum_formatUFormattable(31337)", &status)) { in TestUFormattable()
2249 unum_parseToUFormattable(unum, ufmt, buffer, -1, NULL, &status); in TestUFormattable()
2250 if(assertSuccess("unum_parseToUFormattable(3.14159)", &status)) { in TestUFormattable()
2251 … assertTrue("ufmt_getDouble()==3.14159", withinErr(ufmt_getDouble(ufmt, &status), 3.14159, 1e-15)); in TestUFormattable()
2252 assertSuccess("ufmt_getDouble()", &status); in TestUFormattable()
2253 assertTrue("ufmt_getType()=UFMT_DOUBLE", ufmt_getType(ufmt, &status) == UFMT_DOUBLE); in TestUFormattable()
2254 log_verbose("double = %g\n", ufmt_getDouble(ufmt, &status)); in TestUFormattable()
2256 unum_formatUFormattable(unum, ufmt, out2k, 2048, NULL, &status); in TestUFormattable()
2257 if(assertSuccess("unum_formatUFormattable(3.14159)", &status)) { in TestUFormattable()
2268 UErrorCode status = U_ZERO_ERROR; in TestUFormattable() local
2276 unum = unum_open(UNUM_DEFAULT, NULL, -1, "en_US_POSIX", NULL, &status); in TestUFormattable()
2277 if(assertSuccessCheck("calling unum_open()", &status, TRUE)) { in TestUFormattable()
2280 buffer, -1, NULL, &status); in TestUFormattable()
2281 if(assertSuccess("unum_parseToUFormattable(weight of the moon)", &status)) { in TestUFormattable()
2284 unum_formatUFormattable(unum, ufmt, out2k, 2048, NULL, &status); in TestUFormattable()
2285 if(assertSuccess("unum_formatUFormattable(3.14159)", &status)) { in TestUFormattable()
2289 log_verbose("double: %g\n", ufmt_getDouble(ufmt, &status)); in TestUFormattable()
2290 assertSuccess("ufmt_getDouble()", &status); in TestUFormattable()
2292 log_verbose("long: %ld\n", ufmt_getLong(ufmt, &status)); in TestUFormattable()
2293 assertTrue("failure on ufmt_getLong() for huge number:", U_FAILURE(status)); in TestUFormattable()
2340 UErrorCode status; in TestUNumberingSystem() local
2343 status = U_ZERO_ERROR; in TestUNumberingSystem()
2344 unumsys = unumsys_open(itemPtr->locale, &status); in TestUNumberingSystem()
2345 if ( U_SUCCESS(status) ) { in TestUNumberingSystem()
2354 ulen = unumsys_getDescription(unumsys, ubuf, kNumSysDescripBufMax, &status); in TestUNumberingSystem()
2356 if ( U_FAILURE(status) || u_strcmp(ubuf, itemPtr->description) != 0 ) { in TestUNumberingSystem()
2357 …unumsys description for locale %s, description unexpected and/or status %\n", myErrorName(status)); in TestUNumberingSystem()
2361 …ata_err("unumsys_open for locale %s fails with status %s\n", itemPtr->locale, myErrorName(status)); in TestUNumberingSystem()
2365 status = U_ZERO_ERROR; in TestUNumberingSystem()
2366 uenum = unumsys_openAvailableNames(&status); in TestUNumberingSystem()
2367 if ( U_SUCCESS(status) ) { in TestUNumberingSystem()
2372 while ( (numsys = uenum_next(uenum, NULL, &status)) != NULL && U_SUCCESS(status) ) { in TestUNumberingSystem()
2373 status = U_ZERO_ERROR; in TestUNumberingSystem()
2374 unumsys = unumsys_openByName(numsys, &status); in TestUNumberingSystem()
2375 if ( U_SUCCESS(status) ) { in TestUNumberingSystem()
2382 numsys, myErrorName(status)); in TestUNumberingSystem()
2391 log_data_err("unumsys_openAvailableNames fails with status %s\n", myErrorName(status)); in TestUNumberingSystem()
2453 UErrorCode status = U_ZERO_ERROR; in TestCurrencyIsoPluralFormat() local
2459 UNumberFormat* unumFmt = unum_open(style, NULL, 0, localeString, NULL, &status); in TestCurrencyIsoPluralFormat()
2460 if (U_FAILURE(status)) { in TestCurrencyIsoPluralFormat()
2461 …_err("FAIL: unum_open, locale %s, style %d - %s\n", localeString, (int)style, myErrorName(status)); in TestCurrencyIsoPluralFormat()
2465 unum_setTextAttribute(unumFmt, UNUM_CURRENCY_CODE, currencyCode, 3, &status); in TestCurrencyIsoPluralFormat()
2466 if (U_FAILURE(status)) { in TestCurrencyIsoPluralFormat()
2469 ulenRes = unum_formatDouble(unumFmt, numberToBeFormat, ubufResult, kUBufMax, NULL, &status); in TestCurrencyIsoPluralFormat()
2470 if (U_FAILURE(status)) { in TestCurrencyIsoPluralFormat()
2471 …ble, locale %s, UNUM_CURRENCY_CODE %s - %s\n", localeString, currencyISOCode, myErrorName(status)); in TestCurrencyIsoPluralFormat()
2505 UErrorCode status = U_ZERO_ERROR; in TestContext() local
2508 UNumberFormat *unum = unum_open(UNUM_SPELLOUT, NULL, 0, "en", NULL, &status); in TestContext()
2509 if ( U_SUCCESS(status) ) { in TestContext()
2510 UDisplayContext context = unum_getContext(unum, UDISPCTX_TYPE_CAPITALIZATION, &status); in TestContext()
2511 if ( U_FAILURE(status) || context != UDISPCTX_CAPITALIZATION_NONE) { in TestContext()
2513 status = U_ZERO_ERROR; in TestContext()
2515 unum_setContext(unum, UDISPCTX_CAPITALIZATION_FOR_STANDALONE, &status); in TestContext()
2516 context = unum_getContext(unum, UDISPCTX_TYPE_CAPITALIZATION, &status); in TestContext()
2517 if ( U_FAILURE(status) || context != UDISPCTX_CAPITALIZATION_FOR_STANDALONE) { in TestContext()
2522 log_data_err("unum_open UNUM_SPELLOUT for en fails with status %s\n", myErrorName(status)); in TestContext()
2529 status = U_ZERO_ERROR; in TestContext()
2530 unum = unum_open(itemPtr->style, NULL, 0, itemPtr->locale, NULL, &status); in TestContext()
2531 if (U_FAILURE(status)) { in TestContext()
2533 itemPtr->locale, (int)itemPtr->style, myErrorName(status)); in TestContext()
2536 unum_setContext(unum, itemPtr->context, &status); in TestContext()
2537 ulenRes = unum_formatDouble(unum, 123.45, ubufResult, kUBufMax, NULL, &status); in TestContext()
2538 if (U_FAILURE(status)) { in TestContext()
2540 … itemPtr->locale, (int)itemPtr->style, (int)itemPtr->context, myErrorName(status)); in TestContext()
2579 UErrorCode status = U_ZERO_ERROR; in TestCurrencyUsage() local
2586 unumFmt = unum_open(style, NULL, 0, localeString, NULL, &status); in TestCurrencyUsage()
2587 if (U_FAILURE(status)) { in TestCurrencyUsage()
2589 localeString, (int)style, myErrorName(status)); in TestCurrencyUsage()
2616 unum_setTextAttribute(unumFmt, UNUM_CURRENCY_CODE, currencyCode, 3, &status); in TestCurrencyUsage()
2617 assertSuccess("num_setTextAttribute()", &status); in TestCurrencyUsage()
2620 &pos, &status); in TestCurrencyUsage()
2621 assertSuccess("num_formatDouble()", &status); in TestCurrencyUsage()
2648 UErrorCode status = U_ZERO_ERROR; in TestCurrFmtNegSameAsPositive() local
2649 UNumberFormat* unumfmt = unum_open(UNUM_CURRENCY, NULL, 0, "en_US", NULL, &status); in TestCurrFmtNegSameAsPositive()
2650 if ( U_SUCCESS(status) ) { in TestCurrFmtNegSameAsPositive()
2651 unum_applyPattern(unumfmt, FALSE, currFmtNegSameAsPos, -1, NULL, &status); in TestCurrFmtNegSameAsPositive()
2652 if (U_SUCCESS(status)) { in TestCurrFmtNegSameAsPositive()
2654 int32_t ulen = unum_toPattern(unumfmt, FALSE, ubuf, kUBufSize, &status); in TestCurrFmtNegSameAsPositive()
2655 if (U_FAILURE(status)) { in TestCurrFmtNegSameAsPositive()
2656 log_err("unum_toPattern fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2660 unum_setSymbol(unumfmt, UNUM_MINUS_SIGN_SYMBOL, emptyString, 0, &status); in TestCurrFmtNegSameAsPositive()
2661 if (U_SUCCESS(status)) { in TestCurrFmtNegSameAsPositive()
2662 ulen = unum_formatDouble(unumfmt, -100.0, ubuf, kUBufSize, NULL, &status); in TestCurrFmtNegSameAsPositive()
2663 if (U_FAILURE(status)) { in TestCurrFmtNegSameAsPositive()
2664 log_err("unum_formatDouble fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2669 log_err("unum_setSymbol fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2672 log_err("unum_applyPattern fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2676 … log_data_err("unum_open UNUM_CURRENCY for en_US fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2833 UErrorCode status = U_ZERO_ERROR; in TestVariousStylesAndAttributes() local
2834 … UNumberFormat * unum = unum_open(lsaTestPtr->style, NULL, 0, lsaTestPtr->locale, NULL, &status); in TestVariousStylesAndAttributes()
2835 if ( U_FAILURE(status) ) { in TestVariousStylesAndAttributes()
2836 …style %d, locale %s: error %s\n", (int)lsaTestPtr->style, lsaTestPtr->locale, u_errorName(status)); in TestVariousStylesAndAttributes()
2847 status = U_ZERO_ERROR; in TestVariousStylesAndAttributes()
2849 ugetlen = unum_formatDouble(unum, veItemPtr->value, uget, kUBufSize, NULL, &status); in TestVariousStylesAndAttributes()
2850 if ( U_FAILURE(status) ) { in TestVariousStylesAndAttributes()
2852 …aTestPtr->style, lsaTestPtr->locale, lsaTestPtr->attribute, veItemPtr->value, u_errorName(status)); in TestVariousStylesAndAttributes()
2856 u_strToUTF8(bexp, kBBufSize, NULL, uexp, uexplen, &status); in TestVariousStylesAndAttributes()
2857 u_strToUTF8(bget, kBBufSize, NULL, uget, ugetlen, &status); in TestVariousStylesAndAttributes()
2871 UErrorCode status = U_ZERO_ERROR; in TestParseCurrPatternWithDecStyle() local
2872 UNumberFormat *unumfmt = unum_open(UNUM_DECIMAL, NULL, 0, "en_US", NULL, &status); in TestParseCurrPatternWithDecStyle()
2873 if (U_FAILURE(status)) { in TestParseCurrPatternWithDecStyle()
2874 …_data_err("unum_open DECIMAL failed for en_US: %s (Are you missing data?)\n", u_errorName(status)); in TestParseCurrPatternWithDecStyle()
2876 unum_applyPattern(unumfmt, FALSE, currpat, -1, NULL, &status); in TestParseCurrPatternWithDecStyle()
2877 if (U_FAILURE(status)) { in TestParseCurrPatternWithDecStyle()
2878 log_err_status(status, "unum_applyPattern failed: %s\n", u_errorName(status)); in TestParseCurrPatternWithDecStyle()
2881 double value = unum_parseDouble(unumfmt, parsetxt, -1, &pos, &status); in TestParseCurrPatternWithDecStyle()
2882 if (U_SUCCESS(status)) { in TestParseCurrPatternWithDecStyle()
2883 …log_err_status(status, "unum_parseDouble expected to fail but got status %s, value %f\n", u_errorN… in TestParseCurrPatternWithDecStyle()