Lines Matching full:status
40 UErrorCode status = U_ZERO_ERROR; in runIndexedTest() local
42 Locale::setDefault(Locale::getEnglish(), status); in runIndexedTest()
43 if(U_FAILURE(status)) { in runIndexedTest()
47 Locale::setDefault(saveLocale, status); in runIndexedTest()
108 UErrorCode status = U_ZERO_ERROR; in testAPI() local
114 DecimalFormat def(status); in testAPI()
115 if(U_FAILURE(status)) { in testAPI()
116 … errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status)); in testAPI()
121 status = U_ZERO_ERROR; in testAPI()
122 DecimalFormat noGrouping("###0.##", status); in testAPI()
129 status = U_ZERO_ERROR; in testAPI()
131 DecimalFormat df("0", {"en", status}, status); in testAPI()
143 DecimalFormat df("#,##0", {"en", status}, status); in testAPI()
156 status = U_ZERO_ERROR; in testAPI()
158 DecimalFormat pat(pattern, status); in testAPI()
159 if(U_FAILURE(status)) { in testAPI()
164 status = U_ZERO_ERROR; in testAPI()
165 DecimalFormatSymbols *symbols = new DecimalFormatSymbols(Locale::getFrench(), status); in testAPI()
166 if(U_FAILURE(status)) { in testAPI()
171 status = U_ZERO_ERROR; in testAPI()
172 DecimalFormat cust1(pattern, symbols, status); in testAPI()
173 if(U_FAILURE(status)) { in testAPI()
177 status = U_ZERO_ERROR; in testAPI()
178 DecimalFormat cust2(pattern, *symbols, status); in testAPI()
179 if(U_FAILURE(status)) { in testAPI()
222 status = U_ZERO_ERROR; in testAPI()
223 res3 = cust1.format(fD, res3, pos3, status); in testAPI()
224 if(U_FAILURE(status)) { in testAPI()
229 status = U_ZERO_ERROR; in testAPI()
230 res4 = cust2.format(fL, res4, pos4, status); in testAPI()
231 if(U_FAILURE(status)) { in testAPI()
244 status = U_ZERO_ERROR; in testAPI()
245 pat.applyPattern(patt, status); in testAPI()
246 if(U_FAILURE(status)) { in testAPI()
255 status = U_ZERO_ERROR; in testAPI()
256 pat.parse(text, result2, status); in testAPI()
257 if(U_FAILURE(status)) { in testAPI()
377 pat = DecimalFormat(status); // reset in testAPI()
381 status = U_ZERO_ERROR; in testAPI()
382 pat.applyPattern(p1, status); in testAPI()
383 if(U_FAILURE(status)) { in testAPI()
384 errln((UnicodeString)"ERROR: applyPattern() failed with " + (int32_t) status); in testAPI()
401 status = U_ZERO_ERROR; in testAPI()
402 pat.applyLocalizedPattern(p2, status); in testAPI()
403 if(U_FAILURE(status)) { in testAPI()
404 errln((UnicodeString)"ERROR: applyPattern() failed with " + (int32_t) status); in testAPI()
411 status = U_ZERO_ERROR; in testAPI()
413 pat.applyLocalizedPattern(p2, pe, status); in testAPI()
414 if(U_FAILURE(status)) { in testAPI()
415 … errln((UnicodeString)"ERROR: applyPattern((with ParseError)) failed with " + (int32_t) status); in testAPI()
434 status = U_ZERO_ERROR; in testAPI()
435 NumberFormat *test = new DecimalFormat(status); in testAPI()
436 if(U_FAILURE(status)) { in testAPI()
448 UErrorCode status = U_ZERO_ERROR; in TestCurrencyPluralInfo() local
450 CurrencyPluralInfo *cpi = new CurrencyPluralInfo(status); in TestCurrencyPluralInfo()
451 if(U_FAILURE(status)) { in TestCurrencyPluralInfo()
461 cpi->setCurrencyPluralPattern("","",status); in TestCurrencyPluralInfo()
462 if(U_FAILURE(status)) { in TestCurrencyPluralInfo()
466 cpi->setLocale(Locale::getCanada(), status); in TestCurrencyPluralInfo()
467 if(U_FAILURE(status)) { in TestCurrencyPluralInfo()
471 cpi->setPluralRules("",status); in TestCurrencyPluralInfo()
472 if(U_FAILURE(status)) { in TestCurrencyPluralInfo()
476 DecimalFormat *df = new DecimalFormat(status); in TestCurrencyPluralInfo()
477 if(U_FAILURE(status)) { in TestCurrencyPluralInfo()
478 errcheckln(status, "ERROR: Could not create DecimalFormat - %s", u_errorName(status)); in TestCurrencyPluralInfo()
493 UErrorCode status = U_ZERO_ERROR; in testRounding() local
505 DecimalFormat pat(status); in testRounding()
506 if(U_FAILURE(status)) { in testRounding()
507 … errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status)); in testRounding()
556 UErrorCode status = U_ZERO_ERROR; in testRoundingInc() local
557 DecimalFormat pat(UnicodeString("#,##0.00"),status); in testRoundingInc()
558 if(U_FAILURE(status)) { in testRoundingInc()
559 … errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status)); in testRoundingInc()
602 UErrorCode status = U_ZERO_ERROR; in TestScale() local
603 DecimalFormat pat(status); in TestScale()
604 if(U_FAILURE(status)) { in TestScale()
605 … errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status)); in TestScale()
617 pat.applyPattern(percentPattern,status); in TestScale()
621 pat.setAttribute(UNUM_SCALE, testData[i].inputScale,status); in TestScale()
625 assertEquals("", testData[i].inputScale, pat.getAttribute(UNUM_SCALE, status)); in TestScale()
643 UErrorCode status = U_ZERO_ERROR; in TestFixedDecimal() local
645 LocalPointer<DecimalFormat> df(new DecimalFormat("###", status), status); in TestFixedDecimal()
646 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
647 if (status == U_MISSING_RESOURCE_ERROR) { in TestFixedDecimal()
651 df->formatToDecimalQuantity(44, fd, status); in TestFixedDecimal()
652 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
657 df->formatToDecimalQuantity(-44, fd, status); in TestFixedDecimal()
658 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
663 df.adoptInsteadAndCheckErrorCode(new DecimalFormat("###.00##", status), status); in TestFixedDecimal()
664 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
665 df->formatToDecimalQuantity(123.456, fd, status); in TestFixedDecimal()
666 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
675 df->formatToDecimalQuantity(-123.456, fd, status); in TestFixedDecimal()
676 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
687 df->formatToDecimalQuantity(123.456, fd, status); in TestFixedDecimal()
688 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
697 df->formatToDecimalQuantity(-123.456, fd, status); in TestFixedDecimal()
698 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
710 df->formatToDecimalQuantity(123.456, fd, status); in TestFixedDecimal()
711 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
720 df->formatToDecimalQuantity(-123.456, fd, status); in TestFixedDecimal()
721 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
734 df->formatToDecimalQuantity(30.0, fd, status); in TestFixedDecimal()
735 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
744 df->formatToDecimalQuantity(-30.0, fd, status); in TestFixedDecimal()
745 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
754 df.adoptInsteadAndCheckErrorCode(new DecimalFormat("###", status), status); in TestFixedDecimal()
755 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
756 df->formatToDecimalQuantity(123.456, fd, status); in TestFixedDecimal()
757 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
765 df.adoptInsteadAndCheckErrorCode(new DecimalFormat("###.0", status), status); in TestFixedDecimal()
766 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
767 df->formatToDecimalQuantity(123.01, fd, status); in TestFixedDecimal()
768 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
776 df.adoptInsteadAndCheckErrorCode(new DecimalFormat("###.0", status), status); in TestFixedDecimal()
777 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
778 df->formatToDecimalQuantity(123.06, fd, status); in TestFixedDecimal()
779 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
787 …df.adoptInsteadAndCheckErrorCode(new DecimalFormat("@@@@@", status), status); // Significant Digi… in TestFixedDecimal()
788 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
789 df->formatToDecimalQuantity(123, fd, status); in TestFixedDecimal()
790 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
798 …df.adoptInsteadAndCheckErrorCode(new DecimalFormat("@@@@@", status), status); // Significant Digi… in TestFixedDecimal()
799 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
800 df->formatToDecimalQuantity(1.23, fd, status); in TestFixedDecimal()
801 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
809 df->formatToDecimalQuantity(uprv_getInfinity(), fd, status); in TestFixedDecimal()
810 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
812 df->formatToDecimalQuantity(0.0, fd, status); in TestFixedDecimal()
814 df->formatToDecimalQuantity(uprv_getNaN(), fd, status); in TestFixedDecimal()
816 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
822 new DecimalFormat("#####################0.00####################", status), status); in TestFixedDecimal()
823 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
824 Formattable fable("12.34", status); in TestFixedDecimal()
825 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
826 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
827 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
835 fable.setDecimalNumber("12.3456789012345678900123456789", status); in TestFixedDecimal()
836 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
837 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
838 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
847 fable.setDecimalNumber("123456789012345678901234567890.123456789012345678901234567890", status); in TestFixedDecimal()
848 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
849 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
850 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
859 fable.setDecimalNumber("1.0000000000000000000012", status); in TestFixedDecimal()
860 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
861 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
862 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
871 fable.setDecimalNumber("1.000000000000000000000012", status); in TestFixedDecimal()
872 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
873 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
874 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
883 fable.setDecimalNumber("-1.0000000000000000000012", status); in TestFixedDecimal()
884 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
885 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
886 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
895 fable.setDecimalNumber("1000000000000000000000.3", status); in TestFixedDecimal()
896 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
897 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
898 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
906 fable.setDecimalNumber("1000000000000000050000.3", status); in TestFixedDecimal()
907 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
908 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
909 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
919 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
920 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
921 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
930 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
931 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
932 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
941 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
942 df->formatToDecimalQuantity(fable, fd, status); in TestFixedDecimal()
943 TEST_ASSERT_STATUS(status); in TestFixedDecimal()
965 UErrorCode status = U_ZERO_ERROR; in TestBadFastpath() local
967 LocalPointer<DecimalFormat> df(new DecimalFormat("###", status), status); in TestBadFastpath()
968 if (U_FAILURE(status)) { in TestBadFastpath()
969 dataerrln("Error creating new DecimalFormat - %s", u_errorName(status)); in TestBadFastpath()
986 UErrorCode status = U_ZERO_ERROR; in TestRequiredDecimalPoint() local
992 LocalPointer<DecimalFormat> df(new DecimalFormat(pat1, status), status); in TestRequiredDecimalPoint()
993 if (U_FAILURE(status)) { in TestRequiredDecimalPoint()
994 dataerrln("Error creating new DecimalFormat - %s", u_errorName(status)); in TestRequiredDecimalPoint()
998 status = U_ZERO_ERROR; in TestRequiredDecimalPoint()
999 df->applyPattern(pat1, status); in TestRequiredDecimalPoint()
1000 if(U_FAILURE(status)) { in TestRequiredDecimalPoint()
1003 df->parse(text, result1, status); in TestRequiredDecimalPoint()
1004 if(U_FAILURE(status)) { in TestRequiredDecimalPoint()
1008 df->parse(text, result1, status); in TestRequiredDecimalPoint()
1009 if(U_SUCCESS(status)) { in TestRequiredDecimalPoint()
1014 status = U_ZERO_ERROR; in TestRequiredDecimalPoint()
1015 df->applyPattern(pat2, status); in TestRequiredDecimalPoint()
1017 if(U_FAILURE(status)) { in TestRequiredDecimalPoint()
1020 df->parse(text, result1, status); in TestRequiredDecimalPoint()
1021 if(U_FAILURE(status)) { in TestRequiredDecimalPoint()
1022 errln((UnicodeString)"ERROR: parse(2) failed - " + u_errorName(status)); in TestRequiredDecimalPoint()
1025 df->parse(text, result1, status); in TestRequiredDecimalPoint()
1026 if(U_SUCCESS(status)) { in TestRequiredDecimalPoint()
1040 UErrorCode status = U_ZERO_ERROR; in testErrorCode() local
1043 DecimalFormatSymbols symbols(Locale::getUS(), status); in testErrorCode()
1044 assertSuccess(WHERE, status); in testErrorCode()
1047 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1048 DecimalFormat df(status); in testErrorCode()
1049 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1052 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1053 DecimalFormat df(pattern, status); in testErrorCode()
1054 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1057 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1058 DecimalFormat df(pattern, new DecimalFormatSymbols(symbols), status); in testErrorCode()
1059 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1062 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1063 … DecimalFormat df(pattern, new DecimalFormatSymbols(symbols), UNUM_DECIMAL_COMPACT_LONG, status); in testErrorCode()
1064 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1067 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1068 DecimalFormat df(pattern, new DecimalFormatSymbols(symbols), pe, status); in testErrorCode()
1069 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1072 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1073 DecimalFormat df(pattern, symbols ,status); in testErrorCode()
1074 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1080 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1081 DecimalFormat dfBogus(status); in testErrorCode()
1082 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1084 status = U_ZERO_ERROR; in testErrorCode()
1085 DecimalFormat dfGood(pattern, new DecimalFormatSymbols(symbols), status); in testErrorCode()
1086 assertSuccess(WHERE, status); in testErrorCode()
1089 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1090 df->setAttribute(UNUM_PARSE_INT_ONLY, 0, status); in testErrorCode()
1091 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1093 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1094 df->getAttribute(UNUM_MAX_FRACTION_DIGITS, status); in testErrorCode()
1095 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1097 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1100 df->format(1.2, dest, fp, status); in testErrorCode()
1101 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1103 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1104 df->format(1.2, dest, nullptr, status); in testErrorCode()
1105 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1107 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1108 df->format((int32_t)666, dest, nullptr, status); in testErrorCode()
1109 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1111 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1112 df->format((int64_t)666, dest, nullptr, status); in testErrorCode()
1113 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1115 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1116 df->format(StringPiece("3.1415926535897932384626"), dest, nullptr, status); in testErrorCode()
1117 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1119 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1120 df->applyPattern(pattern, status); in testErrorCode()
1121 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1123 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1124 df->applyLocalizedPattern(pattern, pe, status); in testErrorCode()
1125 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1127 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1128 df->applyLocalizedPattern(pattern, status); in testErrorCode()
1129 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1131 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1132 df->setCurrency(u"USD", status); in testErrorCode()
1133 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()
1135 status = U_INTERNAL_PROGRAM_ERROR; in testErrorCode()
1136 df->setCurrencyUsage(UCURR_USAGE_CASH, &status); in testErrorCode()
1137 assertEquals(WHERE, U_INTERNAL_PROGRAM_ERROR, status); in testErrorCode()