Home
last modified time | relevance | path

Searched refs:format (Results 1 – 25 of 296) sorted by relevance

12345678910>>...12

/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/
DDecimalFormatTest.java50 df.format(Double.NaN); in test_setNan_emptyString()
79 DecimalFormat format = new DecimalFormat(); in test_parse_integerOnly() local
80 assertFalse("Default value of isParseIntegerOnly is true", format.isParseIntegerOnly()); in test_parse_integerOnly()
82 format.setParseIntegerOnly(true); in test_parse_integerOnly()
83 assertTrue(format.isParseIntegerOnly()); in test_parse_integerOnly()
84 Number result = format.parse("123.123"); in test_parse_integerOnly()
87 format.setParseIntegerOnly(false); in test_parse_integerOnly()
88 assertFalse(format.isParseIntegerOnly()); in test_parse_integerOnly()
89 result = format.parse("123.123"); in test_parse_integerOnly()
399 form.format(12.3); in testMaximumFractionDigits_getAndSet()
[all …]
DNumberFormatTest.java38 DecimalFormat format = (DecimalFormat) NumberFormat in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition() local
42 out = format.format(new Long(Long.MAX_VALUE), new StringBuffer(), pos); in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
47 out = format.format(new Long(Long.MIN_VALUE), new StringBuffer(), pos); in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
52 out = format.format(new java.math.BigInteger(String in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
58 out = format.format(new java.math.BigInteger(String in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
67 out = format.format(big, new StringBuffer(), pos); in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
74 out = format.format(big, new StringBuffer(), pos); in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
79 out = format.format(new java.math.BigDecimal("51.348"), in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
84 out = format.format(new java.math.BigDecimal("51"), new StringBuffer(), in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
89 format.format(this, new StringBuffer(), pos); in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition()
[all …]
DSimpleDateFormatTest.java53 assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class); in test_Constructor()
63 assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class); in test_ConstructorLjava_lang_String()
91 assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class); in test_ConstructorLjava_lang_StringLjava_text_DateFormatSymbols()
114 assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class); in test_ConstructorLjava_lang_StringLjava_util_Locale()
206 SimpleDateFormat format = (SimpleDateFormat) DateFormat.getInstance(); in test_equalsLjava_lang_Object() local
207 SimpleDateFormat clone = (SimpleDateFormat) format.clone(); in test_equalsLjava_lang_Object()
208 assertTrue("clone not equal", format.equals(clone)); in test_equalsLjava_lang_Object()
209 format.format(new Date()); in test_equalsLjava_lang_Object()
210 assertTrue("not equal after format", format.equals(clone)); in test_equalsLjava_lang_Object()
216 df.format(new Date()); in test_equals_afterFormat()
[all …]
DMessageFormatTest.java50 private void checkSerialization(MessageFormat format) { in checkSerialization() argument
54 out.writeObject(format); in checkSerialization()
59 assertTrue("Not equal: " + format.toPattern(), format.equals(read)); in checkSerialization()
61 fail("Format: " + format.toPattern() in checkSerialization()
64 fail("Format: " + format.toPattern() in checkSerialization()
157 String result = mf.format(objs); in test_parseObjectLjava_lang_StringLjavajava_text_ParsePosition()
263 String sFormat = MessageFormat.format(pattern, (Object[]) args); in test_formatLjava_lang_StringLjava_lang_Object()
271 sFormat = MessageFormat.format(pattern, args_); in test_formatLjava_lang_StringLjava_lang_Object()
278 MessageFormat.format(null, args); in test_formatLjava_lang_StringLjava_lang_Object()
284 MessageFormat.format("Invalid {1,foobar} format descriptor!", new Object[] {iInteger} ); in test_formatLjava_lang_StringLjava_lang_Object()
[all …]
DChoiceFormatTest.java51 formattedString = cf.format(Double.NEGATIVE_INFINITY); in test_Constructor$D$Ljava_lang_String()
54 formattedString = cf.format(0.5d); in test_Constructor$D$Ljava_lang_String()
57 formattedString = cf.format(1d); in test_Constructor$D$Ljava_lang_String()
60 formattedString = cf.format(1.5d); in test_Constructor$D$Ljava_lang_String()
63 formattedString = cf.format(2d); in test_Constructor$D$Ljava_lang_String()
66 formattedString = cf.format(2.5d); in test_Constructor$D$Ljava_lang_String()
69 formattedString = cf.format(3d); in test_Constructor$D$Ljava_lang_String()
72 formattedString = cf.format(4d); in test_Constructor$D$Ljava_lang_String()
75 formattedString = cf.format(5d); in test_Constructor$D$Ljava_lang_String()
78 formattedString = cf.format(5.5d); in test_Constructor$D$Ljava_lang_String()
[all …]
DSupport_SimpleDateFormat.java54 …SimpleDateFormat format = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.DEFAULT, Locale… in t_format_with_FieldPosition() local
55 format.setTimeZone(tz); in t_format_with_FieldPosition()
58 format.applyPattern("G GGGG y yy yyyy M MM MMM MMMM d dd ddd " + in t_format_with_FieldPosition()
75 t_FormatWithField(0, format, date, null, Field.ERA, 0, 2); in t_format_with_FieldPosition()
76 t_FormatWithField(1, format, date, null, Field.YEAR, 6, 10); in t_format_with_FieldPosition()
77 t_FormatWithField(2, format, date, null, Field.MONTH, 19, 20); in t_format_with_FieldPosition()
78 t_FormatWithField(3, format, date, null, Field.DAY_OF_MONTH, 38, 40); in t_format_with_FieldPosition()
79 t_FormatWithField(4, format, date, null, Field.HOUR_OF_DAY1, 48, 50); in t_format_with_FieldPosition()
80 t_FormatWithField(5, format, date, null, Field.HOUR_OF_DAY0, 58, 60); in t_format_with_FieldPosition()
81 t_FormatWithField(6, format, date, null, Field.HOUR1, 68, 69); in t_format_with_FieldPosition()
[all …]
DDateFormatTest.java37 DateFormat format = DateFormat.getInstance(); in test_clone() local
38 DateFormat clone = (DateFormat) format.clone(); in test_clone()
39 assertTrue("Clone not equal", format.equals(clone)); in test_clone()
41 assertTrue("Clone shares NumberFormat", !format.equals(clone)); in test_clone()
71 DateFormat format = DateFormat.getInstance(); in test_getCalendar() local
72 Calendar cal1 = format.getCalendar(); in test_getCalendar()
73 Calendar cal2 = format.getCalendar(); in test_getCalendar()
87 f2.format(new Date()).getClass() == String.class); in test_getDateInstance()
105 f2.format(new Date()).getClass() == String.class); in test_getDateInstanceI()
114 f2.format(new Date()).getClass() == String.class); in test_getDateInstanceI()
[all …]
/libcore/luni/src/test/java/libcore/java/text/
DChoiceFormatTest.java23 ChoiceFormat format = new ChoiceFormat(limits, formats); in testConstructor_doubleArray_StringArray() local
25 verifyChoiceFormatCopiesSuppliedArrays(format); in testConstructor_doubleArray_StringArray()
29 ChoiceFormat format = new ChoiceFormat(new double[] { 0 }, new String[] { "" }); in testSetChoices() local
30 assertEquals("", format.format(1.4)); in testSetChoices()
33 format.setChoices(limits, formats); in testSetChoices()
35 verifyChoiceFormatCopiesSuppliedArrays(format); in testSetChoices()
38 private void verifyChoiceFormatCopiesSuppliedArrays(ChoiceFormat format) { in verifyChoiceFormatCopiesSuppliedArrays() argument
39 assertEquals("one", format.format(1.4)); in verifyChoiceFormatCopiesSuppliedArrays()
44 "one", format.format(1.4)); in verifyChoiceFormatCopiesSuppliedArrays()
49 "one", format.format(1.4)); in verifyChoiceFormatCopiesSuppliedArrays()
[all …]
DOldNumberFormatTest.java32 DecimalFormat format = (DecimalFormat) NumberFormat.getIntegerInstance(Locale.US); in test_getIntegerInstanceLjava_util_Locale() local
33 assertEquals("#,##0", format.toPattern()); in test_getIntegerInstanceLjava_util_Locale()
34 assertEquals("-36", format.format(-35.76)); in test_getIntegerInstanceLjava_util_Locale()
35 assertEquals(new Long(-36), format.parse("-36")); in test_getIntegerInstanceLjava_util_Locale()
36 assertEquals(new Long(-36), format.parseObject("-36")); in test_getIntegerInstanceLjava_util_Locale()
37 assertEquals(0, format.getMaximumFractionDigits()); in test_getIntegerInstanceLjava_util_Locale()
38 assertTrue(format.isParseIntegerOnly()); in test_getIntegerInstanceLjava_util_Locale()
42 format = (DecimalFormat) NumberFormat.getIntegerInstance(chLocale); in test_getIntegerInstanceLjava_util_Locale()
43 assertEquals("#,##0", format.toPattern()); in test_getIntegerInstanceLjava_util_Locale()
44 assertEquals("-36", format.format(-35.76)); in test_getIntegerInstanceLjava_util_Locale()
[all …]
DNumberFormatTest.java43 assertEquals("123", nf.format(new MyNumber())); in test_custom_Number_gets_longValue()
50 public StringBuffer format(double value, StringBuffer b, FieldPosition f) { in test_small_BigInteger_gets_longValue() method in NumberFormatTest.MyNumberFormat
54 public StringBuffer format(long value, StringBuffer b, FieldPosition f) { in test_small_BigInteger_gets_longValue() method in NumberFormatTest.MyNumberFormat
63 assertEquals("long", nf.format(BigInteger.valueOf(Long.MAX_VALUE))); in test_small_BigInteger_gets_longValue()
64 assertEquals("double", nf.format(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE))); in test_small_BigInteger_gets_longValue()
65 assertEquals("long", nf.format(BigInteger.valueOf(Long.MIN_VALUE))); in test_small_BigInteger_gets_longValue()
66 … assertEquals("double", nf.format(BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.ONE))); in test_small_BigInteger_gets_longValue()
84 assertEquals("١٬٢٣٤٬٥٦٧٬٨٩٠", nf.format(1234567890)); in test_numberLocalization()
92 assertEquals("15%", nf.format(0.15)); in test_10333()
93 assertEquals("1,500%", nf.format(15)); in test_10333()
[all …]
DOldDateFormatTest.java46 public StringBuffer format(Date date, StringBuffer toAppendTo, in format() method in OldDateFormatTest.MockDateFormat
71 DateFormat format = DateFormat.getInstance(); in test_equalsLjava_lang_Object() local
72 DateFormat clone = (DateFormat) format.clone(); in test_equalsLjava_lang_Object()
73 assertTrue("Clone and parent are not equaled", format.equals(clone)); in test_equalsLjava_lang_Object()
76 format.setCalendar(Calendar.getInstance()); in test_equalsLjava_lang_Object()
77 assertTrue("Clone and parent are not equaled", format.equals(clone)); in test_equalsLjava_lang_Object()
91 DateFormat format = DateFormat.getDateTimeInstance( in test_formatLjava_util_Date() local
94 String dtf = format.format(current); in test_formatLjava_util_Date()
96 assertTrue("Incorrect date format", sdf.format(current).equals(dtf)); in test_formatLjava_util_Date()
111 DateFormat format = DateFormat.getDateTimeInstance( in test_formatLjava_lang_ObjectLjava_lang_StringBufferLjava_text_FieldPosition() local
[all …]
DDecimalFormatTest.java34 assertEquals("1E4", df.format(12345.)); in test_exponentSeparator()
39 assertEquals("1-useless-api-4", df.format(12345.)); in test_exponentSeparator()
46 assertEquals("-0", df.format(-0.2)); in test_setMaximumFractionDigitsAffectsRoundingMode()
48 assertEquals("-0.2", df.format(-0.2)); in test_setMaximumFractionDigitsAffectsRoundingMode()
59 assertEquals(309, numberFormat.format(123).length()); in test_setMaximumIntegerDigits()
60 assertEquals(309, numberFormat.format(BigInteger.valueOf(123)).length()); in test_setMaximumIntegerDigits()
67 assertEquals("17%", pf.format(BigDecimal.valueOf(0.17))); in testBigDecimalBug1897917()
193 df.format(num, stringBuffer, fp); in assertFieldPosition()
203 df.format(num, stringBuffer, fp); in assertFieldPosition()
213 df.format(num, stringBuffer, fp); in assertFieldPosition()
[all …]
/libcore/ojluni/src/main/java/java/util/logging/
DFormatter.java62 public abstract String format(LogRecord record); in format() method in Formatter
114 String format = record.getMessage(); in formatMessage() local
118 format = catalog.getString(record.getMessage()); in formatMessage()
121 format = record.getMessage(); in formatMessage()
129 return format; in formatMessage()
136 if (format.indexOf("{0") >= 0 || format.indexOf("{1") >=0 || in formatMessage()
137 format.indexOf("{2") >=0|| format.indexOf("{3") >=0) { in formatMessage()
138 return java.text.MessageFormat.format(format, parameters); in formatMessage()
140 return format; in formatMessage()
144 return format; in formatMessage()
/libcore/benchmarks/src/benchmarks/
DImtConflictBenchmarkGen.py69 print(" C{0} c{0} = new C{0}();".format(i))
71 print(" callF{}(c{});".format(imt_size * j, i))
76 print(" public void timeConflictDepth{:02d}(int nreps) {{".format(i+1))
77 print(" C{0} c{0} = new C{0}();".format(i))
82 print(" callF{}(c{});".format(imt_size * (j % (i + 1)), i))
88 print(" public void callF{0}(I{1} i) {{ i.f{0}(); }}".format(imt_size*i, i))
92 interfaces = ", ".join(["I{}".format(j) for j in xrange(i+1)])
93 print(" static class C{} implements {} {{}}".format(i, interfaces))
97 print(" static interface I{} {{".format(i))
99 print(" default void f{}() {{}}".format(i*imt_size + j))
/libcore/support/src/test/java/tests/support/
DSupport_DecimalFormat.java42 DecimalFormat format = (DecimalFormat) NumberFormat in t_format_with_FieldPosition() local
47 t_FormatWithField(0, format, number, text, NumberFormat.Field.CURRENCY, in t_format_with_FieldPosition()
49 t_FormatWithField(1, format, number, text, NumberFormat.Field.INTEGER, in t_format_with_FieldPosition()
51 t_FormatWithField(2, format, number, text, in t_format_with_FieldPosition()
53 t_FormatWithField(3, format, number, text, in t_format_with_FieldPosition()
55 t_FormatWithField(4, format, number, text, NumberFormat.Field.FRACTION, in t_format_with_FieldPosition()
59 t_FormatWithField(5, format, number, text, NumberFormat.Field.SIGN, 0, in t_format_with_FieldPosition()
61 t_FormatWithField(6, format, number, text, NumberFormat.Field.EXPONENT, in t_format_with_FieldPosition()
63 t_FormatWithField(7, format, number, text, in t_format_with_FieldPosition()
65 t_FormatWithField(8, format, number, text, in t_format_with_FieldPosition()
[all …]
/libcore/benchmarks/src/benchmarks/regression/
DDecimalFormatBenchmark.java33 df.format(obj); in formatWithGrouping()
37 public static void format(String pattern, Object obj, int reps) { in format() method in DecimalFormatBenchmark
40 patternInstance.format(obj); in format()
44 public static void format(Object obj, int reps) { in format() method in DecimalFormatBenchmark
46 df.format(obj); in format()
59 dfCurrencyUS.format(obj); in formatCurrencyUS()
65 dfCurrencyFR.format(obj); in formatCurrencyFR()
86 format(BD10E3, reps); in time_formatBigDecimal10e3()
90 format(BD10E9, reps); in time_formatBigDecimal10e9()
94 format(BD10E100, reps); in time_formatBigDecimal10e100()
[all …]
/libcore/luni/src/test/java/libcore/java/util/
DOldFormatterTest.java50 assertEquals("aaa 111?", new Formatter().format("aaa %s?", ones).toString()); in test_Formattable()
51 … assertEquals("aaa 111 bbb 222?", new Formatter().format("aaa %s bbb %s?", ones, twos).toString()); in test_Formattable()
63 fLoc.format(Locale.US, "%f", val); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
64 fNoL.format("%f", val); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
69 fLoc.format(Locale.US, "%f", val); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
70 fNoL.format("%f", val); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
75 fLoc.format(Locale.US, "%f", val); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
76 fNoL.format("%f", val); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
81 fLoc.format(Locale.US, "%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
82 fNoL.format("%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
[all …]
/libcore/ojluni/src/main/java/java/security/
DKeyRep.java103 private String format; field in KeyRep
132 String format, byte[] encoded) { in KeyRep() argument
135 format == null || encoded == null) { in KeyRep()
141 this.format = format.toUpperCase(Locale.ENGLISH); in KeyRep()
171 if (type == Type.SECRET && RAW.equals(format)) { in readResolve()
173 } else if (type == Type.PUBLIC && X509.equals(format)) { in readResolve()
176 } else if (type == Type.PRIVATE && PKCS8.equals(format)) { in readResolve()
182 type + "/" + format); in readResolve()
191 "[" + format + "]"); in readResolve()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/
DFormatterTest.java83 formatter.format("CUSTOMIZED FORMAT FUNCTION" + " WIDTH: " in formatTo()
86 formatter.format("customized format function" + " width: " in formatTo()
710 f.format("%s%s", "1", "2"); in test_ioException()
722 f.format((String) null, "parameter"); in test_formatLjava_lang_String$Ljava_lang_Object_null()
729 f.format("hello", (Object[]) null); in test_formatLjava_lang_String$Ljava_lang_Object_null()
738 formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%11$s%10$s", "1", in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
743 formatter.format("%0$s", "hello"); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
748 formatter.format("%-1$s", "1", "2"); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
756 formatter.format("%$s", "hello", "2"); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
764 f.format("%", "string"); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
[all …]
/libcore/ojluni/src/test/java/time/test/java/time/format/
DTestReducedPrinter.java60 package test.java.time.format;
69 import java.time.format.DateTimeFormatter;
70 import java.time.format.DateTimeFormatterBuilder;
217 assertEquals(f.format(date), "09"); in test_minguoChrono_fixedWidth()
219 assertEquals(f.format(date), "10"); in test_minguoChrono_fixedWidth()
221 assertEquals(f.format(date), "99"); in test_minguoChrono_fixedWidth()
223 assertEquals(f.format(date), "00"); in test_minguoChrono_fixedWidth()
225 assertEquals(f.format(date), "09"); in test_minguoChrono_fixedWidth()
227 assertEquals(f.format(date), "10"); in test_minguoChrono_fixedWidth()
234 assertEquals(f.format(date), "109"); in test_minguoChrono_extendedWidth()
[all …]
/libcore/luni/src/test/java/libcore/highmemorytest/java/time/format/
DDateTimeFormatterTest.java16 package libcore.highmemorytest.java.time.format;
25 import java.time.format.DateTimeFormatter;
26 import java.time.format.FormatStyle;
63 .format(TEST_INSTANT); in test_format_allLocales()
68 .format(TEST_INSTANT); in test_format_allLocales()
73 .format(TEST_INSTANT); in test_format_allLocales()
93 .format(TEST_INSTANT); in test_format_allLocales_allChronologies()
99 .format(TEST_INSTANT); in test_format_allLocales_allChronologies()
105 .format(TEST_INSTANT); in test_format_allLocales_allChronologies()
/libcore/support/src/test/java/org/apache/harmony/security/tests/support/
DPrivateKeyStub.java36 String format = null; field in PrivateKeyStub
47 public PrivateKeyStub(String algorithm, String format, byte[] encoded) { in PrivateKeyStub() argument
49 this.format = format; in PrivateKeyStub()
66 return format; in getFormat()
DCertificateStub.java39 String format; field in CertificateStub
44 public CertificateStub(String format, Principal guarantor, Principal principal, PublicKey key){ in CertificateStub() argument
45 this.format = format; in CertificateStub()
76 return format; in getFormat()
/libcore/support/src/test/java/libcore/java/io/
DNullPrintStream.java36 public PrintStream format(String format, Object... args) { return this; } in format() method in NullPrintStream
37 public PrintStream format(Locale l, String format, Object... args) { return this; } in format() argument
38 public PrintStream printf(String format, Object... args) { return this; } in printf() argument
39 public PrintStream printf(Locale l, String format, Object... args) { return this; } in printf() argument
/libcore/luni/src/test/java/libcore/java/time/format/
DDateTimeFormatterBuilderTest.java16 package libcore.java.time.format;
26 import java.time.format.DateTimeFormatter;
27 import java.time.format.DateTimeFormatterBuilder;
47 assertEquals("<2000-12-31>", formatter.format(LocalDate.of(2000, Month.DECEMBER, 31))); in test_append_DateTimeFormatter()
56 formatter.format(ZonedDateTime.now(ZoneId.of("Europe/London")))); in test_appendZoneRegionId_format()
58 formatter.format(ZonedDateTime.now(ZoneId.of("UTC")))); in test_appendZoneRegionId_format()
67 formatter.format(OffsetDateTime.now(ZoneOffset.UTC)); in test_appendZoneRegionId_format_offset()

12345678910>>...12