OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import "package:expect/expect.dart"; | |
6 | |
7 // Test DateTime constructor with optional arguments. | |
8 | |
9 main() { | |
10 var d = new DateTime(2012); | |
11 Expect.equals(2012, d.year); | |
12 Expect.equals(1, d.month); | |
13 Expect.equals(1, d.day); | |
14 Expect.equals(0, d.hour); | |
15 Expect.equals(0, d.minute); | |
16 Expect.equals(0, d.second); | |
17 Expect.equals(0, d.millisecond); | |
18 | |
19 d = new DateTime(2012, 1, 28); | |
20 Expect.equals(2012, d.year); | |
21 Expect.equals(1, d.month); | |
22 Expect.equals(28, d.day); | |
23 Expect.equals(0, d.hour); | |
24 Expect.equals(0, d.minute); | |
25 Expect.equals(0, d.second); | |
26 Expect.equals(0, d.millisecond); | |
27 | |
28 d = new DateTime(1970, 3); | |
29 Expect.equals(1970, d.year); | |
30 Expect.equals(3, d.month); | |
31 Expect.equals(1, d.day); | |
32 Expect.equals(0, d.hour); | |
33 Expect.equals(0, d.minute); | |
34 Expect.equals(0, d.second); | |
35 Expect.equals(0, d.millisecond); | |
36 | |
37 d = new DateTime(1970, 3, 1, 11); | |
38 Expect.equals(1970, d.year); | |
39 Expect.equals(3, d.month); | |
40 Expect.equals(1, d.day); | |
41 Expect.equals(11, d.hour); | |
42 Expect.equals(0, d.minute); | |
43 Expect.equals(0, d.second); | |
44 Expect.equals(0, d.millisecond); | |
45 | |
46 d = new DateTime(0, 12, 24, 0, 12); | |
47 Expect.equals(0, d.year); | |
48 Expect.equals(12, d.month); | |
49 Expect.equals(24, d.day); | |
50 Expect.equals(0, d.hour); | |
51 Expect.equals(12, d.minute); | |
52 Expect.equals(0, d.second); | |
53 Expect.equals(0, d.millisecond); | |
54 | |
55 d = new DateTime(-1, 2, 2, 3, 0, 0, 4); | |
56 Expect.equals(-1, d.year); | |
57 Expect.equals(2, d.month); | |
58 Expect.equals(2, d.day); | |
59 Expect.equals(3, d.hour); | |
60 Expect.equals(0, d.minute); | |
61 Expect.equals(0, d.second); | |
62 Expect.equals(4, d.millisecond); | |
63 | |
64 d = new DateTime(-1, 2, 2, 3, 0, 4); | |
65 Expect.equals(-1, d.year); | |
66 Expect.equals(2, d.month); | |
67 Expect.equals(2, d.day); | |
68 Expect.equals(3, d.hour); | |
69 Expect.equals(0, d.minute); | |
70 Expect.equals(4, d.second); | |
71 Expect.equals(0, d.millisecond); | |
72 | |
73 d = new DateTime(2012, 5, 15, 13, 21, 33, 12); | |
74 Expect.equals(2012, d.year); | |
75 Expect.equals(5, d.month); | |
76 Expect.equals(15, d.day); | |
77 Expect.equals(13, d.hour); | |
78 Expect.equals(21, d.minute); | |
79 Expect.equals(33, d.second); | |
80 Expect.equals(12, d.millisecond); | |
81 } | |
OLD | NEW |