This is the mail archive of the
mauve-patches@sources.redhat.com
mailing list for the Mauve project.
java.util.SimpleTimeZone - new tests
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Sun, 31 Oct 2004 22:48:22 +0000
- Subject: java.util.SimpleTimeZone - new tests
I've added some new tests for the java.util.SimpleTimeZone class:
2004-10-31 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/java/util/SimpleTimeZone/clone.java,
gnu/testlet/java/util/SimpleTimeZone/constants.java,
gnu/testlet/java/util/SimpleTimeZone/constructors.java,
gnu/testlet/java/util/SimpleTimeZone/equals.java,
gnu/testlet/java/util/SimpleTimeZone/getDSTSavings.java,
gnu/testlet/java/util/SimpleTimeZone/getOffset.java,
gnu/testlet/java/util/SimpleTimeZone/getRawOffset.java,
gnu/testlet/java/util/SimpleTimeZone/hashCode.java,
gnu/testlet/java/util/SimpleTimeZone/hasSameRules.java,
gnu/testlet/java/util/SimpleTimeZone/inDaylightTime.java,
gnu/testlet/java/util/SimpleTimeZone/setDSTSavings.java,
gnu/testlet/java/util/SimpleTimeZone/setRawOffset.java,
gnu/testlet/java/util/SimpleTimeZone/setStartYear.java: New tests.
See the patch attached.
Regards,
Dave Gilbert
Index: ChangeLog
===================================================================
RCS file: /cvs/mauve/mauve/ChangeLog,v
retrieving revision 1.717
diff -u -r1.717 ChangeLog
--- ChangeLog 31 Oct 2004 21:16:10 -0000 1.717
+++ ChangeLog 31 Oct 2004 21:38:56 -0000
@@ -1,5 +1,21 @@
2004-10-31 David Gilbert <david.gilbert@object-refinery.com>
+ * gnu/testlet/java/util/SimpleTimeZone/clone.java,
+ gnu/testlet/java/util/SimpleTimeZone/constants.java,
+ gnu/testlet/java/util/SimpleTimeZone/constructors.java,
+ gnu/testlet/java/util/SimpleTimeZone/equals.java,
+ gnu/testlet/java/util/SimpleTimeZone/getDSTSavings.java,
+ gnu/testlet/java/util/SimpleTimeZone/getOffset.java,
+ gnu/testlet/java/util/SimpleTimeZone/getRawOffset.java,
+ gnu/testlet/java/util/SimpleTimeZone/hashCode.java,
+ gnu/testlet/java/util/SimpleTimeZone/hasSameRules.java,
+ gnu/testlet/java/util/SimpleTimeZone/inDaylightTime.java,
+ gnu/testlet/java/util/SimpleTimeZone/setDSTSavings.java,
+ gnu/testlet/java/util/SimpleTimeZone/setRawOffset.java,
+ gnu/testlet/java/util/SimpleTimeZone/setStartYear.java: New tests.
+
+2004-10-31 David Gilbert <david.gilbert@object-refinery.com>
+
* gnu/testlet/java/util/SimpleTimeZone/check12.java,
gnu/testlet/java/util/SimpleTimeZone/check14.java: fixed bugs in
various checks.
Index: gnu/testlet/java/util/SimpleTimeZone/clone.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/clone.java
diff -N gnu/testlet/java/util/SimpleTimeZone/clone.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/clone.java 31 Oct 2004 21:39:02 -0000
@@ -0,0 +1,49 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the clone() method in the SimpleTimeZone class.
+ */
+public class clone implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ int t = 2 * 60 * 60 * 1000;
+ SimpleTimeZone z1 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Zone 1",
+ Calendar.JANUARY, 15, 0, t,
+ Calendar.NOVEMBER, 11, 0, t,
+ 60 * 60 * 1000);
+ SimpleTimeZone z2 = (SimpleTimeZone) z1.clone();
+ harness.check(z1.equals(z2));
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/constants.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/constants.java
diff -N gnu/testlet/java/util/SimpleTimeZone/constants.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/constants.java 31 Oct 2004 21:39:02 -0000
@@ -0,0 +1,44 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the constants in the SimpleTimeZone class.
+ */
+public class constants implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ harness.check(SimpleTimeZone.STANDARD_TIME, 1);
+ harness.check(SimpleTimeZone.UTC_TIME, 2);
+ harness.check(SimpleTimeZone.WALL_TIME, 0);
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/constructors.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/constructors.java
diff -N gnu/testlet/java/util/SimpleTimeZone/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/constructors.java 31 Oct 2004 21:39:02 -0000
@@ -0,0 +1,444 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the constructors in the SimpleTimeZone class.
+ */
+public class constructors implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ testConstructor1(harness);
+ testConstructor2(harness);
+ testConstructor3(harness);
+ testConstructor4(harness);
+ }
+
+ private void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("(int, String)");
+ SimpleTimeZone z = new SimpleTimeZone(1234, "Z1");
+ harness.check(z.getRawOffset(), 1234);
+ harness.check(z.getID(), "Z1");
+
+ // null id should throw exception
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, null);
+ harness.check(false);
+ }
+ catch (NullPointerException e)
+ {
+ harness.check(true);
+ }
+ }
+
+ private void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("(int, String, int, int, int, int, int, int, int, int)");
+ SimpleTimeZone z = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000);
+ harness.check(z.getRawOffset(), 1234);
+ harness.check(z.getID(), "Z1");
+ harness.check(z.useDaylightTime(), true);
+ harness.check(z.getDSTSavings(), 60*60*1000);
+
+ // null id should throw exception
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, null, Calendar.APRIL, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (NullPointerException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", 12, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", Calendar.APRIL, 15, 0, 2*60*60*1000,
+ 12, 22, 0, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start day-of-month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", Calendar.APRIL, 33, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end day-of-month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", Calendar.APRIL, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 33, 0, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start n (for nth day-of-week)
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, 6, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, -6, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end n (for nth day-of-week)
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, 1, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, 6, Calendar.MONDAY, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, 1, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, -6, Calendar.MONDAY, 2*60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ }
+
+ private void testConstructor3(TestHarness harness)
+ {
+ harness.checkPoint("(int, String, int, int, int, int, int, int, int, int, int)");
+ SimpleTimeZone z = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, 123456);
+ harness.check(z.getRawOffset(), 1234);
+ harness.check(z.getID(), "Z1");
+ harness.check(z.useDaylightTime(), true);
+ harness.check(z.getDSTSavings(), 123456);
+
+ // null id should throw exception
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, null, Calendar.APRIL, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (NullPointerException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", 12, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", Calendar.APRIL, 15, 0, 2*60*60*1000,
+ 15, 22, 0, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start day-of-month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", Calendar.APRIL, 33, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end day-of-month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z", Calendar.APRIL, 15, 0, 2*60*60*1000,
+ Calendar.NOVEMBER, 33, 0, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start n (for nth day of week)
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, 6, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, -6, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end n (for nth day of week)
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, 1, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, 6, Calendar.MONDAY, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, "Z",
+ Calendar.APRIL, -1, Calendar.MONDAY, 2*60*60*1000,
+ Calendar.NOVEMBER, -6, Calendar.MONDAY, 2*60*60*1000, 60*60*1000);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+ }
+
+ private void testConstructor4(TestHarness harness)
+ {
+ harness.checkPoint("(int, String, int, int, int, int, int, int, int, int, int, int, int)");
+ SimpleTimeZone z = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 15, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(z.getRawOffset(), 1234);
+ harness.check(z.getID(), "Z1");
+ harness.check(z.useDaylightTime(), true);
+ harness.check(z.getDSTSavings(), 123456);
+
+ // null id should throw exception
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(0, null,
+ Calendar.APRIL, 15, 0, 2*60*60*1000, SimpleTimeZone.WALL_TIME,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, SimpleTimeZone.WALL_TIME,
+ 60*60*1000);
+ harness.check(false);
+ }
+ catch (NullPointerException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ 12, 15, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 15, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 12, 22, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid start day-of-month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 33, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid end day-of-month
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 15, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, 33, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid n (for nth day-of-week)
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 6, Calendar.MONDAY, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, -6, Calendar.MONDAY, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, 22, 0, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ // check for invalid n (for nth day-of-week)
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 1, Calendar.MONDAY, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, 6, Calendar.MONDAY, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ try
+ {
+ SimpleTimeZone z2 = new SimpleTimeZone(1234, "Z1",
+ Calendar.APRIL, 1, Calendar.MONDAY, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ Calendar.NOVEMBER, -6, Calendar.MONDAY, 2*60*60*1000, SimpleTimeZone.UTC_TIME,
+ 123456);
+ harness.check(false);
+ }
+ catch (IllegalArgumentException e)
+ {
+ harness.check(true);
+ }
+
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/equals.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/equals.java
diff -N gnu/testlet/java/util/SimpleTimeZone/equals.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/equals.java 31 Oct 2004 21:39:03 -0000
@@ -0,0 +1,106 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert (david.gilbert@object-refinery.com)
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the equals() method in the SimpleTimeZone class.
+ */
+public class equals
+ implements Testlet
+{
+ /**
+ * Runs the tests.
+ *
+ * @param harness the test harness.
+ */
+ public void test(TestHarness harness)
+ {
+ SimpleTimeZone z1 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Z1");
+ harness.check(!z1.equals(null));
+
+ SimpleTimeZone z2 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Z1");
+ harness.check(z1.equals(z2)); // check 1
+ harness.check(z2.equals(z1)); // check 2
+
+ int rawOffset1 = 5 * 60 * 60 * 1000;
+ int rawOffset2 = 6 * 60 * 60 * 1000;
+ int time1 = 2 * 60 * 60 * 1000;
+ int time2 = 3 * 60 * 60 * 1000;
+
+ z1 = new SimpleTimeZone(rawOffset1, "Z1", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ z2 = new SimpleTimeZone(rawOffset1, "Z1", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 3
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.equals(z2)); // check 4
+ z2 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 5
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.equals(z2)); // check 6
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 7
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.equals(z2)); // check 8
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 9
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.equals(z2)); // check 10
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 11
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.equals(z2)); // check 12
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 13
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 15, 0, time2, 3600000);
+ harness.check(!z1.equals(z2)); // check 14
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 15, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 15
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time2, 3600000);
+ harness.check(!z1.equals(z2)); // check 16
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time2, 3600000);
+ harness.check(z1.equals(z2)); // check 17
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600000);
+ harness.check(!z1.equals(z2)); // check 18
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600000);
+ harness.check(z1.equals(z2)); // check 19
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600001);
+ harness.check(!z1.equals(z2)); // check 20
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600001);
+ harness.check(z1.equals(z2)); // check 21
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/java/util/SimpleTimeZone/getDSTSavings.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/getDSTSavings.java
diff -N gnu/testlet/java/util/SimpleTimeZone/getDSTSavings.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/getDSTSavings.java 31 Oct 2004 21:39:03 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the getDSTSavings() method in the SimpleTimeZone class.
+ */
+public class getDSTSavings implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ SimpleTimeZone z1 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Zone 1",
+ Calendar.APRIL, 26, 0, 2*60*60*1000,
+ Calendar.OCTOBER, 25, 0, 2*60*60*1000, 36000000);
+ z1.setDSTSavings(12345);
+ harness.check(z1.getDSTSavings(), 12345);
+
+ // here is a special case (bug?), the zone has no daylight saving rule, so
+ // setting the DSTSavings amount doesn't have any effect
+ SimpleTimeZone z2 = new SimpleTimeZone(5*60*60*1000, "Zone 2");
+ z2.setDSTSavings(12345);
+ harness.check(z2.getDSTSavings(), 0); // zero!
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/getOffset.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/getOffset.java
diff -N gnu/testlet/java/util/SimpleTimeZone/getOffset.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/getOffset.java 31 Oct 2004 21:39:03 -0000
@@ -0,0 +1,79 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the getOffset() methods in the SimpleTimeZone class.
+ */
+public class getOffset implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ testMethod1(harness);
+ testMethod2(harness);
+ }
+
+ private void testMethod1(TestHarness harness)
+ {
+ harness.checkPoint("(int, int, int, int, int, int)");
+ int offset = -6 * 60 * 60 * 1000;
+ int t1 = 5 * 60 * 60 * 1000;
+ int t2 = 6 * 60 * 60 * 1000;
+ int dst = 2 * 60 * 60 * 1000;
+ SimpleTimeZone z = new SimpleTimeZone(offset, "Z1",
+ Calendar.APRIL, 26, 0, t1,
+ Calendar.OCTOBER, 25, 0, t2, dst);
+ harness.check(z.getOffset(GregorianCalendar.AD, 2004, Calendar.APRIL, 26, Calendar.MONDAY, t1 - 1000), offset);
+ harness.check(z.getOffset(GregorianCalendar.AD, 2004, Calendar.APRIL, 26, Calendar.MONDAY, t1 + 1000), offset + dst);
+ harness.check(z.getOffset(GregorianCalendar.AD, 2004, Calendar.OCTOBER, 25, Calendar.MONDAY, t2 - dst - 1000), offset + dst);
+ harness.check(z.getOffset(GregorianCalendar.AD, 2004, Calendar.OCTOBER, 25, Calendar.MONDAY, t2 - dst + 1000), offset);
+ }
+
+ private void testMethod2(TestHarness harness)
+ {
+ harness.checkPoint("(Date)");
+ int offset = -6 * 60 * 60 * 1000;
+ int t1 = 5 * 60 * 60 * 1000;
+ int t2 = 6 * 60 * 60 * 1000;
+ int dst = 2 * 60 * 60 * 1000;
+ SimpleTimeZone z = new SimpleTimeZone(offset, "Z1",
+ Calendar.APRIL, 26, 0, t1,
+ Calendar.OCTOBER, 25, 0, t2, dst);
+ GregorianCalendar c = new GregorianCalendar(z);
+ c.set(2004, Calendar.APRIL, 26, 4, 59, 59);
+ long d1 = c.getTimeInMillis();
+ harness.check(z.getOffset(d1), offset);
+ harness.check(z.getOffset(d1 + 2000), offset + dst);
+
+ // to do : check end date
+ }
+}
Index: gnu/testlet/java/util/SimpleTimeZone/getRawOffset.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/getRawOffset.java
diff -N gnu/testlet/java/util/SimpleTimeZone/getRawOffset.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/getRawOffset.java 31 Oct 2004 21:39:03 -0000
@@ -0,0 +1,44 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the getRawOffset() method in the SimpleTimeZone class.
+ */
+public class getRawOffset implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ SimpleTimeZone z1 = new SimpleTimeZone(0, "Zone 1");
+ z1.setRawOffset(12345);
+ harness.check(z1.getRawOffset(), 12345);
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/hasSameRules.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/hasSameRules.java
diff -N gnu/testlet/java/util/SimpleTimeZone/hasSameRules.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/hasSameRules.java 31 Oct 2004 21:39:04 -0000
@@ -0,0 +1,101 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert (david.gilbert@object-refinery.com)
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the hasSameRules() method in the SimpleTimeZone class.
+ */
+public class hasSameRules
+ implements Testlet
+{
+ /**
+ * Runs the tests.
+ *
+ * @param harness the test harness.
+ */
+ public void test(TestHarness harness)
+ {
+ SimpleTimeZone z1 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Z1");
+ harness.check(!z1.hasSameRules(null));
+
+ SimpleTimeZone z2 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Z1");
+ harness.check(z1.hasSameRules(z2)); // check 1
+ harness.check(z2.hasSameRules(z1)); // check 2
+
+ int rawOffset1 = 5 * 60 * 60 * 1000;
+ int rawOffset2 = 6 * 60 * 60 * 1000;
+ int time1 = 2 * 60 * 60 * 1000;
+ int time2 = 3 * 60 * 60 * 1000;
+
+ z1 = new SimpleTimeZone(rawOffset1, "Z1", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ z2 = new SimpleTimeZone(rawOffset1, "Z2", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 3
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.hasSameRules(z2)); // check 4
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.APRIL, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 5
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.hasSameRules(z2)); // check 6
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 5, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 7
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 6, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.hasSameRules(z2)); // check 8
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time1, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 9
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 6, 0, time2, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(!z1.hasSameRules(z2)); // check 10
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.SEPTEMBER, 15, 0, time2, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 11
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 15, 0, time2, 3600000);
+ harness.check(!z1.hasSameRules(z2)); // check 12
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 15, 0, time2, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 13
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time2, 3600000);
+ harness.check(!z1.hasSameRules(z2)); // check 14
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time2, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 15
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600000);
+ harness.check(!z1.hasSameRules(z2)); // check 16
+ z2 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600000);
+ harness.check(z1.hasSameRules(z2)); // check 17
+
+ z1 = new SimpleTimeZone(rawOffset2, "Z1", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600001);
+ harness.check(!z1.hasSameRules(z2)); // check 18
+ z2 = new SimpleTimeZone(rawOffset2, "Z2", Calendar.MAY, 6, 0, time2, Calendar.OCTOBER, 16, 0, time1, 3600001);
+ harness.check(z1.hasSameRules(z2)); // check 19
+
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/java/util/SimpleTimeZone/hashCode.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/hashCode.java
diff -N gnu/testlet/java/util/SimpleTimeZone/hashCode.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/hashCode.java 31 Oct 2004 21:39:04 -0000
@@ -0,0 +1,48 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert (david.gilbert@object-refinery.com)
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the hashCode() method in the SimpleTimeZone class.
+ */
+public class hashCode
+ implements Testlet
+{
+ /**
+ * Runs the tests.
+ *
+ * @param harness the test harness.
+ */
+ public void test(TestHarness harness)
+ {
+ SimpleTimeZone z1 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Z1");
+ SimpleTimeZone z2 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Z1");
+ harness.check(z1.equals(z2));
+ harness.check(z1.hashCode(), z2.hashCode());
+ }
+
+}
\ No newline at end of file
Index: gnu/testlet/java/util/SimpleTimeZone/inDaylightTime.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/inDaylightTime.java
diff -N gnu/testlet/java/util/SimpleTimeZone/inDaylightTime.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/inDaylightTime.java 31 Oct 2004 21:39:04 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the inDaylightTime() method in the SimpleTimeZone class.
+ */
+public class inDaylightTime implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ int offset = -6 * 60 * 60 * 1000;
+ int t1 = 5 * 60 * 60 * 1000;
+ int t2 = 6 * 60 * 60 * 1000;
+ int dst = 2 * 60 * 60 * 1000;
+ SimpleTimeZone z = new SimpleTimeZone(offset, "Z1",
+ Calendar.APRIL, 26, 0, t1,
+ Calendar.OCTOBER, 25, 0, t2, dst);
+
+ GregorianCalendar c = new GregorianCalendar(z);
+ c.set(2004, Calendar.APRIL, 25, 8, 0, 0);
+ harness.check(!z.inDaylightTime(c.getTime()));
+ c.set(2004, Calendar.APRIL, 26, 8, 0, 0);
+ harness.check(z.inDaylightTime(c.getTime()));
+
+ c.set(2004, Calendar.OCTOBER, 24, 8, 0, 0);
+ harness.check(z.inDaylightTime(c.getTime()));
+ c.set(2004, Calendar.OCTOBER, 25, 8, 0, 0);
+ harness.check(!z.inDaylightTime(c.getTime()));
+
+ try
+ {
+ boolean b = z.inDaylightTime(null);
+ harness.check(false);
+ }
+ catch (NullPointerException e)
+ {
+ harness.check(true);
+ }
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/setDSTSavings.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/setDSTSavings.java
diff -N gnu/testlet/java/util/SimpleTimeZone/setDSTSavings.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/setDSTSavings.java 31 Oct 2004 21:39:04 -0000
@@ -0,0 +1,48 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the setDSTSavings() method in the SimpleTimeZone class.
+ */
+public class setDSTSavings implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ SimpleTimeZone z1 = new SimpleTimeZone(5 * 60 * 60 * 1000, "Zone 1",
+ Calendar.APRIL, 26, 0, 2*60*60*1000,
+ Calendar.OCTOBER, 25, 0, 2*60*60*1000, 36000000);
+ harness.check(z1.getDSTSavings(), 36000000);
+ z1.setDSTSavings(12345);
+ harness.check(z1.getDSTSavings(), 12345);
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/setRawOffset.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/setRawOffset.java
diff -N gnu/testlet/java/util/SimpleTimeZone/setRawOffset.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/setRawOffset.java 31 Oct 2004 21:39:04 -0000
@@ -0,0 +1,45 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the setRawOffset() method in the SimpleTimeZone class.
+ */
+public class setRawOffset implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ SimpleTimeZone z1 = new SimpleTimeZone(0, "Zone 1");
+ harness.check(z1.getRawOffset(), 0);
+ z1.setRawOffset(12345);
+ harness.check(z1.getRawOffset(), 12345);
+ }
+
+}
Index: gnu/testlet/java/util/SimpleTimeZone/setStartYear.java
===================================================================
RCS file: gnu/testlet/java/util/SimpleTimeZone/setStartYear.java
diff -N gnu/testlet/java/util/SimpleTimeZone/setStartYear.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/util/SimpleTimeZone/setStartYear.java 31 Oct 2004 21:39:04 -0000
@@ -0,0 +1,66 @@
+// Tags: JDK1.4
+
+// Copyright (C) 2004 David Gilbert <david.gilbert@object-refinery.com>
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA. */
+
+package gnu.testlet.java.util.SimpleTimeZone;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.SimpleTimeZone;
+
+/**
+ * Some checks for the setStartYear() method in the SimpleTimeZone class.
+ */
+public class setStartYear implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ int offset = -6 * 60 * 60 * 1000;
+ int t1 = 5 * 60 * 60 * 1000;
+ int t2 = 6 * 60 * 60 * 1000;
+ int dst = 2 * 60 * 60 * 1000;
+ SimpleTimeZone z = new SimpleTimeZone(offset, "Z1",
+ Calendar.APRIL, 26, 0, t1,
+ Calendar.OCTOBER, 25, 0, t2, dst);
+ z.setStartYear(2010);
+
+ // the following checks are copied from the inDaylightTime test
+ // but in this case the expected result is always false because
+ // the start year has been set to 2010.
+ GregorianCalendar c = new GregorianCalendar(z);
+ c.set(2004, Calendar.APRIL, 25, 8, 0, 0);
+ harness.check(!z.inDaylightTime(c.getTime()));
+ c.set(2004, Calendar.APRIL, 26, 8, 0, 0);
+ harness.check(!z.inDaylightTime(c.getTime()));
+
+ c.set(2004, Calendar.OCTOBER, 24, 8, 0, 0);
+ harness.check(!z.inDaylightTime(c.getTime()));
+ c.set(2004, Calendar.OCTOBER, 25, 8, 0, 0);
+ harness.check(!z.inDaylightTime(c.getTime()));
+
+ }
+
+}