From 66b1761bc686c592d7c6867ed484cb005898eed6 Mon Sep 17 00:00:00 2001 From: GCL Shanghai Date: Thu, 25 Oct 2001 06:37:15 +0000 Subject: [PATCH] ICU-92 Update testcase for implementation of serialization update X-SVN-Rev: 6426 --- .../icu/dev/test/format/NumberRegression.java | 21 ++++++++++--------- .../ibm/icu/test/format/NumberRegression.java | 21 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/icu4j/src/com/ibm/icu/dev/test/format/NumberRegression.java b/icu4j/src/com/ibm/icu/dev/test/format/NumberRegression.java index ee7209732f3..5c52e1f05cc 100755 --- a/icu4j/src/com/ibm/icu/dev/test/format/NumberRegression.java +++ b/icu4j/src/com/ibm/icu/dev/test/format/NumberRegression.java @@ -1,7 +1,7 @@ /***************************************************************************************** * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/format/NumberRegression.java,v $ - * $Date: 2001/10/23 13:16:20 $ - * $Revision: 1.2 $ + * $Date: 2001/10/25 06:37:15 $ + * $Revision: 1.3 $ * ***************************************************************************************** **/ @@ -1398,7 +1398,7 @@ public class NumberRegression extends com.ibm.test.TestFmwk { bytes[875] = (byte) 0x24; //setMinimumFractionDigits bytes[874] = (byte) 0x01; bytes[865] = (byte) 0x23; //setMaximumFractionDigits - bytes[865] = (byte) 0x01; + bytes[864] = (byte) 0x01; { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); @@ -1415,20 +1415,21 @@ public class NumberRegression extends com.ibm.test.TestFmwk { bytes[879] = (byte) 0x11; //setMinimumIntegerDigits bytes[878] = (byte) 0x03; bytes[869] = (byte) 0x12; //setMaximumIntegerDigits - bytes[868] = (byte) 0x02; + bytes[868] = (byte) 0x03; bytes[875] = (byte) 0x13; //setMinimumFractionDigits bytes[874] = (byte) 0x03; bytes[865] = (byte) 0x14; //setMaximumFractionDigits - bytes[865] = (byte) 0x03; + bytes[864] = (byte) 0x03; { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); - try { - NumberFormat format = (NumberFormat) ois.readObject(); - logln("format: " + format.format(1234.56)); //fix "The variable is never used" + NumberFormat format = (NumberFormat) ois.readObject(); + //For compatibility with previous version + if ((format.getMaximumIntegerDigits() != 309) + || format.getMaximumFractionDigits() != 340) { errln("FAIL: Deserialized bogus NumberFormat"); - } catch (InvalidObjectException e) { - logln("Ok: " + e.getMessage()); + } else { + logln("Ok: Digit count out of range"); } } } diff --git a/icu4j/src/com/ibm/icu/test/format/NumberRegression.java b/icu4j/src/com/ibm/icu/test/format/NumberRegression.java index 5d1aef27afe..32977d8c5d2 100755 --- a/icu4j/src/com/ibm/icu/test/format/NumberRegression.java +++ b/icu4j/src/com/ibm/icu/test/format/NumberRegression.java @@ -1,7 +1,7 @@ /***************************************************************************************** * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/test/format/Attic/NumberRegression.java,v $ - * $Date: 2001/10/23 13:16:20 $ - * $Revision: 1.2 $ + * $Date: 2001/10/25 06:37:15 $ + * $Revision: 1.3 $ * ***************************************************************************************** **/ @@ -1398,7 +1398,7 @@ public class NumberRegression extends com.ibm.test.TestFmwk { bytes[875] = (byte) 0x24; //setMinimumFractionDigits bytes[874] = (byte) 0x01; bytes[865] = (byte) 0x23; //setMaximumFractionDigits - bytes[865] = (byte) 0x01; + bytes[864] = (byte) 0x01; { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); @@ -1415,20 +1415,21 @@ public class NumberRegression extends com.ibm.test.TestFmwk { bytes[879] = (byte) 0x11; //setMinimumIntegerDigits bytes[878] = (byte) 0x03; bytes[869] = (byte) 0x12; //setMaximumIntegerDigits - bytes[868] = (byte) 0x02; + bytes[868] = (byte) 0x03; bytes[875] = (byte) 0x13; //setMinimumFractionDigits bytes[874] = (byte) 0x03; bytes[865] = (byte) 0x14; //setMaximumFractionDigits - bytes[865] = (byte) 0x03; + bytes[864] = (byte) 0x03; { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); - try { - NumberFormat format = (NumberFormat) ois.readObject(); - logln("format: " + format.format(1234.56)); //fix "The variable is never used" + NumberFormat format = (NumberFormat) ois.readObject(); + //For compatibility with previous version + if ((format.getMaximumIntegerDigits() != 309) + || format.getMaximumFractionDigits() != 340) { errln("FAIL: Deserialized bogus NumberFormat"); - } catch (InvalidObjectException e) { - logln("Ok: " + e.getMessage()); + } else { + logln("Ok: Digit count out of range"); } } }