1 USING: arrays calendar kernel math sequences tools.test
2 continuations system math.order threads ;
9 [ f ] [ 2004 12 32 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
10 [ f ] [ 2004 2 30 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
11 [ f ] [ 2003 2 29 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
12 [ f ] [ 2004 -2 9 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
13 [ f ] [ 2004 12 0 0 0 0 instant <timestamp> valid-timestamp? ] unit-test
14 [ f ] [ 2004 12 1 24 0 0 instant <timestamp> valid-timestamp? ] unit-test
15 [ f ] [ 2004 12 1 23 60 0 instant <timestamp> valid-timestamp? ] unit-test
16 [ f ] [ 2004 12 1 23 59 60 instant <timestamp> valid-timestamp? ] unit-test
17 [ t ] [ now valid-timestamp? ] unit-test
19 [ f ] [ 1900 leap-year? ] unit-test
20 [ t ] [ 1904 leap-year? ] unit-test
21 [ t ] [ 2000 leap-year? ] unit-test
22 [ f ] [ 2001 leap-year? ] unit-test
23 [ f ] [ 2006 leap-year? ] unit-test
25 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> 1 seconds time+
26 2006 10 10 0 0 1 instant <timestamp> = ] unit-test
27 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> 100 seconds time+
28 2006 10 10 0 1 40 instant <timestamp> = ] unit-test
29 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> -100 seconds time+
30 2006 10 9 23 58 20 instant <timestamp> = ] unit-test
31 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> 86400 seconds time+
32 2006 10 11 0 0 0 instant <timestamp> = ] unit-test
34 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> 10 minutes time+
35 2006 10 10 0 10 0 instant <timestamp> = ] unit-test
36 [ +eq+ ] [ 2006 10 10 0 0 0 instant <timestamp> 10.5 minutes time+
37 2006 10 10 0 10 30 instant <timestamp> <=> ] unit-test
38 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> 3/4 minutes time+
39 2006 10 10 0 0 45 instant <timestamp> = ] unit-test
40 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> -3/4 minutes time+
41 2006 10 9 23 59 15 instant <timestamp> = ] unit-test
43 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> 7200 minutes time+
44 2006 10 15 0 0 0 instant <timestamp> = ] unit-test
45 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> -10 minutes time+
46 2006 10 9 23 50 0 instant <timestamp> = ] unit-test
47 [ t ] [ 2006 10 10 0 0 0 instant <timestamp> -100 minutes time+
48 2006 10 9 22 20 0 instant <timestamp> = ] unit-test
50 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 hours time+
51 2006 1 1 1 0 0 instant <timestamp> = ] unit-test
52 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 24 hours time+
53 2006 1 2 0 0 0 instant <timestamp> = ] unit-test
54 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -24 hours time+
55 2005 12 31 0 0 0 instant <timestamp> = ] unit-test
56 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 12 hours time+
57 2006 1 1 12 0 0 instant <timestamp> = ] unit-test
58 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 72 hours time+
59 2006 1 4 0 0 0 instant <timestamp> = ] unit-test
61 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 days time+
62 2006 1 2 0 0 0 instant <timestamp> = ] unit-test
63 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -1 days time+
64 2005 12 31 0 0 0 instant <timestamp> = ] unit-test
65 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 365 days time+
66 2007 1 1 0 0 0 instant <timestamp> = ] unit-test
67 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -365 days time+
68 2005 1 1 0 0 0 instant <timestamp> = ] unit-test
69 [ t ] [ 2004 1 1 0 0 0 instant <timestamp> 365 days time+
70 2004 12 31 0 0 0 instant <timestamp> = ] unit-test
71 [ t ] [ 2004 1 1 0 0 0 instant <timestamp> 366 days time+
72 2005 1 1 0 0 0 instant <timestamp> = ] unit-test
74 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 11 months time+
75 2006 12 1 0 0 0 instant <timestamp> = ] unit-test
76 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 12 months time+
77 2007 1 1 0 0 0 instant <timestamp> = ] unit-test
78 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 24 months time+
79 2008 1 1 0 0 0 instant <timestamp> = ] unit-test
80 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 13 months time+
81 2007 2 1 0 0 0 instant <timestamp> = ] unit-test
82 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 months time+
83 2006 2 1 0 0 0 instant <timestamp> = ] unit-test
84 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 0 months time+
85 2006 1 1 0 0 0 instant <timestamp> = ] unit-test
86 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -1 months time+
87 2005 12 1 0 0 0 instant <timestamp> = ] unit-test
88 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -2 months time+
89 2005 11 1 0 0 0 instant <timestamp> = ] unit-test
90 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -13 months time+
91 2004 12 1 0 0 0 instant <timestamp> = ] unit-test
92 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -24 months time+
93 2004 1 1 0 0 0 instant <timestamp> = ] unit-test
94 [ t ] [ 2004 2 29 0 0 0 instant <timestamp> 12 months time+
95 2005 3 1 0 0 0 instant <timestamp> = ] unit-test
96 [ t ] [ 2004 2 29 0 0 0 instant <timestamp> -12 months time+
97 2003 3 1 0 0 0 instant <timestamp> = ] unit-test
99 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 0 years time+
100 2006 1 1 0 0 0 instant <timestamp> = ] unit-test
101 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> 1 years time+
102 2007 1 1 0 0 0 instant <timestamp> = ] unit-test
103 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -1 years time+
104 2005 1 1 0 0 0 instant <timestamp> = ] unit-test
105 [ t ] [ 2006 1 1 0 0 0 instant <timestamp> -100 years time+
106 1906 1 1 0 0 0 instant <timestamp> = ] unit-test
107 ! [ t ] [ 2004 2 29 0 0 0 instant <timestamp> -1 years time+
108 ! 2003 2 28 0 0 0 instant <timestamp> = ] unit-test
110 [ 5 ] [ 2006 7 14 0 0 0 instant <timestamp> day-of-week ] unit-test
112 [ t ] [ 2006 7 14 [ julian-day-number julian-day-number>date 0 0 0 instant <timestamp> ] 3keep 0 0 0 instant <timestamp> = ] unit-test
114 [ 1 ] [ 2006 1 1 0 0 0 instant <timestamp> day-of-year ] unit-test
115 [ 60 ] [ 2004 2 29 0 0 0 instant <timestamp> day-of-year ] unit-test
116 [ 61 ] [ 2004 3 1 0 0 0 instant <timestamp> day-of-year ] unit-test
117 [ 366 ] [ 2004 12 31 0 0 0 instant <timestamp> day-of-year ] unit-test
118 [ 365 ] [ 2003 12 31 0 0 0 instant <timestamp> day-of-year ] unit-test
119 [ 60 ] [ 2003 3 1 0 0 0 instant <timestamp> day-of-year ] unit-test
121 [ t ] [ 2004 12 31 0 0 0 instant <timestamp> dup = ] unit-test
122 [ t ] [ 2004 1 1 0 0 0 instant <timestamp> 10 seconds 5 years time+ time+
123 2009 1 1 0 0 10 instant <timestamp> = ] unit-test
124 [ t ] [ 2004 1 1 0 0 0 instant <timestamp> -10 seconds -5 years time+ time+
125 1998 12 31 23 59 50 instant <timestamp> = ] unit-test
127 [ t ] [ 2004 1 1 23 0 0 12 hours <timestamp> >gmt
128 2004 1 1 11 0 0 instant <timestamp> = ] unit-test
129 [ t ] [ 2004 1 1 5 0 0 -11 hours <timestamp> >gmt
130 2004 1 1 16 0 0 instant <timestamp> = ] unit-test
131 [ t ] [ 2004 1 1 23 0 0 9+1/2 hours <timestamp> >gmt
132 2004 1 1 13 30 0 instant <timestamp> = ] unit-test
134 [ +eq+ ] [ 2004 1 1 13 30 0 instant <timestamp>
135 2004 1 1 12 30 0 -1 hours <timestamp> <=> ] unit-test
137 [ +gt+ ] [ 2004 1 1 13 30 0 instant <timestamp>
138 2004 1 1 12 30 0 instant <timestamp> <=> ] unit-test
140 [ +lt+ ] [ 2004 1 1 12 30 0 instant <timestamp>
141 2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
143 [ +gt+ ] [ 2005 1 1 12 30 0 instant <timestamp>
144 2004 1 1 13 30 0 instant <timestamp> <=> ] unit-test
146 [ t ] [ now timestamp>micros micros - 1000000 < ] unit-test
147 [ t ] [ 0 micros>timestamp unix-1970 = ] unit-test
148 [ t ] [ 123456789000000 [ micros>timestamp timestamp>micros ] keep = ] unit-test
149 [ t ] [ 123456789123456000 [ micros>timestamp timestamp>micros ] keep = ] unit-test
151 : checktime+ now dup clone [ rot time+ drop ] keep = ;
153 [ t ] [ 5 seconds checktime+ ] unit-test
155 [ t ] [ 5 minutes checktime+ ] unit-test
157 [ t ] [ 5 hours checktime+ ] unit-test
159 [ t ] [ 5 days checktime+ ] unit-test
161 [ t ] [ 5 weeks checktime+ ] unit-test
163 [ t ] [ 5 months checktime+ ] unit-test
165 [ t ] [ 5 years checktime+ ] unit-test
167 [ t ] [ now 50 milliseconds sleep now before? ] unit-test
168 [ t ] [ now 50 milliseconds sleep now swap after? ] unit-test
169 [ t ] [ now 50 milliseconds sleep now 50 milliseconds sleep now swapd between? ] unit-test