Lines Matching full:status
110 UErrorCode* status = &st; in TestInt64Parse() local
122 nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, status); in TestInt64Parse()
124 if(U_FAILURE(*status)) in TestInt64Parse()
126 log_data_err("Error in unum_open() %s \n", myErrorName(*status)); in TestInt64Parse()
132 a = unum_parseInt64(nf, text, size, 0, status); in TestInt64Parse()
136 if(!U_FAILURE(*status)) in TestInt64Parse()
138 log_err("Error in unum_parseInt64(): %s \n", myErrorName(*status)); in TestInt64Parse()
177 UErrorCode status=U_ZERO_ERROR; in TestNumberFormat() local
184 status = U_ZERO_ERROR; in TestNumberFormat()
186 def=unum_open(style, NULL,0,NULL, NULL,&status); in TestNumberFormat()
189 if(U_FAILURE(status)) in TestNumberFormat()
191 …eating default NumberFormat using unum_open(): %s (Are you missing data?)\n", myErrorName(status)); in TestNumberFormat()
196 fr=unum_open(style,NULL,0, "fr_FR",NULL, &status); in TestNumberFormat()
197 if(U_FAILURE(status)) in TestNumberFormat()
198 log_err("Error: could not create NumberFormat (french): %s\n", myErrorName(status)); in TestNumberFormat()
200 log_verbose("\nTesting unum_open(currency,NULL,status)\n"); in TestNumberFormat()
203 cur_def=unum_open(style, NULL,0,"en_US", NULL, &status); in TestNumberFormat()
204 if(U_FAILURE(status)) in TestNumberFormat()
205 … log_err("Error: could not create NumberFormat using \n unum_open(currency, NULL, &status) %s\n", in TestNumberFormat()
206 myErrorName(status) ); in TestNumberFormat()
208 log_verbose("\nTesting unum_open(currency, frenchlocale, status)\n"); in TestNumberFormat()
209 cur_fr=unum_open(style,NULL,0, "fr_FR", NULL, &status); in TestNumberFormat()
210 if(U_FAILURE(status)) in TestNumberFormat()
211 … log_err("Error: could not create NumberFormat using unum_open(currency, french, &status): %s\n", in TestNumberFormat()
212 myErrorName(status)); in TestNumberFormat()
214 log_verbose("\nTesting unum_open(percent, NULL, status)\n"); in TestNumberFormat()
216 per_def=unum_open(style,NULL,0, NULL,NULL, &status); in TestNumberFormat()
217 if(U_FAILURE(status)) in TestNumberFormat()
218 …could not create NumberFormat using unum_open(percent, NULL, &status): %s\n", myErrorName(status)); in TestNumberFormat()
220 log_verbose("\nTesting unum_open(percent,frenchlocale, status)\n"); in TestNumberFormat()
221 per_fr=unum_open(style, NULL,0,"fr_FR", NULL,&status); in TestNumberFormat()
222 if(U_FAILURE(status)) in TestNumberFormat()
223 …uld not create NumberFormat using unum_open(percent, french, &status): %s\n", myErrorName(status)); in TestNumberFormat()
225 log_verbose("\nTesting unum_open(spellout, NULL, status)"); in TestNumberFormat()
227 spellout_def=unum_open(style, NULL, 0, "en_US", NULL, &status); in TestNumberFormat()
228 if(U_FAILURE(status)) in TestNumberFormat()
229 …ould not create NumberFormat using unum_open(spellout, NULL, &status): %s\n", myErrorName(status)); in TestNumberFormat()
232 log_verbose("\nTesting unum_clone(fmt, status)"); in TestNumberFormat()
233 status = U_ZERO_ERROR; in TestNumberFormat()
234 myclone = unum_clone(def,&status); in TestNumberFormat()
235 if(U_FAILURE(status)) in TestNumberFormat()
236 log_err("Error: could not clone unum_clone(def, &status): %s\n", myErrorName(status)); in TestNumberFormat()
267 resultlengthneeded=unum_format(cur_def, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
268 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
270 status=U_ZERO_ERROR; in TestNumberFormat()
275 unum_format(cur_def, l, result, resultlength, &pos1, &status); in TestNumberFormat()
279 if(U_FAILURE(status)) in TestNumberFormat()
281 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status) ); in TestNumberFormat()
300 resultlengthneeded=unum_formatDouble(cur_def, d, NULL, resultlength, &pos2, &status); in TestNumberFormat()
301 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
303 status=U_ZERO_ERROR; in TestNumberFormat()
308 unum_formatDouble(cur_def, d, result, resultlength, &pos2, &status); in TestNumberFormat()
311 if(U_FAILURE(status)) in TestNumberFormat()
313 log_err("Error in formatting using unum_formatDouble(.....): %s\n", myErrorName(status)); in TestNumberFormat()
333 d1=unum_parseDouble(cur_def, result, u_strlen(result), &parsepos, &status); in TestNumberFormat()
337 if(U_FAILURE(status)) { in TestNumberFormat()
338 …epos=%d. The error is : %s\n", aescstrdup(result,u_strlen(result)),parsepos, myErrorName(status)); in TestNumberFormat()
349 status = U_ZERO_ERROR; in TestNumberFormat()
357 …resultlengthneeded=unum_formatDoubleCurrency(cur_def, a, temp, NULL, resultlength, &pos2, &status); in TestNumberFormat()
358 if (status==U_BUFFER_OVERFLOW_ERROR) { in TestNumberFormat()
359 status=U_ZERO_ERROR; in TestNumberFormat()
362 unum_formatDoubleCurrency(cur_def, a, temp, result, resultlength, &pos2, &status); in TestNumberFormat()
364 if (U_FAILURE(status)) { in TestNumberFormat()
365 … log_err("Error in formatting using unum_formatDoubleCurrency(.....): %s\n", myErrorName(status)); in TestNumberFormat()
386 d1=unum_parseDoubleCurrency(cur_def, result, u_strlen(result), &parsepos, temp2, &status); in TestNumberFormat()
387 if (U_FAILURE(status)) { in TestNumberFormat()
388 …ncy '%s' failed. The error is : %s\n", aescstrdup(result, u_strlen(result)), myErrorName(status)); in TestNumberFormat()
402 status = U_ZERO_ERROR; /* reset */ in TestNumberFormat()
414 d1=unum_parseDouble(cur_def, temp1, resultlength, &parsepos, &status); in TestNumberFormat()
416 if(U_FAILURE(status)) in TestNumberFormat()
418 …eDouble('%s') failed. The error is : %s\n", aescstrdup(temp1, resultlength), myErrorName(status)); in TestNumberFormat()
436 d1=unum_parseDouble(cur_def, temp1, u_strlen(temp1), &parsepos, &status); in TestNumberFormat()
437 if(U_SUCCESS(status)) in TestNumberFormat()
439 log_err("Error in unum_parseDouble(..., %s, ...): %s\n", temp1, myErrorName(status)); in TestNumberFormat()
444 status=U_ZERO_ERROR; in TestNumberFormat()
447 resultlengthneeded=unum_format(per_fr, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
448 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
450 status=U_ZERO_ERROR; in TestNumberFormat()
455 unum_format(per_fr, l, result, resultlength, &pos1, &status); in TestNumberFormat()
458 if(U_FAILURE(status)) in TestNumberFormat()
460 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status)); in TestNumberFormat()
468 l1=unum_parse(per_fr, result, u_strlen(result), &parsepos, &status); in TestNumberFormat()
470 if(U_FAILURE(status)) in TestNumberFormat()
472 log_err("parse failed. The error is : %s\n", myErrorName(status)); in TestNumberFormat()
485 pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), NULL, NULL,&status); in TestNumberFormat()
486 if(U_FAILURE(status)) in TestNumberFormat()
488 log_err("error in unum_openPattern(): %s\n", myErrorName(status) );; in TestNumberFormat()
496 resultlengthneeded=unum_toPattern(pattern, FALSE, NULL, resultlength, &status); in TestNumberFormat()
497 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
499 status=U_ZERO_ERROR; in TestNumberFormat()
502 unum_toPattern(pattern, FALSE, result, resultlength, &status); in TestNumberFormat()
504 if(U_FAILURE(status)) in TestNumberFormat()
506 log_err("error in extracting the pattern from UNumberFormat: %s\n", myErrorName(status)); in TestNumberFormat()
521 resultlengthneeded=unum_toPattern(cur_def, FALSE, NULL, resultlength, &status); in TestNumberFormat()
522 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
524 status=U_ZERO_ERROR; in TestNumberFormat()
527 unum_toPattern(cur_def, FALSE, result, resultlength, &status); in TestNumberFormat()
529 if(U_FAILURE(status)) in TestNumberFormat()
531 log_err("error in extracting the pattern from UNumberFormat: %s\n", myErrorName(status)); in TestNumberFormat()
534 status=U_ZERO_ERROR; in TestNumberFormat()
535 cur_frpattern=unum_open(UNUM_IGNORE,result, u_strlen(result), "fr_FR",NULL, &status); in TestNumberFormat()
536 if(U_FAILURE(status)) in TestNumberFormat()
538 log_err("error in unum_openPattern(): %s\n", myErrorName(status)); in TestNumberFormat()
546 status=U_ZERO_ERROR; in TestNumberFormat()
547 unum_getSymbol(cur_def, symType, temp1, sizeof(temp1), &status); in TestNumberFormat()
548 unum_setSymbol(cur_frpattern, symType, temp1, -1, &status); in TestNumberFormat()
549 if(U_FAILURE(status)) in TestNumberFormat()
551 log_err("Error in get/set symbols: %s\n", myErrorName(status)); in TestNumberFormat()
557 resultlengthneeded=unum_format(cur_def, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
558 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
560 status=U_ZERO_ERROR; in TestNumberFormat()
563 unum_format(cur_def, l, result, resultlength, &pos1, &status); in TestNumberFormat()
565 if(U_FAILURE(status)) in TestNumberFormat()
567 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status)); in TestNumberFormat()
570 if(U_FAILURE(status)){ in TestNumberFormat()
571 log_err("Fail: error in unum_setSymbols: %s\n", myErrorName(status)); in TestNumberFormat()
576 status=U_ZERO_ERROR; in TestNumberFormat()
577 unum_getSymbol(cur_def, symType, temp1, sizeof(temp1), &status); in TestNumberFormat()
578 unum_getSymbol(cur_frpattern, symType, temp2, sizeof(temp2), &status); in TestNumberFormat()
579 if(U_FAILURE(status) || u_strcmp(temp1, temp2) != 0) in TestNumberFormat()
590 resultlengthneeded=unum_format(cur_frpattern, l, NULL, resultlength, &pos1, &status); in TestNumberFormat()
591 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormat()
593 status=U_ZERO_ERROR; in TestNumberFormat()
595 unum_format(cur_frpattern, l, temp1, resultlength, &pos1, &status); in TestNumberFormat()
597 if(U_FAILURE(status)) in TestNumberFormat()
599 log_err("Error in formatting using unum_format(.....): %s\n", myErrorName(status)); in TestNumberFormat()
623 unum_setSymbol(cur_frpattern, (UNumberFormatSymbol)i, symbol, 2, &status); in TestNumberFormat()
624 if(U_FAILURE(status)) { in TestNumberFormat()
625 log_err("Error from unum_setSymbol(%d): %s\n", i, myErrorName(status)); in TestNumberFormat()
630 …th = unum_getSymbol(cur_frpattern, (UNumberFormatSymbol)i, symbol, UPRV_LENGTHOF(symbol), &status); in TestNumberFormat()
631 if(U_FAILURE(status)) { in TestNumberFormat()
632 log_err("Error from unum_getSymbol(%d): %s\n", i, myErrorName(status)); in TestNumberFormat()
640 unum_getSymbol(cur_frpattern, (UNumberFormatSymbol)i, symbol, UPRV_LENGTHOF(symbol), &status); in TestNumberFormat()
641 if(U_SUCCESS(status)){ in TestNumberFormat()
644 if(U_FAILURE(status)){ in TestNumberFormat()
645 if(status != U_ILLEGAL_ARGUMENT_ERROR){ in TestNumberFormat()
646 …og_err("Error: Expected U_ILLEGAL_ARGUMENT_ERROR for bogus symbol, Got %s\n", myErrorName(status)); in TestNumberFormat()
649 status=U_ZERO_ERROR; in TestNumberFormat()
654 unum_getTextAttribute(cur_fr, UNUM_NEGATIVE_SUFFIX, temp, resultlength, &status); in TestNumberFormat()
655 if(U_FAILURE(status)) in TestNumberFormat()
657 … log_err("Failure in gettting the Text attributes of number format: %s\n", myErrorName(status)); in TestNumberFormat()
659 unum_setTextAttribute(cur_def, UNUM_NEGATIVE_SUFFIX, temp, u_strlen(temp), &status); in TestNumberFormat()
660 if(U_FAILURE(status)) in TestNumberFormat()
662 … log_err("Failure in gettting the Text attributes of number format: %s\n", myErrorName(status)); in TestNumberFormat()
664 unum_getTextAttribute(cur_def, UNUM_NEGATIVE_SUFFIX, suffix, resultlength, &status); in TestNumberFormat()
665 if(U_FAILURE(status)) in TestNumberFormat()
667 … log_err("Failure in gettting the Text attributes of number format: %s\n", myErrorName(status)); in TestNumberFormat()
675 unum_setTextAttribute(cur_def, UNUM_NEGATIVE_SUFFIX, temp, u_strlen(temp), &status); in TestNumberFormat()
679 unum_setTextAttribute(def, UNUM_POSITIVE_PREFIX, prefix, u_strlen(prefix) , &status); in TestNumberFormat()
680 if(U_FAILURE(status)) in TestNumberFormat()
682 log_err("error in setting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
684 unum_getTextAttribute(def, UNUM_POSITIVE_PREFIX, temp, resultlength, &status); in TestNumberFormat()
685 if(U_FAILURE(status)) in TestNumberFormat()
687 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
696 unum_setTextAttribute(def, UNUM_NEGATIVE_PREFIX, prefix, u_strlen(prefix), &status); in TestNumberFormat()
697 if(U_FAILURE(status)) in TestNumberFormat()
699 log_err("error in setting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
701 unum_getTextAttribute(def, UNUM_NEGATIVE_PREFIX, temp, resultlength, &status); in TestNumberFormat()
702 if(U_FAILURE(status)) in TestNumberFormat()
704 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
712 unum_setTextAttribute(def, UNUM_NEGATIVE_SUFFIX, suffix, u_strlen(suffix) , &status); in TestNumberFormat()
713 if(U_FAILURE(status)) in TestNumberFormat()
715 log_err("error in setting the text attributes: %s\n", myErrorName(status)); in TestNumberFormat()
718 unum_getTextAttribute(def, UNUM_NEGATIVE_SUFFIX, temp, resultlength, &status); in TestNumberFormat()
719 if(U_FAILURE(status)) in TestNumberFormat()
721 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
729 unum_setTextAttribute(def, UNUM_POSITIVE_SUFFIX, suffix, u_strlen(suffix) , &status); in TestNumberFormat()
730 if(U_FAILURE(status)) in TestNumberFormat()
732 log_err("error in setting the text attributes: %s\n", myErrorName(status)); in TestNumberFormat()
735 unum_getTextAttribute(def, UNUM_POSITIVE_SUFFIX, temp, resultlength, &status); in TestNumberFormat()
736 if(U_FAILURE(status)) in TestNumberFormat()
738 log_err("error in getting the text attributes : %s\n", myErrorName(status)); in TestNumberFormat()
796 status = U_ZERO_ERROR; in TestNumberFormat()
797 len = unum_format(spellout_def, value, buffer, UPRV_LENGTHOF(buffer), NULL, &status); in TestNumberFormat()
798 if(U_FAILURE(status)) { in TestNumberFormat()
799 … log_err("Error in formatting using unum_format(spellout_fmt, ...): %s\n", myErrorName(status)); in TestNumberFormat()
806 parseResult = unum_parse(spellout_def, buffer, len, &pp, &status); in TestNumberFormat()
807 if (U_FAILURE(status)) { in TestNumberFormat()
808 … log_err("Error in parsing using unum_format(spellout_fmt, ...): %s\n", myErrorName(status)); in TestNumberFormat()
825 status=U_ZERO_ERROR; in TestNumberFormat()
826 dec_en = unum_open(UNUM_DECIMAL, NULL, 0, "en_US", NULL, &status); in TestNumberFormat()
828 unum_setSymbol(dec_en, UNUM_GROUPING_SEPARATOR_SYMBOL, groupingSep, 0, &status); in TestNumberFormat()
829 parseResult = unum_parseDouble(dec_en, numPercent, -1, NULL, &status); in TestNumberFormat()
831 if ( U_FAILURE(status) || parseResult != 12.0 ) { in TestNumberFormat()
832 log_err("unum_parseDouble with empty groupingSep: status %s, parseResult %f not 12.0\n", in TestNumberFormat()
833 myErrorName(status), parseResult); in TestNumberFormat()
857 status = U_ZERO_ERROR; in TestNumberFormat()
859 fmt = unum_open(UNUM_PATTERN_DECIMAL, dest, -1, "en", NULL /*parseError*/, &status); in TestNumberFormat()
860 …if (U_FAILURE(status)) log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(… in TestNumberFormat()
862 resultSize = unum_formatDecimal(fmt, numInitial, -1, dest, DESTCAPACITY, NULL, &status); in TestNumberFormat()
863 if (U_FAILURE(status)) { in TestNumberFormat()
864 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
879 … resultSize = unum_formatDecimal(fmt, numInitial, -1, dest, DESTCAPACITY, &fieldPos, &status); in TestNumberFormat()
880 if (U_FAILURE(status)) { in TestNumberFormat()
881 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
899 status = U_ZERO_ERROR; in TestNumberFormat()
901 resultSize = unum_parseDecimal(fmt, dest, -1, NULL, desta, DESTCAPACITY, &status); in TestNumberFormat()
902 if (U_FAILURE(status)) { in TestNumberFormat()
903 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
919 status = U_ZERO_ERROR; in TestNumberFormat()
923 resultSize = unum_parseDecimal(fmt, dest, -1, &parsePos, desta, DESTCAPACITY, &status); in TestNumberFormat()
924 if (U_FAILURE(status)) { in TestNumberFormat()
925 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
942 status = U_ZERO_ERROR; in TestNumberFormat()
949 UNumberFormat *fmt = unum_open(UNUM_DEFAULT, NULL, 0, NULL, NULL, &status); in TestNumberFormat()
950 if (U_FAILURE(status)) { in TestNumberFormat()
951 log_err("File %s, Line %d, status = %s\n", __FILE__, __LINE__, u_errorName(status)); in TestNumberFormat()
953 unum_getSymbol(fmt, (UNumberFormatSymbol)badsymbolLarge, NULL, 0, &status); in TestNumberFormat()
954 …if (U_SUCCESS(status)) log_err("unum_getSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
956 status = U_ZERO_ERROR; in TestNumberFormat()
957 unum_getSymbol(fmt, (UNumberFormatSymbol)badsymbolSmall, NULL, 0, &status); in TestNumberFormat()
958 …if (U_SUCCESS(status)) log_err("unum_getSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
960 status = U_ZERO_ERROR; in TestNumberFormat()
961 unum_setSymbol(fmt, (UNumberFormatSymbol)badsymbolLarge, value, valueLength, &status); in TestNumberFormat()
962 …if (U_SUCCESS(status)) log_err("unum_setSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
964 status = U_ZERO_ERROR; in TestNumberFormat()
965 unum_setSymbol(fmt, (UNumberFormatSymbol)badsymbolSmall, value, valueLength, &status); in TestNumberFormat()
966 …if (U_SUCCESS(status)) log_err("unum_setSymbol()'s status should be ILLEGAL_ARGUMENT with invalid … in TestNumberFormat()
1069 UErrorCode status; in TestParseCurrency() local
1075 status = U_ZERO_ERROR; in TestParseCurrency()
1076 unum = unum_open(UNUM_CURRENCY, NULL, 0, itemPtr->locale, NULL, &status); in TestParseCurrency()
1077 if (U_SUCCESS(status)) { in TestParseCurrency()
1079 status = U_ZERO_ERROR; in TestParseCurrency()
1081 parseVal = unum_parseDouble(unum, currStr, -1, &parsePos, &status); in TestParseCurrency()
1082 …if (status != itemPtr->parsDoubExpectErr || parsePos != itemPtr->parsDoubExpectPos || parseVal != … in TestParseCurrency()
1086 u_errorName(status), parsePos, parseVal ); in TestParseCurrency()
1088 status = U_ZERO_ERROR; in TestParseCurrency()
1091 parseVal = unum_parseDoubleCurrency(unum, currStr, -1, &parsePos, parseCurr, &status); in TestParseCurrency()
1093 …if (status != itemPtr->parsCurrExpectErr || parsePos != itemPtr->parsCurrExpectPos || parseVal != … in TestParseCurrency()
1098 u_errorName(status), parsePos, parseVal, parseCurrB ); in TestParseCurrency()
1102 …ted error in unum_open UNUM_CURRENCY for locale %s: '%s'\n", itemPtr->locale, u_errorName(status)); in TestParseCurrency()
1106 status = U_ZERO_ERROR; in TestParseCurrency()
1107 unum = unum_open(UNUM_CURRENCY_PLURAL, NULL, 0, itemPtr->locale, NULL, &status); in TestParseCurrency()
1108 if (U_SUCCESS(status)) { in TestParseCurrency()
1109 status = U_ZERO_ERROR; in TestParseCurrency()
1111 parseVal = unum_parseDouble(unum, itemPtr->plurStr, -1, &parsePos, &status); in TestParseCurrency()
1112 … if (status != itemPtr->parsDoubExpectErr || parseVal != itemPtr->parsDoubExpectVal) { in TestParseCurrency()
1116 u_errorName(status), parseVal ); in TestParseCurrency()
1118 status = U_ZERO_ERROR; in TestParseCurrency()
1121 … parseVal = unum_parseDoubleCurrency(unum, itemPtr->plurStr, -1, &parsePos, parseCurr, &status); in TestParseCurrency()
1123 … if (status != itemPtr->parsCurrExpectErr || parseVal != itemPtr->parsCurrExpectVal || in TestParseCurrency()
1128 u_errorName(status), parseVal, parseCurrB ); in TestParseCurrency()
1132 …or in unum_open UNUM_CURRENCY_PLURAL for locale %s: '%s'\n", itemPtr->locale, u_errorName(status)); in TestParseCurrency()
1145 UErrorCode status; member
1158 /* name loc src start val end status */
1179 UErrorCode status = U_ZERO_ERROR; in TestSpelloutNumberParse() local
1181 UNumberFormat *nf = unum_open(UNUM_SPELLOUT, NULL, 0, testPtr->locale, NULL, &status); in TestSpelloutNumberParse()
1182 if (U_FAILURE(status)) { in TestSpelloutNumberParse()
1183 …log_err_status(status, "unum_open fails for UNUM_SPELLOUT with locale %s, status %s\n", testPtr->l… in TestSpelloutNumberParse()
1186 status = U_ZERO_ERROR; in TestSpelloutNumberParse()
1187 value = unum_parse(nf, testPtr->source, -1, &position, &status); in TestSpelloutNumberParse()
1188 if ( value != testPtr->value || position != testPtr->endPos || status != testPtr->status ) { in TestSpelloutNumberParse()
1189 …arse SPELLOUT, locale %s, testname %s, startPos %d: for value / endPos / status, expected %d / %d … in TestSpelloutNumberParse()
1191 testPtr->value, testPtr->endPos, myErrorName(testPtr->status), in TestSpelloutNumberParse()
1192 value, position, myErrorName(status) ); in TestSpelloutNumberParse()
1203 UErrorCode status = U_ZERO_ERROR; in TestSignificantDigits() local
1209 fmt=unum_open(UNUM_IGNORE, temp, -1, "en", NULL, &status); in TestSignificantDigits()
1210 if (U_FAILURE(status)) { in TestSignificantDigits()
1211 log_data_err("got unexpected error for unum_open: '%s'\n", u_errorName(status)); in TestSignificantDigits()
1219 resultlengthneeded=unum_formatDouble(fmt, d, NULL, resultlength, NULL, &status); in TestSignificantDigits()
1220 if(status==U_BUFFER_OVERFLOW_ERROR) in TestSignificantDigits()
1222 status=U_ZERO_ERROR; in TestSignificantDigits()
1225 unum_formatDouble(fmt, d, result, resultlength, NULL, &status); in TestSignificantDigits()
1227 if(U_FAILURE(status)) in TestSignificantDigits()
1229 log_err("Error in formatting using unum_formatDouble(.....): %s\n", myErrorName(status)); in TestSignificantDigits()
1242 UErrorCode status = U_ZERO_ERROR; in TestSigDigRounding() local
1250 fmt=unum_open(UNUM_DECIMAL, NULL, 0, "en", NULL, &status); in TestSigDigRounding()
1251 if (U_FAILURE(status)) { in TestSigDigRounding()
1252 log_data_err("got unexpected error for unum_open: '%s'\n", u_errorName(status)); in TestSigDigRounding()
1263 (void)unum_formatDouble(fmt, d, result, UPRV_LENGTHOF(result), NULL, &status); in TestSigDigRounding()
1264 if(U_FAILURE(status)) in TestSigDigRounding()
1266 log_err("Error in formatting using unum_formatDouble(.....): %s\n", myErrorName(status)); in TestSigDigRounding()
1283 UErrorCode status=U_ZERO_ERROR; in TestNumberFormatPadding() local
1295 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1296 pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), NULL, NULL,&status); in TestNumberFormatPadding()
1297 if(U_SUCCESS(status)) in TestNumberFormatPadding()
1299 log_err("error in unum_openPattern(%s): %s\n", temp1, myErrorName(status) ); in TestNumberFormatPadding()
1309 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1310 pattern=unum_open(UNUM_IGNORE,temp1, u_strlen(temp1), "en_US",NULL, &status); in TestNumberFormatPadding()
1311 if(U_FAILURE(status)) in TestNumberFormatPadding()
1313 …log_err_status(status, "error in padding unum_openPattern(%s): %s\n", temp1, myErrorName(status) )… in TestNumberFormatPadding()
1321 resultlengthneeded=unum_toPattern(pattern, FALSE, NULL, resultlength, &status); in TestNumberFormatPadding()
1322 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormatPadding()
1324 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1327 unum_toPattern(pattern, FALSE, result, resultlength, &status); in TestNumberFormatPadding()
1329 if(U_FAILURE(status)) in TestNumberFormatPadding()
1331 … log_err("error in extracting the padding pattern from UNumberFormat: %s\n", myErrorName(status)); in TestNumberFormatPadding()
1350 resultlengthneeded=unum_formatDouble(pattern, d, NULL, resultlength, &pos1, &status); in TestNumberFormatPadding()
1351 if(status==U_BUFFER_OVERFLOW_ERROR) in TestNumberFormatPadding()
1353 status=U_ZERO_ERROR; in TestNumberFormatPadding()
1356 unum_formatDouble(pattern, d, result, resultlength, NULL, &status); in TestNumberFormatPadding()
1358 if(U_FAILURE(status)) in TestNumberFormatPadding()
1360 …err("Error in formatting using unum_formatDouble(.....) with padding : %s\n", myErrorName(status)); in TestNumberFormatPadding()
1378 d1=unum_parseDouble(pattern, result, u_strlen(result), &parsepos, &status); in TestNumberFormatPadding()
1379 if(U_FAILURE(status)) in TestNumberFormatPadding()
1381 log_err("padding parse failed. The error is : %s\n", myErrorName(status)); in TestNumberFormatPadding()
1404 UErrorCode status = U_ZERO_ERROR; in TestInt64Format() local
1416 fmt = unum_open(UNUM_IGNORE, temp1, u_strlen(temp1), "en_US", NULL, &status); in TestInt64Format()
1417 if(U_FAILURE(status)) { in TestInt64Format()
1418 log_data_err("error in unum_openPattern() - %s\n", myErrorName(status)); in TestInt64Format()
1421 unum_formatInt64(fmt, U_INT64_MAX, result, 512, NULL, &status); in TestInt64Format()
1422 if (U_FAILURE(status)) { in TestInt64Format()
1423 log_err("error in unum_format(): %s\n", myErrorName(status)); in TestInt64Format()
1427 val32 = unum_parse(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1428 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1429 log_err("parse didn't report error: %s\n", myErrorName(status)); in TestInt64Format()
1434 status = U_ZERO_ERROR; in TestInt64Format()
1436 val64 = unum_parseInt64(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1437 if (U_FAILURE(status)) { in TestInt64Format()
1438 log_err("parseInt64 returned error: %s\n", myErrorName(status)); in TestInt64Format()
1443 status = U_ZERO_ERROR; in TestInt64Format()
1445 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1446 if (U_FAILURE(status)) { in TestInt64Format()
1447 log_err("parseDouble returned error: %s\n", myErrorName(status)); in TestInt64Format()
1453 unum_formatInt64(fmt, U_INT64_MIN, result, 512, NULL, &status); in TestInt64Format()
1454 if (U_FAILURE(status)) { in TestInt64Format()
1455 log_err("error in unum_format(): %s\n", myErrorName(status)); in TestInt64Format()
1459 val32 = unum_parse(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1460 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1461 log_err("parse didn't report error: %s\n", myErrorName(status)); in TestInt64Format()
1466 status = U_ZERO_ERROR; in TestInt64Format()
1468 val64 = unum_parseInt64(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1469 if (U_FAILURE(status)) { in TestInt64Format()
1470 log_err("parseInt64 returned error: %s\n", myErrorName(status)); in TestInt64Format()
1475 status = U_ZERO_ERROR; in TestInt64Format()
1477 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1478 if (U_FAILURE(status)) { in TestInt64Format()
1479 log_err("parseDouble returned error: %s\n", myErrorName(status)); in TestInt64Format()
1485 unum_formatDouble(fmt, doubleBig, result, 512, NULL, &status); in TestInt64Format()
1486 if (U_FAILURE(status)) { in TestInt64Format()
1487 log_err("error in unum_format(): %s\n", myErrorName(status)); in TestInt64Format()
1491 val32 = unum_parse(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1492 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1493 log_err("parse didn't report error: %s\n", myErrorName(status)); in TestInt64Format()
1498 status = U_ZERO_ERROR; in TestInt64Format()
1500 val64 = unum_parseInt64(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1501 if (status != U_INVALID_FORMAT_ERROR) { in TestInt64Format()
1502 log_err("parseInt64 didn't report error error: %s\n", myErrorName(status)); in TestInt64Format()
1507 status = U_ZERO_ERROR; in TestInt64Format()
1509 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1510 if (U_FAILURE(status)) { in TestInt64Format()
1511 log_err("parseDouble returned error: %s\n", myErrorName(status)); in TestInt64Format()
1519 valDouble = unum_parseDouble(fmt, result, u_strlen(result), &parsepos, &status); in TestInt64Format()
1520 if (U_FAILURE(status)) { in TestInt64Format()
1521 log_err("parseDouble() returned error: %s\n", myErrorName(status)); in TestInt64Format()
1540 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1541 unum_formatDouble(fmt, vals[i], buffer, BUFSIZE, NULL, &status); in test_fmt()
1542 if (U_FAILURE(status)) { in test_fmt()
1543 log_err("failed to format: %g, returned %s\n", vals[i], u_errorName(status)); in test_fmt()
1552 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1555 unum_applyPattern(fmt, FALSE, buffer, -1, &perr, &status); in test_fmt()
1556 if (isDecimal ? U_FAILURE(status) : (status != U_UNSUPPORTED_ERROR)) { in test_fmt()
1557 log_err("got unexpected error for applyPattern: '%s'\n", u_errorName(status)); in test_fmt()
1593 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1594 int len = unum_getTextAttribute(fmt, UNUM_DEFAULT_RULESET, buffer, BUFSIZE, &status); in test_fmt()
1595 if (isDecimal ? (status != U_UNSUPPORTED_ERROR) : U_FAILURE(status)) { in test_fmt()
1596 log_err("got unexpected error for get default ruleset: '%s'\n", u_errorName(status)); in test_fmt()
1598 if (U_SUCCESS(status)) { in test_fmt()
1603 status = U_ZERO_ERROR; in test_fmt()
1604 len = unum_getTextAttribute(fmt, UNUM_PUBLIC_RULESETS, buffer, BUFSIZE, &status); in test_fmt()
1605 if (isDecimal ? (status != U_UNSUPPORTED_ERROR) : U_FAILURE(status)) { in test_fmt()
1606 log_err("got unexpected error for get public rulesets: '%s'\n", u_errorName(status)); in test_fmt()
1608 if (U_SUCCESS(status)) { in test_fmt()
1618 unum_setTextAttribute(fmt, UNUM_DEFAULT_RULESET, buffer, -1, &status); in test_fmt()
1619 if (U_FAILURE(status)) { in test_fmt()
1620 … log_err("unexpected error setting default ruleset: '%s'\n", u_errorName(status)); in test_fmt()
1622 … int len2 = unum_getTextAttribute(fmt, UNUM_DEFAULT_RULESET, buffer, BUFSIZE, &status); in test_fmt()
1623 if (U_FAILURE(status)) { in test_fmt()
1624 log_err("could not fetch default ruleset: '%s'\n", u_errorName(status)); in test_fmt()
1630 status = U_ZERO_ERROR; in test_fmt()
1631 unum_formatDouble(fmt, vals[i], buffer, BUFSIZE, NULL, &status); in test_fmt()
1632 if (U_FAILURE(status)) { in test_fmt()
1633 … log_err("failed to format: %g, returned %s\n", vals[i], u_errorName(status)); in test_fmt()
1647 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1648 unum_toPattern(fmt, FALSE, buffer, BUFSIZE, &status); in test_fmt()
1649 if (U_SUCCESS(status)) { in test_fmt()
1652 } else if (status != U_BUFFER_OVERFLOW_ERROR) { in test_fmt()
1653 log_err("toPattern failed unexpectedly: %s\n", u_errorName(status)); in test_fmt()
1660 UErrorCode status = U_ZERO_ERROR; in test_fmt() local
1661 int len = unum_getSymbol(fmt, UNUM_CURRENCY_SYMBOL, buffer, BUFSIZE, &status); in test_fmt()
1662 if (isDecimal ? U_FAILURE(status) : (status != U_UNSUPPORTED_ERROR)) { in test_fmt()
1663 log_err("unexpected error getting symbol: '%s'\n", u_errorName(status)); in test_fmt()
1666 unum_setSymbol(fmt, UNUM_CURRENCY_SYMBOL, buffer, len, &status); in test_fmt()
1667 if (isDecimal ? U_FAILURE(status) : (status != U_UNSUPPORTED_ERROR)) { in test_fmt()
1668 log_err("unexpected error setting symbol: '%s'\n", u_errorName(status)); in test_fmt()
1675 UErrorCode status = U_ZERO_ERROR; in TestNonExistentCurrency() local
1680 format = unum_open(UNUM_CURRENCY, NULL, 0, "th_TH@currency=QQQ", NULL, &status); in TestNonExistentCurrency()
1681 if (format == NULL || U_FAILURE(status)) { in TestNonExistentCurrency()
1682 … result for non-existent requested currency: '%s' (Are you missing data?)\n", u_errorName(status)); in TestNonExistentCurrency()
1689 &status); in TestNonExistentCurrency()
1698 UErrorCode status; in TestRBNFFormat() local
1711 status = U_ZERO_ERROR; in TestRBNFFormat()
1713 formats[0] = unum_open(UNUM_PATTERN_DECIMAL, pat, -1, "en_US", &perr, &status); in TestRBNFFormat()
1714 if (U_FAILURE(status)) { in TestRBNFFormat()
1715 log_err_status(status, "unable to open decimal pattern -> %s\n", u_errorName(status)); in TestRBNFFormat()
1719 status = U_ZERO_ERROR; in TestRBNFFormat()
1720 formats[1] = unum_open(UNUM_SPELLOUT, NULL, 0, "en_US", &perr, &status); in TestRBNFFormat()
1721 if (U_FAILURE(status)) { in TestRBNFFormat()
1722 log_err_status(status, "unable to open spellout -> %s\n", u_errorName(status)); in TestRBNFFormat()
1726 status = U_ZERO_ERROR; in TestRBNFFormat()
1727 formats[2] = unum_open(UNUM_ORDINAL, NULL, 0, "en_US", &perr, &status); in TestRBNFFormat()
1728 if (U_FAILURE(status)) { in TestRBNFFormat()
1729 log_err_status(status, "unable to open ordinal -> %s\n", u_errorName(status)); in TestRBNFFormat()
1733 status = U_ZERO_ERROR; in TestRBNFFormat()
1734 formats[3] = unum_open(UNUM_DURATION, NULL, 0, "en_US", &perr, &status); in TestRBNFFormat()
1735 if (U_FAILURE(status)) { in TestRBNFFormat()
1736 log_err_status(status, "unable to open duration %s\n", u_errorName(status)); in TestRBNFFormat()
1740 status = U_ZERO_ERROR; in TestRBNFFormat()
1778 formats[4] = unum_open(UNUM_PATTERN_RULEBASED, pat, -1, "en_US", &perr, &status); in TestRBNFFormat()
1779 if (U_FAILURE(status)) { in TestRBNFFormat()
1780 log_err_status(status, "unable to open rulebased pattern -> %s\n", u_errorName(status)); in TestRBNFFormat()
1782 if (U_FAILURE(status)) { in TestRBNFFormat()
1783 log_err_status(status, "Something failed with %s\n", u_errorName(status)); in TestRBNFFormat()
1797 status = U_ZERO_ERROR; in TestRBNFFormat()
1798 len = unum_formatDouble(formats[1], nanvalue, fmtbuf, FORMAT_BUF_CAPACITY, NULL, &status); in TestRBNFFormat()
1799 if (U_FAILURE(status)) { in TestRBNFFormat()
1800 log_err_status(status, "unum_formatDouble NAN failed with %s\n", u_errorName(status)); in TestRBNFFormat()
1818 UErrorCode status = U_ZERO_ERROR; in TestRBNFRounding() local
1819 UNumberFormat* fmt = unum_open(UNUM_SPELLOUT, NULL, 0, "en_US", NULL, &status); in TestRBNFRounding()
1820 if (U_FAILURE(status)) { in TestRBNFRounding()
1821 log_err_status(status, "unable to open spellout -> %s\n", u_errorName(status)); in TestRBNFRounding()
1824 len = unum_formatDouble(fmt, 10.123456789, fmtbuf, FORMAT_BUF_CAPACITY, NULL, &status); in TestRBNFRounding()
1825 if (U_FAILURE(status)) { in TestRBNFRounding()
1826 … log_err_status(status, "unum_formatDouble 10.123456789 failed with %s\n", u_errorName(status)); in TestRBNFRounding()
1843 len = unum_formatDouble(fmt, 10.123456789, fmtbuf, FORMAT_BUF_CAPACITY, NULL, &status); in TestRBNFRounding()
1844 if (U_FAILURE(status)) { in TestRBNFRounding()
1845 … log_err_status(status, "unum_formatDouble 10.123456789 failed with %s\n", u_errorName(status)); in TestRBNFRounding()
1860 returns with a status of zero error & a parse pos of 22 (I would in TestCurrencyRegression()
1879 UErrorCode status = U_ZERO_ERROR; in TestCurrencyRegression() local
1884 cur = unum_open(UNUM_CURRENCY, NULL,0,"en_US", NULL, &status); in TestCurrencyRegression()
1886 if(U_FAILURE(status)) { in TestCurrencyRegression()
1887 log_data_err("unum_open failed: %s (Are you missing data?)\n", u_errorName(status)); in TestCurrencyRegression()
1891 status = U_ZERO_ERROR; /* so we can test it later. */ in TestCurrencyRegression()
1899 &status); in TestCurrencyRegression()
1903 if(U_FAILURE(status) || (pos != expected)) { in TestCurrencyRegression()
1905 expected, d, u_errorName(status), pos, acurrency); in TestCurrencyRegression()
1907 …rency failed, value %.9f err %s, pos %d, currency [%s]\n", d, u_errorName(status), pos, acurrency); in TestCurrencyRegression()
1918 UErrorCode status = U_ZERO_ERROR; in TestTextAttributeCrash() local
1919 UNumberFormat *nf = unum_open(UNUM_CURRENCY, NULL, 0, "en_US", NULL, &status); in TestTextAttributeCrash()
1920 if (U_FAILURE(status)) { in TestTextAttributeCrash()
1921 log_data_err("FAILED 1 -> %s (Are you missing data?)\n", u_errorName(status)); in TestTextAttributeCrash()
1924 unum_setTextAttribute(nf, UNUM_CURRENCY_CODE, ubuffer, 3, &status); in TestTextAttributeCrash()
1929 used = unum_getTextAttribute(nf, UNUM_NEGATIVE_PREFIX, ubuffer, 64, &status); in TestTextAttributeCrash()
1930 unum_setTextAttribute(nf, UNUM_NEGATIVE_PREFIX, ubuffer, used, &status); in TestTextAttributeCrash()
1931 if (U_FAILURE(status)) { in TestTextAttributeCrash()
1935 used = unum_formatDouble(nf, -1234.5, ubuffer, 64, NULL, &status); in TestTextAttributeCrash()
1936 if (U_FAILURE(status) || 64 < used) { in TestTextAttributeCrash()
1937 log_err("Failed formatting %s\n", u_errorName(status)); in TestTextAttributeCrash()
1943 used = unum_formatDouble(nf, 1234.5, ubuffer, 64, NULL, &status); in TestTextAttributeCrash()
1944 if (U_FAILURE(status) || 64 < used) { in TestTextAttributeCrash()
1945 log_err("Failed formatting %s\n", u_errorName(status)); in TestTextAttributeCrash()
1955 UErrorCode status = U_ZERO_ERROR; in TestNBSPPatternRtNum() local
1959 unum_formatDouble(nf, myNumber, myString, 20, NULL, &status); in TestNBSPPatternRtNum()
1961 if(U_FAILURE(status)) { in TestNBSPPatternRtNum()
1962 … log_err("%s:%d: failed format of %.2g with %s\n", testcase, line, myNumber, u_errorName(status)); in TestNBSPPatternRtNum()
1965 aNumber = unum_parse(nf, myString, -1, NULL, &status); in TestNBSPPatternRtNum()
1966 if(U_FAILURE(status)) { in TestNBSPPatternRtNum()
1967 log_err("%s:%d: failed parse with %s\n", testcase, line, u_errorName(status)); in TestNBSPPatternRtNum()
1983 UErrorCode status = U_ZERO_ERROR; in TestNBSPInPattern() local
1989 nf = unum_open(UNUM_CURRENCY, NULL, -1, "ar_AE", NULL, &status); in TestNBSPInPattern()
1990 if(U_FAILURE(status) || nf == NULL) { in TestNBSPInPattern()
1991 …open failed with %s (Are you missing data?)\n", __FILE__, __LINE__, testcase, u_errorName(status)); in TestNBSPInPattern()
2002 unum_applyPattern(nf, FALSE, pat, -1, NULL, &status); in TestNBSPInPattern()
2003 if(U_FAILURE(status)) { in TestNBSPInPattern()
2004 log_err("%s: unum_applyPattern failed with %s\n", testcase, u_errorName(status)); in TestNBSPInPattern()
2010 unum_close(nf); status = U_ZERO_ERROR; in TestNBSPInPattern()
2013 nf = unum_open(UNUM_DECIMAL, NULL, -1, "ar_AE", NULL, &status); in TestNBSPInPattern()
2014 if(U_FAILURE(status)) { in TestNBSPInPattern()
2015 log_err("%s: unum_open failed with %s\n", testcase, u_errorName(status)); in TestNBSPInPattern()
2018 unum_close(nf); status = U_ZERO_ERROR; in TestNBSPInPattern()
2021 nf = unum_open(UNUM_PERCENT, NULL, -1, "ar_AE", NULL, &status); in TestNBSPInPattern()
2022 if(U_FAILURE(status)) { in TestNBSPInPattern()
2023 log_err("%s: unum_open failed with %s\n", testcase, u_errorName(status)); in TestNBSPInPattern()
2026 unum_close(nf); status = U_ZERO_ERROR; in TestNBSPInPattern()
2034 UErrorCode status = U_ZERO_ERROR; in TestCloneWithRBNF() local
2081 pform = unum_open(UNUM_PATTERN_RULEBASED, pattern, -1, "en_US", NULL, &status); in TestCloneWithRBNF()
2082 unum_formatDouble(pform, 3600, buffer, 256, NULL, &status); in TestCloneWithRBNF()
2084 pform_cloned = unum_clone(pform,&status); in TestCloneWithRBNF()
2085 unum_formatDouble(pform_cloned, 3600, buffer_cloned, 256, NULL, &status); in TestCloneWithRBNF()
2097 UErrorCode status = U_ZERO_ERROR; in TestNoExponent() local
2105 fmt = unum_open(UNUM_DECIMAL, NULL, -1, "en_US", NULL, &status); in TestNoExponent()
2107 if(U_FAILURE(status) || fmt == NULL) { in TestNoExponent()
2108 …:%d: unum_open failed with %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status)); in TestNoExponent()
2116 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2118 if(U_FAILURE(status)) { in TestNoExponent()
2119 …e failed with %s for %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status), cstr); in TestNoExponent()
2135 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2143 status = U_ZERO_ERROR; in TestNoExponent()
2148 fmt = unum_open(UNUM_SCIENTIFIC, NULL, -1, "en_US", NULL, &status); in TestNoExponent()
2149 assertSuccess("unum_open(UNUM_SCIENTIFIC, ...)", &status); in TestNoExponent()
2157 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2159 if(U_FAILURE(status)) { in TestNoExponent()
2160 …e failed with %s for %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status), cstr); in TestNoExponent()
2177 num = unum_parse(fmt, str, -1, &pos, &status); in TestNoExponent()
2179 if(U_FAILURE(status)) { in TestNoExponent()
2180 …e failed with %s for %s (Are you missing data?)\n", __FILE__, __LINE__, u_errorName(status), cstr); in TestNoExponent()
2191 UErrorCode status = U_ZERO_ERROR; in TestMaxInt() local
2202 &status); in TestMaxInt()
2203 if(U_FAILURE(status) || fmt == NULL) { in TestMaxInt()
2204 … failed with %s (Are you missing data?)\n", __FILE__, __LINE__, "TestMaxInt", u_errorName(status)); in TestMaxInt()
2210 status = U_ZERO_ERROR; in TestMaxInt()
2212 len1 = unum_formatInt64(fmt, 1997, result1, 1024, NULL, &status); in TestMaxInt()
2214 if(U_FAILURE(status) || u_strcmp(expect, result1)) { in TestMaxInt()
2215 …("unum_formatInt64 Expected %s but got %s status %s\n", austrdup(expect), austrdup(result1), u_err… in TestMaxInt()
2218 status = U_ZERO_ERROR; in TestMaxInt()
2220 len2 = unum_formatDouble(fmt, 1997.0, result2, 1024, NULL, &status); in TestMaxInt()
2222 if(U_FAILURE(status) || u_strcmp(expect, result2)) { in TestMaxInt()
2223 …"unum_formatDouble Expected %s but got %s status %s\n", austrdup(expect), austrdup(result2), u_err… in TestMaxInt()
2235 status = U_ZERO_ERROR; in TestMaxInt()
2237 len1 = unum_formatInt64(fmt, 1997, result1, 1024, NULL, &status); in TestMaxInt()
2238 ASSERT_TRUE(status==U_ILLEGAL_ARGUMENT_ERROR); in TestMaxInt()
2239 status = U_ZERO_ERROR; in TestMaxInt()
2244 len1 = unum_formatInt64(fmt, 97, result1, 1024, NULL, &status); in TestMaxInt()
2246 if(U_FAILURE(status) || u_strcmp(expect, result1)) { in TestMaxInt()
2247 …("unum_formatInt64 Expected %s but got %s status %s\n", austrdup(expect), austrdup(result1), u_err… in TestMaxInt()
2250 status = U_ZERO_ERROR; in TestMaxInt()
2252 len2 = unum_formatDouble(fmt, 97.0, result2, 1024, NULL, &status); in TestMaxInt()
2254 if(U_FAILURE(status) || u_strcmp(expect, result2)) { in TestMaxInt()
2255 …"unum_formatDouble Expected %s but got %s status %s\n", austrdup(expect), austrdup(result2), u_err… in TestMaxInt()
2266 UErrorCode status = U_ZERO_ERROR; in TestUFormattable() local
2267 UNumberFormat *unum = unum_open(UNUM_DEFAULT, NULL, -1, "en_US_POSIX", NULL, &status); in TestUFormattable()
2268 if(assertSuccessCheck("calling unum_open()", &status, TRUE)) { in TestUFormattable()
2272 UFormattable *ufmt = ufmt_open(&status); in TestUFormattable()
2273 unum_parseToUFormattable(unum, ufmt, str, -1, NULL, &status); in TestUFormattable()
2275 result = ufmt_getLong(ufmt, &status); /* == 123 */ in TestUFormattable()
2286 UErrorCode status = U_ZERO_ERROR; in TestUFormattable() local
2291 ufmt = ufmt_open(&status); in TestUFormattable()
2292 unum = unum_open(UNUM_DEFAULT, NULL, -1, "en_US_POSIX", NULL, &status); in TestUFormattable()
2293 if(assertSuccessCheck("calling ufmt_open() || unum_open()", &status, TRUE)) { in TestUFormattable()
2298 unum_parseToUFormattable(unum, ufmt, buffer, -1, NULL, &status); in TestUFormattable()
2299 if(assertSuccess("unum_parseToUFormattable(31337)", &status)) { in TestUFormattable()
2300 assertTrue("ufmt_getLong()=31337", ufmt_getLong(ufmt, &status) == 31337); in TestUFormattable()
2301 assertTrue("ufmt_getType()=UFMT_LONG", ufmt_getType(ufmt, &status) == UFMT_LONG); in TestUFormattable()
2302 log_verbose("long = %d\n", ufmt_getLong(ufmt, &status)); in TestUFormattable()
2303 assertSuccess("ufmt_getLong()", &status); in TestUFormattable()
2305 unum_formatUFormattable(unum, ufmt, out2k, 2048, NULL, &status); in TestUFormattable()
2306 if(assertSuccess("unum_formatUFormattable(31337)", &status)) { in TestUFormattable()
2313 unum_parseToUFormattable(unum, ufmt, buffer, -1, NULL, &status); in TestUFormattable()
2314 if(assertSuccess("unum_parseToUFormattable(3.14159)", &status)) { in TestUFormattable()
2315 … assertTrue("ufmt_getDouble()==3.14159", withinErr(ufmt_getDouble(ufmt, &status), 3.14159, 1e-15)); in TestUFormattable()
2316 assertSuccess("ufmt_getDouble()", &status); in TestUFormattable()
2317 assertTrue("ufmt_getType()=UFMT_DOUBLE", ufmt_getType(ufmt, &status) == UFMT_DOUBLE); in TestUFormattable()
2318 log_verbose("double = %g\n", ufmt_getDouble(ufmt, &status)); in TestUFormattable()
2320 unum_formatUFormattable(unum, ufmt, out2k, 2048, NULL, &status); in TestUFormattable()
2321 if(assertSuccess("unum_formatUFormattable(3.14159)", &status)) { in TestUFormattable()
2332 UErrorCode status = U_ZERO_ERROR; in TestUFormattable() local
2340 unum = unum_open(UNUM_DEFAULT, NULL, -1, "en_US_POSIX", NULL, &status); in TestUFormattable()
2341 if(assertSuccessCheck("calling unum_open()", &status, TRUE)) { in TestUFormattable()
2344 buffer, -1, NULL, &status); in TestUFormattable()
2345 if(assertSuccess("unum_parseToUFormattable(weight of the moon)", &status)) { in TestUFormattable()
2348 unum_formatUFormattable(unum, ufmt, out2k, 2048, NULL, &status); in TestUFormattable()
2349 if(assertSuccess("unum_formatUFormattable(3.14159)", &status)) { in TestUFormattable()
2353 log_verbose("double: %g\n", ufmt_getDouble(ufmt, &status)); in TestUFormattable()
2354 assertSuccess("ufmt_getDouble()", &status); in TestUFormattable()
2356 log_verbose("long: %ld\n", ufmt_getLong(ufmt, &status)); in TestUFormattable()
2357 assertTrue("failure on ufmt_getLong() for huge number:", U_FAILURE(status)); in TestUFormattable()
2358 // status is now a failure due to ufmt_getLong() above. in TestUFormattable()
2404 UErrorCode status; in TestUNumberingSystem() local
2407 status = U_ZERO_ERROR; in TestUNumberingSystem()
2408 unumsys = unumsys_open(itemPtr->locale, &status); in TestUNumberingSystem()
2409 if ( U_SUCCESS(status) ) { in TestUNumberingSystem()
2418 ulen = unumsys_getDescription(unumsys, ubuf, kNumSysDescripBufMax, &status); in TestUNumberingSystem()
2420 if ( U_FAILURE(status) || u_strcmp(ubuf, itemPtr->description) != 0 ) { in TestUNumberingSystem()
2421 …unumsys description for locale %s, description unexpected and/or status %\n", myErrorName(status)); in TestUNumberingSystem()
2425 …log_data_err("unumsys_open for locale %s fails with status %s\n", itemPtr->locale, myErrorName(sta… in TestUNumberingSystem()
2429 status = U_ZERO_ERROR; in TestUNumberingSystem()
2430 uenum = unumsys_openAvailableNames(&status); in TestUNumberingSystem()
2431 if ( U_SUCCESS(status) ) { in TestUNumberingSystem()
2436 while ( (numsys = uenum_next(uenum, NULL, &status)) != NULL && U_SUCCESS(status) ) { in TestUNumberingSystem()
2437 status = U_ZERO_ERROR; in TestUNumberingSystem()
2438 unumsys = unumsys_openByName(numsys, &status); in TestUNumberingSystem()
2439 if ( U_SUCCESS(status) ) { in TestUNumberingSystem()
2445 …g_err("unumsys_openAvailableNames includes %s but unumsys_openByName on it fails with status %s\n", in TestUNumberingSystem()
2446 numsys, myErrorName(status)); in TestUNumberingSystem()
2455 log_data_err("unumsys_openAvailableNames fails with status %s\n", myErrorName(status)); in TestUNumberingSystem()
2517 UErrorCode status = U_ZERO_ERROR; in TestCurrencyIsoPluralFormat() local
2523 UNumberFormat* unumFmt = unum_open(style, NULL, 0, localeString, NULL, &status); in TestCurrencyIsoPluralFormat()
2524 if (U_FAILURE(status)) { in TestCurrencyIsoPluralFormat()
2525 …_err("FAIL: unum_open, locale %s, style %d - %s\n", localeString, (int)style, myErrorName(status)); in TestCurrencyIsoPluralFormat()
2529 unum_setTextAttribute(unumFmt, UNUM_CURRENCY_CODE, currencyCode, 3, &status); in TestCurrencyIsoPluralFormat()
2530 if (U_FAILURE(status)) { in TestCurrencyIsoPluralFormat()
2533 ulenRes = unum_formatDouble(unumFmt, numberToBeFormat, ubufResult, kUBufMax, NULL, &status); in TestCurrencyIsoPluralFormat()
2534 if (U_FAILURE(status)) { in TestCurrencyIsoPluralFormat()
2535 …ble, locale %s, UNUM_CURRENCY_CODE %s - %s\n", localeString, currencyISOCode, myErrorName(status)); in TestCurrencyIsoPluralFormat()
2569 UErrorCode status = U_ZERO_ERROR; in TestContext() local
2572 UNumberFormat *unum = unum_open(UNUM_SPELLOUT, NULL, 0, "en", NULL, &status); in TestContext()
2573 if ( U_SUCCESS(status) ) { in TestContext()
2574 UDisplayContext context = unum_getContext(unum, UDISPCTX_TYPE_CAPITALIZATION, &status); in TestContext()
2575 if ( U_FAILURE(status) || context != UDISPCTX_CAPITALIZATION_NONE) { in TestContext()
2577 status = U_ZERO_ERROR; in TestContext()
2579 unum_setContext(unum, UDISPCTX_CAPITALIZATION_FOR_STANDALONE, &status); in TestContext()
2580 context = unum_getContext(unum, UDISPCTX_TYPE_CAPITALIZATION, &status); in TestContext()
2581 if ( U_FAILURE(status) || context != UDISPCTX_CAPITALIZATION_FOR_STANDALONE) { in TestContext()
2586 log_data_err("unum_open UNUM_SPELLOUT for en fails with status %s\n", myErrorName(status)); in TestContext()
2593 status = U_ZERO_ERROR; in TestContext()
2594 unum = unum_open(itemPtr->style, NULL, 0, itemPtr->locale, NULL, &status); in TestContext()
2595 if (U_FAILURE(status)) { in TestContext()
2597 itemPtr->locale, (int)itemPtr->style, myErrorName(status)); in TestContext()
2600 unum_setContext(unum, itemPtr->context, &status); in TestContext()
2601 ulenRes = unum_formatDouble(unum, 123.45, ubufResult, kUBufMax, NULL, &status); in TestContext()
2602 if (U_FAILURE(status)) { in TestContext()
2604 … itemPtr->locale, (int)itemPtr->style, (int)itemPtr->context, myErrorName(status)); in TestContext()
2643 UErrorCode status = U_ZERO_ERROR; in TestCurrencyUsage() local
2650 unumFmt = unum_open(style, NULL, 0, localeString, NULL, &status); in TestCurrencyUsage()
2651 if (U_FAILURE(status)) { in TestCurrencyUsage()
2653 localeString, (int)style, myErrorName(status)); in TestCurrencyUsage()
2680 unum_setTextAttribute(unumFmt, UNUM_CURRENCY_CODE, currencyCode, 3, &status); in TestCurrencyUsage()
2681 assertSuccess("num_setTextAttribute()", &status); in TestCurrencyUsage()
2684 &pos, &status); in TestCurrencyUsage()
2685 assertSuccess("num_formatDouble()", &status); in TestCurrencyUsage()
2715 UErrorCode status = U_ZERO_ERROR; in TestCurrFmtNegSameAsPositive() local
2716 UNumberFormat* unumfmt = unum_open(UNUM_CURRENCY, NULL, 0, "en_US", NULL, &status); in TestCurrFmtNegSameAsPositive()
2717 if ( U_SUCCESS(status) ) { in TestCurrFmtNegSameAsPositive()
2718 unum_applyPattern(unumfmt, FALSE, currFmtNegSameAsPos, -1, NULL, &status); in TestCurrFmtNegSameAsPositive()
2719 if (U_SUCCESS(status)) { in TestCurrFmtNegSameAsPositive()
2721 int32_t ulen = unum_toPattern(unumfmt, FALSE, ubuf, kUBufSize, &status); in TestCurrFmtNegSameAsPositive()
2722 if (U_FAILURE(status)) { in TestCurrFmtNegSameAsPositive()
2723 log_err("unum_toPattern fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2727 unum_setSymbol(unumfmt, UNUM_MINUS_SIGN_SYMBOL, emptyString, 0, &status); in TestCurrFmtNegSameAsPositive()
2728 if (U_SUCCESS(status)) { in TestCurrFmtNegSameAsPositive()
2729 ulen = unum_formatDouble(unumfmt, -100.0, ubuf, kUBufSize, NULL, &status); in TestCurrFmtNegSameAsPositive()
2730 if (U_FAILURE(status)) { in TestCurrFmtNegSameAsPositive()
2731 log_err("unum_formatDouble fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2736 log_err("unum_setSymbol fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2739 log_err("unum_applyPattern fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2743 … log_data_err("unum_open UNUM_CURRENCY for en_US fails with status %s\n", myErrorName(status)); in TestCurrFmtNegSameAsPositive()
2900 UErrorCode status = U_ZERO_ERROR; in TestVariousStylesAndAttributes() local
2901 … UNumberFormat * unum = unum_open(lsaTestPtr->style, NULL, 0, lsaTestPtr->locale, NULL, &status); in TestVariousStylesAndAttributes()
2902 if ( U_FAILURE(status) ) { in TestVariousStylesAndAttributes()
2903 …style %d, locale %s: error %s\n", (int)lsaTestPtr->style, lsaTestPtr->locale, u_errorName(status)); in TestVariousStylesAndAttributes()
2918 status = U_ZERO_ERROR; in TestVariousStylesAndAttributes()
2920 ugetlen = unum_formatDouble(unum, veItemPtr->value, uget, kUBufSize, NULL, &status); in TestVariousStylesAndAttributes()
2921 if ( U_FAILURE(status) ) { in TestVariousStylesAndAttributes()
2923 …aTestPtr->style, lsaTestPtr->locale, lsaTestPtr->attribute, veItemPtr->value, u_errorName(status)); in TestVariousStylesAndAttributes()
2927 u_strToUTF8(bexp, kBBufSize, NULL, uexp, uexplen, &status); in TestVariousStylesAndAttributes()
2928 u_strToUTF8(bget, kBBufSize, NULL, uget, ugetlen, &status); in TestVariousStylesAndAttributes()
2942 UErrorCode status = U_ZERO_ERROR; in TestParseCurrPatternWithDecStyle() local
2943 UNumberFormat *unumfmt = unum_open(UNUM_DECIMAL, NULL, 0, "en_US", NULL, &status); in TestParseCurrPatternWithDecStyle()
2944 if (U_FAILURE(status)) { in TestParseCurrPatternWithDecStyle()
2945 …_data_err("unum_open DECIMAL failed for en_US: %s (Are you missing data?)\n", u_errorName(status)); in TestParseCurrPatternWithDecStyle()
2947 unum_applyPattern(unumfmt, FALSE, currpat, -1, NULL, &status); in TestParseCurrPatternWithDecStyle()
2948 if (U_FAILURE(status)) { in TestParseCurrPatternWithDecStyle()
2949 log_err_status(status, "unum_applyPattern failed: %s\n", u_errorName(status)); in TestParseCurrPatternWithDecStyle()
2952 double value = unum_parseDouble(unumfmt, parsetxt, -1, &pos, &status); in TestParseCurrPatternWithDecStyle()
2953 if (U_SUCCESS(status)) { in TestParseCurrPatternWithDecStyle()
2954 …log_err_status(status, "unum_parseDouble expected to fail but got status %s, value %f\n", u_errorN… in TestParseCurrPatternWithDecStyle()
3022 UErrorCode status = U_ZERO_ERROR; in TestFormatForFields() local
3023 UFieldPositionIterator* fpositer = ufieldpositer_open(&status); in TestFormatForFields()
3024 if ( U_FAILURE(status) ) { in TestFormatForFields()
3025 log_err("ufieldpositer_open fails, status %s\n", u_errorName(status)); in TestFormatForFields()
3030 status = U_ZERO_ERROR; in TestFormatForFields()
3032 unum_open(itemPtr->style, patNoFields, -1, itemPtr->locale, NULL, &status): in TestFormatForFields()
3033 unum_open(itemPtr->style, NULL, 0, itemPtr->locale, NULL, &status); in TestFormatForFields()
3034 if ( U_FAILURE(status) ) { in TestFormatForFields()
3035 … fails for locale %s, style %d: status %s (Are you missing data?)\n", itemPtr->locale, itemPtr->st… in TestFormatForFields()
3038 …nt32_t ulen = unum_formatDoubleForFields(unum, itemPtr->value, ubuf, kUBufSize, fpositer, &status); in TestFormatForFields()
3039 if ( U_FAILURE(status) ) { in TestFormatForFields()
3040 …bleForFields fails for locale %s, style %d: status %s\n", itemPtr->locale, itemPtr->style, u_error… in TestFormatForFields()
3069 UErrorCode status = U_ZERO_ERROR; in Test12052_NullPointer() local
3072 UNumberFormat *theFormatter = unum_open(UNUM_CURRENCY, NULL, 0, "en_US", NULL, &status); in Test12052_NullPointer()
3073 if (!assertSuccessCheck("unum_open() failed", &status, TRUE)) { return; } in Test12052_NullPointer()
3074 status = U_ZERO_ERROR; in Test12052_NullPointer()
3077 unum_parseDoubleCurrency(theFormatter, input, -1, &pos, currency, &status); in Test12052_NullPointer()
3078 assertEquals("should fail gracefully", "U_PARSE_ERROR", u_errorName(status)); in Test12052_NullPointer()