1 // Tags: JDK1.0 |
|
2 |
|
3 // Copyright (C) 2004 Free Software Foundation, Inc. |
|
4 // Contributed by Jeroen Frijters <jeroen@frijters.net>. |
|
5 |
|
6 // This file is part of Mauve. |
|
7 |
|
8 // Mauve is free software; you can redistribute it and/or modify |
|
9 // it under the terms of the GNU General Public License as published by |
|
10 // the Free Software Foundation; either version 2, or (at your option) |
|
11 // any later version. |
|
12 |
|
13 // Mauve is distributed in the hope that it will be useful, |
|
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 // GNU General Public License for more details. |
|
17 |
|
18 // You should have received a copy of the GNU General Public License |
|
19 // along with Mauve; see the file COPYING. If not, write to |
|
20 // the Free Software Foundation, 59 Temple Place - Suite 330, |
|
21 // Boston, MA 02111-1307, USA. |
|
22 |
|
23 package gnu.testlet.java.util.Date; |
|
24 |
|
25 import gnu.testlet.Testlet; |
|
26 import gnu.testlet.TestHarness; |
|
27 import java.util.Date; |
|
28 |
|
29 public class range implements Testlet |
|
30 { |
|
31 private TestHarness harness; |
|
32 |
|
33 public void test (TestHarness harness) |
|
34 { |
|
35 this.harness = harness; |
|
36 |
|
37 check(70, 0, 1, 0, 0, 0, 0); |
|
38 check(104, 9, 12, 0, 0, 0, 1097539200000L); |
|
39 check(104, 9, 12, 0, 0, 0, 1097539200000L); |
|
40 check(104, 9, 12, 12, 34, 0, 1097584440000L); |
|
41 check(104, 9, 12, 12, 34, 56, 1097584496000L); |
|
42 check(104, -1, 0, 0, 0, 0, 1070150400000L); |
|
43 check(104, 99, 99, 99, 99, 99, 1342068039000L); |
|
44 check(104, 999, 999, 999, 999, 999, 3789878139000L); |
|
45 check(104, -1, -1, -1, -1, -1, 1070060339000L); |
|
46 check(104, -999, -999, -999, -999, -999, -1644306939000L); |
|
47 } |
|
48 |
|
49 private void check(int year, int month, int day, int hours, int mins, int secs, long l) |
|
50 { |
|
51 try |
|
52 { |
|
53 Date d = new Date(year, month, day, hours, mins, secs); |
|
54 harness.check(d.getTime() - d.getTimezoneOffset() * 60 * 1000 == l); |
|
55 } |
|
56 catch (Throwable t) |
|
57 { |
|
58 harness.debug(t); |
|
59 harness.check(false); |
|
60 } |
|
61 } |
|
62 } |
|