LEFT | RIGHT |
(no file at all) | |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html#License | 2 // License & terms of use: http://www.unicode.org/copyright.html#License |
3 /* | 3 /* |
4 ******************************************************************************* | 4 ******************************************************************************* |
5 * Copyright (c) 2004-2014, International Business Machines | 5 * Copyright (c) 2004-2014, International Business Machines |
6 * Corporation and others. All Rights Reserved. | 6 * Corporation and others. All Rights Reserved. |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * | 8 * |
9 */ | 9 */ |
10 package com.ibm.icu.dev.test.serializable; | 10 package com.ibm.icu.dev.test.serializable; |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 return formats; | 1099 return formats; |
1100 } | 1100 } |
1101 | 1101 |
1102 @Override | 1102 @Override |
1103 public boolean hasSameBehavior(Object a, Object b) | 1103 public boolean hasSameBehavior(Object a, Object b) |
1104 { | 1104 { |
1105 NumberFormat format_a = (NumberFormat) a; | 1105 NumberFormat format_a = (NumberFormat) a; |
1106 NumberFormat format_b = (NumberFormat) b; | 1106 NumberFormat format_b = (NumberFormat) b; |
1107 double number = 1234.56; | 1107 double number = 1234.56; |
1108 | 1108 |
1109 return format_a.format(number).equals(format_b.format(number)); | 1109 String result_a = format_a.format(number); |
| 1110 String result_b = format_b.format(number); |
| 1111 boolean equal = result_a.equals(result_b); |
| 1112 if (!equal) { |
| 1113 System.out.println(format_a+" "+format_b); |
| 1114 System.out.println(result_a+" "+result_b); |
| 1115 } |
| 1116 return equal; |
1110 } | 1117 } |
1111 } | 1118 } |
1112 | 1119 |
1113 public static class DecimalFormatHandler extends NumberFormatHandler | 1120 public static class DecimalFormatHandler extends NumberFormatHandler |
1114 { | 1121 { |
1115 @Override | 1122 @Override |
1116 public Object[] getTestObjects() | 1123 public Object[] getTestObjects() |
1117 { | 1124 { |
1118 Locale locales[] = SerializableTestUtility.getLocales(); | 1125 Locale locales[] = SerializableTestUtility.getLocales(); |
1119 DecimalFormat formats[] = new DecimalFormat[locales.length]; | 1126 DecimalFormat formats[] = new DecimalFormat[locales.length]; |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 @Override | 1710 @Override |
1704 public boolean hasSameBehavior(Object a, Object b) | 1711 public boolean hasSameBehavior(Object a, Object b) |
1705 { | 1712 { |
1706 DecimalFormatSymbols dfs_a = (DecimalFormatSymbols) a; | 1713 DecimalFormatSymbols dfs_a = (DecimalFormatSymbols) a; |
1707 DecimalFormatSymbols dfs_b = (DecimalFormatSymbols) b; | 1714 DecimalFormatSymbols dfs_b = (DecimalFormatSymbols) b; |
1708 String strings_a[] = getStringSymbols(dfs_a); | 1715 String strings_a[] = getStringSymbols(dfs_a); |
1709 String strings_b[] = getStringSymbols(dfs_b); | 1716 String strings_b[] = getStringSymbols(dfs_b); |
1710 char chars_a[] = getCharSymbols(dfs_a); | 1717 char chars_a[] = getCharSymbols(dfs_a); |
1711 char chars_b[] = getCharSymbols(dfs_b); | 1718 char chars_b[] = getCharSymbols(dfs_b); |
1712 | 1719 |
1713 return SerializableTestUtility.compareStrings(strings_a, strings_b)
&& SerializableTestUtility.compareChars(chars_a, chars_b); | 1720 // Spot-check char-to-string conversion (ICU 58) |
| 1721 String percent_a1 = Character.toString(dfs_a.getPercent()); |
| 1722 String percent_a2 = dfs_a.getPercentString(); |
| 1723 String percent_b1 = Character.toString(dfs_b.getPercent()); |
| 1724 String percent_b2 = dfs_b.getPercentString(); |
| 1725 |
| 1726 return SerializableTestUtility.compareStrings(strings_a, strings_b) |
| 1727 && SerializableTestUtility.compareChars(chars_a, chars_b) |
| 1728 && percent_a1.equals(percent_b1) |
| 1729 && percent_a2.equals(percent_b2) |
| 1730 && percent_a1.equals(percent_a2); |
1714 } | 1731 } |
1715 } | 1732 } |
1716 | 1733 |
1717 public static class CurrencyPluralInfoHandler implements SerializableTestUti
lity.Handler | 1734 public static class CurrencyPluralInfoHandler implements SerializableTestUti
lity.Handler |
1718 { | 1735 { |
1719 @Override | 1736 @Override |
1720 public Object[] getTestObjects() | 1737 public Object[] getTestObjects() |
1721 { | 1738 { |
1722 CurrencyPluralInfo currencyPluralInfo[] = { | 1739 CurrencyPluralInfo currencyPluralInfo[] = { |
1723 new CurrencyPluralInfo(), new CurrencyPluralInfo(new ULocale("en
_US")), | 1740 new CurrencyPluralInfo(), new CurrencyPluralInfo(new ULocale("en
_US")), |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 } | 2475 } |
2459 } | 2476 } |
2460 | 2477 |
2461 public static void main(String[] args) | 2478 public static void main(String[] args) |
2462 { | 2479 { |
2463 // nothing needed... | 2480 // nothing needed... |
2464 } | 2481 } |
2465 | 2482 |
2466 } | 2483 } |
2467 //eof | 2484 //eof |
LEFT | RIGHT |