author | Claus Gittinger <cg@exept.de> |
Sat, 13 Jul 2019 14:16:52 +0200 | |
changeset 2330 | c7cb74c4ed7b |
parent 1992 | 5cfaf842bed0 |
child 2391 | c4bfc248aace |
permissions | -rw-r--r-- |
1447 | 1 |
"{ Package: 'stx:goodies/regression' }" |
346 | 2 |
|
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#TimeAndDateTest |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
1077 | 9 |
category:'tests-Regression-DateAndTime' |
346 | 10 |
! |
11 |
||
12 |
||
13 |
!TimeAndDateTest methodsFor:'Testing'! |
|
14 |
||
2330 | 15 |
test_03_calenderWeek |
16 |
self assert:(Date newDay:5 month:11 year:2012) weekInYear == 45. |
|
17 |
self assert:(Date newDay:11 month:11 year:2012) weekInYear == 45. |
|
18 |
||
19 |
self assert:(Date newDay:4 month:11 year:2012) weekInYear == 44. |
|
20 |
self assert:(Date newDay:12 month:11 year:2012) weekInYear == 46. |
|
21 |
||
22 |
self assert:(Date newDay:29 month:12 year:2014) weekInYear == 1. "/ YES!! |
|
23 |
self assert:(Date newDay:30 month:12 year:2014) weekInYear == 1. "/ YES!! |
|
24 |
self assert:(Date newDay:31 month:12 year:2014) weekInYear == 1. "/ YES!! |
|
25 |
self assert:(Date newDay:1 month:1 year:2015) weekInYear == 1. |
|
26 |
self assert:(Date newDay:2 month:1 year:2015) weekInYear == 1. |
|
27 |
self assert:(Date newDay:3 month:1 year:2015) weekInYear == 1. |
|
28 |
self assert:(Date newDay:4 month:1 year:2015) weekInYear == 1. |
|
29 |
||
30 |
self assert:(Date newDay:5 month:1 year:2015) weekInYear == 2. |
|
31 |
||
32 |
"/ every 4th of january is in the 1st week |
|
33 |
1902 to:2100 do:[:y | |
|
34 |
|d| |
|
35 |
d := Date newDay:4 month:1 year:y. |
|
36 |
self assert:d weekInYear == 1. |
|
37 |
]. |
|
38 |
||
39 |
" |
|
40 |
self new test_03_calenderWeek |
|
41 |
" |
|
42 |
! |
|
43 |
||
44 |
test_04_calenderWeek_fails |
|
45 |
<test: broken> |
|
46 |
^ self. |
|
47 |
"/ currently fails for date before 1901 |
|
48 |
1900 to:1905 do:[:y | |
|
49 |
|d| |
|
50 |
d := Date newDay:4 month:1 year:y. |
|
51 |
self assert:d weekInYear == 1. |
|
52 |
]. |
|
53 |
||
54 |
" |
|
55 |
self new test_04_calenderWeek_fails |
|
56 |
" |
|
57 |
! |
|
58 |
||
59 |
test_05_weekDayConversion |
|
60 |
{ |
|
61 |
{ #( 6 53 2004) "2004-W53-6" . (Date newDay:1 month:1 year:2005) } . |
|
62 |
{ #( 7 53 2004) "2004-W53-7" . (Date newDay:2 month:1 year:2005) } . |
|
63 |
{ #( 6 52 2005) "2005-W52-6" . (Date newDay:31 month:12 year:2005) } . |
|
64 |
{ #( 1 1 2007) "2007-W01-1" . (Date newDay:1 month:1 year:2007) } . |
|
65 |
{ #( 7 52 2007) "2007-W52-7" . (Date newDay:30 month:12 year:2007) } . |
|
66 |
||
67 |
{ #( 1 1 2008) "2008-W01-1" . (Date newDay:31 month:12 year:2007) } . |
|
68 |
{ #( 2 1 2008) "2008-W01-2" . (Date newDay:1 month:1 year:2008) } . |
|
69 |
{ #( 7 52 2008) "2008-W52-7" . (Date newDay:28 month:12 year:2008) } . |
|
70 |
||
71 |
{ #( 1 1 2009) "2009-W01-1" . (Date newDay:29 month:12 year:2008) } . |
|
72 |
{ #( 2 1 2009) "2009-W01-2" . (Date newDay:30 month:12 year:2008) } . |
|
73 |
{ #( 3 1 2009) "2009-W01-3" . (Date newDay:31 month:12 year:2008) } . |
|
74 |
{ #( 4 1 2009) "2009-W01-4" . (Date newDay:1 month:1 year:2009) } . |
|
75 |
||
76 |
{ #( 4 53 2009) "2009-W53-4" . (Date newDay:31 month:12 year:2009) } . |
|
77 |
{ #( 5 53 2009) "2009-W53-5" . (Date newDay:1 month:1 year:2010) } . |
|
78 |
{ #( 6 53 2009) "2009-W53-6" . (Date newDay:2 month:1 year:2010) } . |
|
79 |
{ #( 7 53 2009) "2009-W53-7" . (Date newDay:3 month:1 year:2010) } . |
|
80 |
||
81 |
{ #( 1 1 1997) "1997-W01-1" . (Date newDay:30 month:12 year:1996) } . |
|
82 |
} do:[:eachPair | |
|
83 |
|dwy d1 d2 dayInWeek weekNr year| |
|
84 |
||
85 |
dwy := eachPair first. |
|
86 |
dayInWeek := dwy first. |
|
87 |
weekNr := dwy second. |
|
88 |
year := dwy third. |
|
89 |
d1 := Date newDayInWeek:dayInWeek week:weekNr year:year. |
|
90 |
||
91 |
d2 := eachPair second. |
|
92 |
self assert:(d1 = d2) description:'wrong: ',d1 printString, ' vs. ',d2 printString. |
|
93 |
self assert:(d1 weekInYear == weekNr). |
|
94 |
self assert:(d1 dayInWeek == dayInWeek). |
|
95 |
] |
|
96 |
||
97 |
" |
|
98 |
self new test_05_weekDayConversion |
|
99 |
" |
|
100 |
! |
|
101 |
||
102 |
test_12_dateQueries |
|
103 |
|d1 d2 d3| |
|
104 |
||
105 |
d1 := Date newDay:1 month:2 year:1940. |
|
106 |
d2 := Date newDay:1 month:2 year:1941. |
|
107 |
self assert:(d2 - d1) = 366. |
|
108 |
||
109 |
d1 := Date newDay:1 month:2 year:1840. |
|
110 |
d2 := Date newDay:1 month:2 year:1841. |
|
111 |
self assert:(d2 - d1) = 366. |
|
112 |
self assert:(d1 addDays:366) = d2. |
|
113 |
||
114 |
Date leapYear:1540. |
|
115 |
d1 := Date newDay:1 month:2 year:1540. |
|
116 |
d2 := Date newDay:1 month:2 year:1541. |
|
117 |
self assert:(d2 - d1) = 366. |
|
118 |
||
119 |
d1 := Date newDay:1 year:1901. |
|
120 |
self assert:(d1 day = 1). |
|
121 |
self assert:(d1 month = 1). |
|
122 |
self assert:(d1 year = 1901). |
|
123 |
||
124 |
"/ 1900 was NOT a leap year |
|
125 |
self assert:(Date leapYear:1900) not. |
|
126 |
"/ 2000 was a leap year |
|
127 |
self assert:(Date leapYear:2000). |
|
128 |
||
129 |
d2 := d1 subtractDays:365. |
|
130 |
self assert:(d2 day = 1). |
|
131 |
self assert:(d2 month = 1). |
|
132 |
self assert:(d2 year = 1900). |
|
133 |
||
134 |
d3 := d2 subtractDays:365. |
|
135 |
self assert:(d3 day = 1). |
|
136 |
self assert:(d3 month = 1). |
|
137 |
self assert:(d3 year = 1899). |
|
138 |
||
139 |
d1 := Date newDay:1 month:2 year:2540. |
|
140 |
d2 := Date newDay:1 month:2 year:2541. |
|
141 |
self assert:(d2 - d1) = 366. |
|
142 |
||
143 |
||
144 |
" |
|
145 |
self new test_12_dateQueries |
|
146 |
" |
|
147 |
! |
|
148 |
||
149 |
test_13_timestampQueries |
|
150 |
|d1 d2 local utc| |
|
151 |
||
152 |
d1 := UtcTimestamp year:2000 month:1 day:1. |
|
153 |
d2 := UtcTimestamp year:2001 month:1 day:1. |
|
154 |
self assert:(d2 - d1) days = 366. |
|
155 |
||
156 |
d1 := UtcTimestamp year:1940 month:1 day:2. |
|
157 |
d2 := UtcTimestamp year:1941 month:1 day:2. |
|
158 |
self assert:d1 asDate year = 1940. |
|
159 |
self assert:d2 asDate year = 1941. |
|
160 |
self assert:d1 asDate month = 1. |
|
161 |
self assert:d2 asDate month = 1. |
|
162 |
self assert:d1 asDate day = 2. |
|
163 |
self assert:d2 asDate day = 2. |
|
164 |
||
165 |
self assert:d1 asDate isLeapYear. |
|
166 |
self assert:d2 asDate isLeapYear not. |
|
167 |
self assert:(d2 - d1) days = 366. |
|
168 |
||
169 |
d1 := UtcTimestamp year:1840 month:1 day:1. |
|
170 |
d2 := UtcTimestamp year:1841 month:1 day:1. |
|
171 |
self assert:d1 asDate isLeapYear. |
|
172 |
self assert:d2 asDate isLeapYear not. |
|
173 |
self assert:(d2 - d1) days = 366. |
|
174 |
||
175 |
self assert:(d1 addDays:366) = d2. |
|
176 |
||
177 |
d1 := UtcTimestamp year:1540 month:1 day:1. |
|
178 |
d2 := UtcTimestamp year:1541 month:1 day:1. |
|
179 |
self assert:d1 asDate isLeapYear. |
|
180 |
self assert:d2 asDate isLeapYear not. |
|
181 |
self assert:(d2 - d1) days = 366. |
|
182 |
||
183 |
d1 := UtcTimestamp year:2038 month:1 day:1. |
|
184 |
d2 := UtcTimestamp year:2039 month:1 day:1. |
|
185 |
self assert:d1 asDate isLeapYear not. |
|
186 |
self assert:d2 asDate isLeapYear not. |
|
187 |
self assert:(d2 - d1) days = 365. |
|
188 |
||
189 |
d1 := UtcTimestamp year:2540 month:1 day:1. |
|
190 |
d2 := UtcTimestamp year:2541 month:1 day:1. |
|
191 |
self assert:d1 asDate isLeapYear. |
|
192 |
self assert:d2 asDate isLeapYear not. |
|
193 |
self assert:(d2 - d1) days = 366. |
|
194 |
||
195 |
d1 := UtcTimestamp year:3540 month:1 day:1. |
|
196 |
d2 := UtcTimestamp year:3541 month:1 day:1. |
|
197 |
self assert:d1 asDate isLeapYear. |
|
198 |
self assert:d2 asDate isLeapYear not. |
|
199 |
self assert:(d2 - d1) days = 366. |
|
200 |
||
201 |
d1 := UtcTimestamp year:1969 month:1 day:1. |
|
202 |
d2 := UtcTimestamp year:1970 month:1 day:1. |
|
203 |
self assert:d1 asDate isLeapYear not. |
|
204 |
self assert:d2 asDate isLeapYear not. |
|
205 |
self assert:(d2 - d1) days = 365. |
|
206 |
||
207 |
d1 := UtcTimestamp year:1600 month:1 day:1. |
|
208 |
d2 := UtcTimestamp year:1601 month:1 day:1. |
|
209 |
self assert:d1 asDate isLeapYear. |
|
210 |
self assert:d2 asDate isLeapYear not. |
|
211 |
self assert:(d2 - d1) days = 366. |
|
212 |
||
213 |
"/ local time vs. utc time |
|
214 |
local := Timestamp year:1940 month:1 day:1. |
|
215 |
utc := UtcTimestamp year:1940 month:1 day:1. |
|
216 |
self assert:(local asUtcTimestamp - utc asUtcTimestamp) asSeconds = local utcOffset. |
|
217 |
||
218 |
"/ tz time vs. utc time |
|
219 |
utc := Timestamp readFrom:'20000102T123000Z'. |
|
220 |
local := Timestamp readFrom:'20000102T123000+02'. |
|
221 |
self assert:(utc - local) asSeconds = 7200. |
|
222 |
||
223 |
"/ tz time vs. utc time |
|
224 |
utc := UtcTimestamp readFrom:'20000102T123000Z'. |
|
225 |
local := UtcTimestamp readFrom:'20000102T123000-02'. |
|
226 |
self assert:(utc - local) asSeconds = -7200. |
|
227 |
||
228 |
" |
|
229 |
self new test_13_timestampQueries |
|
230 |
" |
|
231 |
||
232 |
"Modified: / 27-07-2018 / 09:59:25 / Stefan Vogel" |
|
233 |
! |
|
234 |
||
235 |
test_14_arithmetic |
|
236 |
|t1 t2 t3 s| |
|
237 |
||
238 |
t1 := UtcTimestamp newDay:1 month:1 year:2000. |
|
239 |
t2 := t1 addDays:1. |
|
240 |
self assert:(t2 - t1) days = 1. |
|
241 |
||
242 |
t2 := t1 addHours:1. |
|
243 |
self assert:(t2 - t1) hours = 1. |
|
244 |
||
245 |
t2 := t1 addSeconds:1. |
|
246 |
self assert:(t2 - t1) seconds = 1. |
|
247 |
||
248 |
t1 := UtcTimestamp readFrom:'20000102T133045Z'. |
|
249 |
t2 := t1 addDays:1. |
|
250 |
self assert:(t2 printString = '2000-01-03 13:30:45Z'). |
|
251 |
||
252 |
t1 := Timestamp readFrom:'20000102T133045+01'. |
|
253 |
t2 := t1 addDays:1. |
|
254 |
self assert:(t2 printString = '2000-01-03 13:30:45+01'). |
|
255 |
||
256 |
t1 := UtcTimestamp readFrom:'20000102T133045Z'. |
|
257 |
t2 := Timestamp readFrom:'20000102T133045Z'. |
|
258 |
self assert:(t1 = t2). |
|
259 |
||
260 |
t2 := Timestamp readFrom:'20000102T143045+01'. |
|
261 |
self assert:(t1 = t2). |
|
262 |
||
263 |
t2 := Timestamp readFrom:'20000102T123045-01'. |
|
264 |
self assert:(t1 = t2). |
|
265 |
||
266 |
t2 := Timestamp readFrom:'20000102T123045'. "/ a local one |
|
267 |
s := t2 storeString. |
|
268 |
t3 := Timestamp readFrom:s. |
|
269 |
||
270 |
self assert:(t2 = t3). |
|
271 |
||
272 |
t1 := TZTimestamp readFrom:'20000102T133045Z'. |
|
273 |
self assert:(t1 printString = '2000-01-02 13:30:45+00'). |
|
274 |
t1 := UtcTimestamp readFrom:'20000102T133045Z'. |
|
275 |
self assert:(t1 printString = '2000-01-02 13:30:45Z'). |
|
276 |
||
277 |
" |
|
278 |
self new test_14_arithmetic |
|
279 |
" |
|
280 |
! |
|
281 |
||
282 |
test_15_misc |
|
283 |
#( 1700 1800 1900 2100 2200 ) do:[:y | |
|
284 |
self assert:(Date leapYear:y) not |
|
285 |
]. |
|
286 |
#( 1600 2000 2400 ) do:[:y | |
|
287 |
self assert:(Date leapYear:y) |
|
288 |
]. |
|
289 |
||
290 |
" |
|
291 |
self new test_15_misc |
|
292 |
" |
|
293 |
! |
|
294 |
||
295 |
test_18_moreTimestampArithmetic |
|
296 |
|t1 t2| |
|
297 |
||
298 |
t1 := Timestamp year:2000 month:1 day:1. |
|
299 |
t2 := t1 addMilliseconds:1. |
|
300 |
self assert:t1 seconds = 0. |
|
301 |
self assert:t2 seconds = 0. |
|
302 |
self assert:t1 exactSeconds = 0. |
|
303 |
self assert:t2 exactSeconds = 0.001. |
|
304 |
self assert:t1 milliseconds = 0. |
|
305 |
self assert:t2 milliseconds = 1. |
|
306 |
self assert:t1 microseconds = 0. |
|
307 |
self assert:t2 microseconds = 1000. |
|
308 |
self assert:t1 nanoseconds = 0. |
|
309 |
self assert:t2 nanoseconds = 1000000. |
|
310 |
self assert:t1 picoseconds = 0. |
|
311 |
self assert:t2 picoseconds = 1000000000. |
|
312 |
||
313 |
self assert:(t2 - t1) milliseconds = 1. |
|
314 |
self assert:(t2 - t1) microseconds = 1000. |
|
315 |
self assert:(t2 - t1) nanoseconds = 1000000. |
|
316 |
self assert:(t2 - t1) picoseconds = 1000000000. |
|
317 |
||
318 |
" |
|
319 |
self new test_18_moreArithmetic |
|
320 |
" |
|
321 |
! |
|
322 |
||
323 |
test_19_comparing |
|
324 |
|t1 t2| |
|
325 |
||
326 |
t1 := Time now. |
|
327 |
t2 := t1 addMilliseconds:1. |
|
328 |
||
329 |
self assert:t2 > t1. |
|
330 |
self assert:t2 >= t1. |
|
331 |
self assert:(t2 = t1) not. |
|
332 |
self assert:(t2 <= t1) not. |
|
333 |
self assert:(t2 < t1) not. |
|
334 |
||
335 |
t1 := Time now. |
|
336 |
t2 := t1 subtractMilliseconds:1. |
|
337 |
||
338 |
self assert:t2 < t1. |
|
339 |
self assert:t2 <= t1. |
|
340 |
self assert:(t2 = t1) not. |
|
341 |
self assert:(t2 >= t1) not. |
|
342 |
self assert:(t2 > t1) not. |
|
343 |
||
344 |
t1 := Time now. |
|
345 |
t2 := t1 + 1 milliseconds. |
|
346 |
self assert:t2 = (t1 addMilliseconds:1). |
|
347 |
||
348 |
t2 := t1 - 1 milliseconds. |
|
349 |
self assert:t2 = (t1 addMilliseconds:-1). |
|
350 |
self assert:t2 = (t1 subtractMilliseconds:1). |
|
351 |
||
352 |
" |
|
353 |
self new test_19_comparing |
|
354 |
" |
|
355 |
! |
|
356 |
||
357 |
test_20_comparing |
|
358 |
|t1 t2| |
|
359 |
||
360 |
t1 := Timestamp now. |
|
361 |
t2 := t1 addMilliseconds:1. |
|
362 |
||
363 |
self assert:t2 > t1. |
|
364 |
self assert:t2 >= t1. |
|
365 |
self assert:(t2 = t1) not. |
|
366 |
self assert:(t2 <= t1) not. |
|
367 |
self assert:(t2 < t1) not. |
|
368 |
||
369 |
t1 := Timestamp now. |
|
370 |
t2 := t1 subtractMilliseconds:1. |
|
371 |
||
372 |
self assert:t2 < t1. |
|
373 |
self assert:t2 <= t1. |
|
374 |
self assert:(t2 = t1) not. |
|
375 |
self assert:(t2 >= t1) not. |
|
376 |
self assert:(t2 > t1) not. |
|
377 |
||
378 |
t1 := Timestamp now. |
|
379 |
t2 := t1 + 1 milliseconds. |
|
380 |
self assert:t2 = (t1 addMilliseconds:1). |
|
381 |
||
382 |
t2 := t1 - 1 milliseconds. |
|
383 |
self assert:t2 = (t1 addMilliseconds:-1). |
|
384 |
self assert:t2 = (t1 subtractMilliseconds:1). |
|
385 |
||
386 |
t1 := Timestamp now. |
|
387 |
t2 := t1 + 1 microseconds. |
|
388 |
||
389 |
self assert:t2 > t1. |
|
390 |
self assert:t2 >= t1. |
|
391 |
self assert:(t2 = t1) not. |
|
392 |
self assert:(t2 <= t1) not. |
|
393 |
self assert:(t2 < t1) not. |
|
394 |
||
395 |
t1 := Timestamp now. |
|
396 |
t2 := t1 - 1 microseconds. |
|
397 |
||
398 |
self assert:t2 < t1. |
|
399 |
self assert:t2 <= t1. |
|
400 |
self assert:(t2 = t1) not. |
|
401 |
self assert:(t2 >= t1) not. |
|
402 |
self assert:(t2 > t1) not. |
|
403 |
||
404 |
t1 := Timestamp now. |
|
405 |
t2 := t1 + 1 microseconds. |
|
406 |
self assert:t2 = (t1 addMilliseconds:0.001). |
|
407 |
||
408 |
t2 := t1 - 1 microseconds. |
|
409 |
self assert:t2 = (t1 addMilliseconds:-0.001). |
|
410 |
self assert:t2 = (t1 subtractMilliseconds:0.001). |
|
411 |
||
412 |
" |
|
413 |
self new test_20_comparing |
|
414 |
" |
|
415 |
! ! |
|
416 |
||
417 |
!TimeAndDateTest methodsFor:'tests-reading'! |
|
418 |
||
1886 | 419 |
test_01a_ReadingTimes |
420 |
self assert:(Time readFrom:'0:00' ) = (Time hours:0 minutes:0 seconds:0). |
|
421 |
self assert:(Time readFrom:'2:00' ) = (Time hours:2 minutes:0 seconds:0). |
|
422 |
self assert:(Time readFrom:'12:00' ) = (Time hours:12 minutes:0 seconds:0). |
|
423 |
self assert:(Time readFrom:'14:00' ) = (Time hours:14 minutes:0 seconds:0). |
|
424 |
self assert:(Time readFrom:'23:00' ) = (Time hours:23 minutes:0 seconds:0). |
|
346 | 425 |
|
1886 | 426 |
self assert:(Time readFrom:'18:22:00') = (Time hours:18 minutes:22 seconds:0). |
427 |
self assert:(Time readFrom:'14:00:11') = (Time hours:14 minutes:0 seconds:11). |
|
428 |
self assert:(Time readFrom:'7:00:11' ) = (Time hours:7 minutes:0 seconds:11). |
|
429 |
self assert:(Time readFrom:'0:00:00' ) = (Time hours:0 minutes:0 seconds:0). |
|
430 |
self assert:(Time readFrom:'12:00:00') = (Time hours:12 minutes:0 seconds:0). |
|
431 |
self assert:(Time readFrom:'0:00:00' ) = (Time hours:0 minutes:0 seconds:0). |
|
432 |
||
433 |
self assert:(Time readFrom:'14' ) = (Time hours:14 minutes:0 seconds:0). |
|
434 |
||
435 |
self assert:(Time readFrom:'2 am' ) = (Time hours:2 minutes:0 seconds:0). |
|
436 |
self assert:(Time readFrom:'2 pm' ) = (Time hours:14 minutes:0 seconds:0). |
|
346 | 437 |
|
1886 | 438 |
self assert:(Time readFrom:'2:30 am' ) = (Time hours:2 minutes:30 seconds:0). |
439 |
self assert:(Time readFrom:'2:30 pm' ) = (Time hours:14 minutes:30 seconds:0). |
|
440 |
self assert:(Time readFrom:'12:05 pm') = (Time hours:12 minutes:5 seconds:0). |
|
441 |
self assert:(Time readFrom:'12:06 am') = (Time hours:0 minutes:6 seconds:0). |
|
442 |
||
443 |
self assert:(Time readFrom:'6:22:00 pm' ) = (Time hours:18 minutes:22 seconds:0). |
|
444 |
self assert:(Time readFrom:'2:00:11 pm' ) = (Time hours:14 minutes:0 seconds:11). |
|
445 |
self assert:(Time readFrom:'7:00:11 am' ) = (Time hours:7 minutes:0 seconds:11). |
|
446 |
self assert:(Time readFrom:'12:00:00 am') = (Time hours:0 minutes:0 seconds:0). |
|
447 |
self assert:(Time readFrom:'0:00:00 am' ) = (Time hours:0 minutes:0 seconds:0). |
|
448 |
self assert:(Time readFrom:'12:00:00 pm') = (Time hours:12 minutes:0 seconds:0). |
|
449 |
self assert:(Time readFrom:'0:00:00 pm' onError:'invalid') = 'invalid'. |
|
450 |
||
451 |
self assert:(Time readFrom:'24:00' ) = (Time hours:0 minutes:0 seconds:0). |
|
452 |
self assert:(Time readFrom:'24:00:00') = (Time hours:0 minutes:0 seconds:0). |
|
453 |
||
454 |
self should:[Time readFrom:'24:00:00 am' ] raise:TimeConversionError. |
|
455 |
self should:[Time readFrom:'24:00:00 pm' ] raise:TimeConversionError. |
|
346 | 456 |
|
457 |
" |
|
1886 | 458 |
self new test_01a_ReadingTimes |
459 |
" |
|
460 |
||
461 |
"Created: / 09-11-2017 / 10:17:37 / cg" |
|
462 |
! |
|
463 |
||
464 |
test_01b_ReadingTimeDurations |
|
465 |
self assert:(TimeDuration readFrom:'0:00' ) = (TimeDuration hours:0 minutes:0 seconds:0). |
|
466 |
self assert:(TimeDuration readFrom:'2:00' ) = (TimeDuration hours:2 minutes:0 seconds:0). |
|
467 |
self assert:(TimeDuration readFrom:'12:00' ) = (TimeDuration hours:12 minutes:0 seconds:0). |
|
468 |
self assert:(TimeDuration readFrom:'14:00' ) = (TimeDuration hours:14 minutes:0 seconds:0). |
|
469 |
self assert:(TimeDuration readFrom:'23:00' ) = (TimeDuration hours:23 minutes:0 seconds:0). |
|
470 |
||
471 |
self assert:(TimeDuration readFrom:'18:22:00') = (TimeDuration hours:18 minutes:22 seconds:0). |
|
472 |
self assert:(TimeDuration readFrom:'14:00:11') = (TimeDuration hours:14 minutes:0 seconds:11). |
|
473 |
self assert:(TimeDuration readFrom:'7:00:11' ) = (TimeDuration hours:7 minutes:0 seconds:11). |
|
474 |
self assert:(TimeDuration readFrom:'0:00:00' ) = (TimeDuration hours:0 minutes:0 seconds:0). |
|
475 |
self assert:(TimeDuration readFrom:'12:00:00') = (TimeDuration hours:12 minutes:0 seconds:0). |
|
476 |
self assert:(TimeDuration readFrom:'0:00:00' ) = (TimeDuration hours:0 minutes:0 seconds:0). |
|
477 |
||
478 |
self assert:(TimeDuration readFrom:'14' ) = (TimeDuration hours:0 minutes:0 seconds:14). |
|
479 |
||
480 |
" |
|
481 |
self new test_01b_ReadingTimeDurations |
|
346 | 482 |
" |
1652 | 483 |
|
1886 | 484 |
"Created: / 09-11-2017 / 10:16:58 / cg" |
485 |
! |
|
486 |
||
487 |
test_01c_ReadingTimeStamps |
|
1924 | 488 |
|t| |
489 |
||
1886 | 490 |
self assert:(Timestamp readFrom:'2017-11-09 10:18:03.236') = (Timestamp year:2017 month:11 day:9 hour:10 minute:18 second:3 millisecond:236). |
491 |
||
492 |
"/ standard format |
|
493 |
self assert:(Timestamp readFrom:'2017-11-09') = (Timestamp year:2017 month:11 day:9 hour:0 minute:0 second:0). |
|
494 |
||
495 |
"/ US format |
|
496 |
self assert:(Timestamp readFrom:'12/09/2017') = (Timestamp year:2017 month:12 day:9 hour:0 minute:0 second:0). |
|
497 |
||
498 |
"/ european format |
|
499 |
self assert:(Timestamp readFrom:'9.11.2017') = (Timestamp year:2017 month:11 day:9 hour:0 minute:0 second:0). |
|
500 |
||
501 |
"/ explicit format |
|
502 |
self assert:(Timestamp readFrom:'9-nov-2017') = (Timestamp year:2017 month:11 day:9 hour:0 minute:0 second:0). |
|
503 |
"/ explicit format |
|
504 |
self assert:(Timestamp readFrom:'9. nov 2017') = (Timestamp year:2017 month:11 day:9 hour:0 minute:0 second:0). |
|
505 |
"/ explicit format |
|
506 |
self assert:(Timestamp readFrom:'9 nov 2017') = (Timestamp year:2017 month:11 day:9 hour:0 minute:0 second:0). |
|
507 |
||
1924 | 508 |
"/ milliseconds |
509 |
t := Timestamp readFrom:'2017-11-09 10:18:03.123'. |
|
510 |
self assert:(t milliseconds = 123). |
|
511 |
||
512 |
"/ microseconds |
|
513 |
t := Timestamp readFrom:'2017-11-09 10:18:03.123456'. |
|
514 |
self assert:(t microseconds = 123456). |
|
515 |
||
516 |
"/ nanoseconds |
|
517 |
t := Timestamp readFrom:'2017-11-09 10:18:03.123456789'. |
|
518 |
self assert:(t nanoseconds = 123456789). |
|
519 |
||
520 |
"/ picoseconds |
|
521 |
t := Timestamp readFrom:'2017-11-09 10:18:03.123456789012'. |
|
522 |
self assert:(t picoseconds = 123456789012). |
|
523 |
||
524 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06' format:'%day-%month-%year %h:%m:%s' language:nil onError:[self error] |
|
525 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:0). |
|
526 |
self assert:(t := Timestamp readFrom:'20021995131106' format:'%2d%2month%4y%2h%2m%2s' language:nil onError:[self error] |
|
527 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:0). |
|
528 |
self assert:(t := Timestamp readFrom:'200295131106' format:'%2d%2month%2y%2h%2m%2s' language:nil onError:[self error] |
|
529 |
) = (Timestamp year:95 month:2 day:20 hour:13 minute:11 second:6 millisecond:0). |
|
530 |
self assert:(t := Timestamp readFrom:'200260131106' format:'%2d%2month%2(y1900)%2h%2m%2s' language:nil onError:[self error] |
|
531 |
) = (Timestamp year:1960 month:2 day:20 hour:13 minute:11 second:6 millisecond:0). |
|
532 |
self assert:(t := Timestamp readFrom:'200260131106' format:'%2d%2month%2(y2000)%2h%2m%2s' language:nil onError:[self error] |
|
533 |
) = (Timestamp year:2060 month:2 day:20 hour:13 minute:11 second:6 millisecond:0). |
|
534 |
self assert:(t := Timestamp readFrom:'200260131106' format:'%2d%2month%2(y1950)%2h%2m%2s' language:nil onError:[self error] |
|
535 |
) = (Timestamp year:1960 month:2 day:20 hour:13 minute:11 second:6 millisecond:0). |
|
536 |
self assert:(t := Timestamp readFrom:'200260131106' format:'%2d%2month%2(y1980)%2h%2m%2s' language:nil onError:[self error] |
|
537 |
) = (Timestamp year:2060 month:2 day:20 hour:13 minute:11 second:6 millisecond:0). |
|
538 |
self assert:(t := Timestamp readFrom:'March 7 2009 2:30pm ' format:'%monthName %day %year %u:%m%a' language:#en onError:[self error] |
|
539 |
) = (Timestamp year:2009 month:3 day:7 hour:14 minute:30 second:0 millisecond:0). "/ EST is 5hrs behind |
|
540 |
self assert:(t := Timestamp readFrom:'March 7 2009 2:30am ' format:'%monthName %day %year %u:%m%a' language:#en onError:[self error] |
|
541 |
) = (Timestamp year:2009 month:3 day:7 hour:2 minute:30 second:0 millisecond:0). "/ EST is 5hrs behind |
|
542 |
||
1927 | 543 |
"/ Timestamp readIso8601FormatFrom:'20090307T183000-05' |
544 |
"/ Timestamp readIso8601FormatFrom:'20090307T233000Z' |
|
545 |
self assert:(t := Timestamp readFrom:'March 7 2009 6:30pm EST' format:'%monthName %day %year %u:%m%a %tz' language:#en onError:[self error] |
|
546 |
) = (UtcTimestamp year:2009 month:3 day:7 hour:23 minute:30 second:0 millisecond:0). "/ EST is 5hrs behind |
|
1924 | 547 |
|
548 |
self assert:(t := Timestamp readFrom:'March 7 2009 7:30pm UTC' format:'%monthName %day %year %u:%m%a %tz' language:#en onError:[self error] |
|
1927 | 549 |
) = (UtcTimestamp year:2009 month:3 day:7 hour:19 minute:30 second:0 millisecond:0). |
1924 | 550 |
|
551 |
self assert:(t := Timestamp readFrom:'2015103' format:'%4y%3dayOfYear' onError:[self error] |
|
1927 | 552 |
) = (Timestamp year:2015 month:4 day:13 hour:0 minute:0 second:0 millisecond:0). |
553 |
self assert:t asDate dayOfYear == 103. |
|
1924 | 554 |
|
555 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.999' format:'%day-%month-%year %h:%m:%s.%i' language:nil onError:[self error] |
|
556 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:999). |
|
557 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.100' format:'%day-%month-%year %h:%m:%s.%i' language:nil onError:[self error] |
|
558 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:100). |
|
559 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.010' format:'%day-%month-%year %h:%m:%s.%i' language:nil onError:[self error] |
|
1927 | 560 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:10). |
1924 | 561 |
|
562 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.1' format:'%day-%month-%year %h:%m:%s.%f' language:nil onError:[self error] |
|
563 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:100). |
|
564 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.01' format:'%day-%month-%year %h:%m:%s.%f' language:nil onError:[self error] |
|
565 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:10). |
|
566 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.001' format:'%day-%month-%year %h:%m:%s.%f' language:nil onError:[self error] |
|
567 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 millisecond:1). |
|
1927 | 568 |
|
1924 | 569 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.12345' format:'%day-%month-%year %h:%m:%s.%f' language:nil onError:[self error] |
1927 | 570 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 microsecond:123000). |
571 |
||
572 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.12345' format:'%day-%month-%year %h:%m:%s.%F' language:nil onError:[self error] |
|
1924 | 573 |
) = (Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6 microsecond:123450). |
574 |
||
1927 | 575 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.12345678' format:'%day-%month-%year %h:%m:%s.%F' language:nil onError:[self error] |
576 |
) = ((Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6)+123456780 nanoseconds). |
|
577 |
||
578 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.123456' format:'%day-%month-%year %h:%m:%s.%F' language:nil onError:[self error] |
|
579 |
) = ((Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6)+123456 microseconds). |
|
580 |
||
581 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.123456789' format:'%day-%month-%year %h:%m:%s.%F' language:nil onError:[self error] |
|
582 |
) = ((Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6)+123456789 nanoseconds). |
|
583 |
||
584 |
self assert:(t := Timestamp readFrom:'20-2-1995 13:11:06.123456789012' format:'%day-%month-%year %h:%m:%s.%F' language:nil onError:[self error] |
|
585 |
) = ((Timestamp year:1995 month:2 day:20 hour:13 minute:11 second:6)+123456789012 picoseconds). |
|
586 |
||
1886 | 587 |
" |
588 |
self new test_01c_ReadingTimeStamps |
|
589 |
" |
|
590 |
||
591 |
"Created: / 09-11-2017 / 10:19:19 / cg" |
|
1992 | 592 |
"Modified: / 27-07-2018 / 09:07:58 / Stefan Vogel" |
365 | 593 |
! |
594 |
||
1940 | 595 |
test_01d_ReadingTimeStamps |
596 |
|t| |
|
597 |
||
598 |
self assert:(t := Timestamp readFrom:'2017-11-09 10:18:03.236') printStringIso8601Format = '2017-11-09T10:18:03.236'. |
|
599 |
self assert:(t isLocalTimestamp). |
|
600 |
self assert:(t isUtcTimestamp not). |
|
601 |
self assert:(t isTZTimestamp not). |
|
602 |
||
603 |
self assert:(t := Timestamp readFrom:'2017-11-09 10:18:03.236Z') printStringIso8601Format = '2017-11-09T10:18:03.236Z'. |
|
604 |
self assert:(t isLocalTimestamp not). |
|
605 |
self assert:(t isUtcTimestamp). |
|
606 |
self assert:(t isTZTimestamp not). |
|
607 |
||
608 |
self should:[ Timestamp readFrom:'2017-11-09 10:18:03.236+1'] raise:Error. |
|
609 |
self should:[ Timestamp readIso8601FormatFrom:'2017-11-09 10:18:03.236+1'] raise:TimeConversionError. |
|
610 |
||
611 |
self assert:(t := Timestamp readFrom:'2017-11-09 10:18:03.236+01') printStringIso8601Format = '2017-11-09T10:18:03.236+01'. |
|
612 |
self assert:(t isLocalTimestamp not). |
|
613 |
self assert:(t isUtcTimestamp not). |
|
614 |
self assert:(t isTZTimestamp). |
|
615 |
||
616 |
" |
|
617 |
self new test_01d_ReadingTimeStamps |
|
618 |
" |
|
619 |
||
620 |
"Created: / 24-05-2018 / 17:45:08 / Claus Gittinger" |
|
621 |
! |
|
622 |
||
365 | 623 |
test_02_ReadingDates |
624 |
||
1447 | 625 |
self assert:(Date |
626 |
readFrom:'2-may-2010' |
|
627 |
printFormat:'%d-%shortMonthName-%y' |
|
628 |
language:'en' |
|
629 |
onError:[self error] |
|
630 |
) = (Date newDay:2 month:5 year:2010). |
|
365 | 631 |
|
736 | 632 |
{ |
1447 | 633 |
{ '3-jan-2012' . (Date newDay:3 month:1 year:2012) } . |
634 |
{ '15-feb-2012' . (Date newDay:15 month:2 year:2012) } . |
|
635 |
{ '06-mar-2011' . (Date newDay:6 month:3 year:2011) } . |
|
636 |
{ '19-apr-2013' . (Date newDay:19 month:4 year:2013) } . |
|
637 |
{ '21-may-2015' . (Date newDay:21 month:5 year:2015) } . |
|
638 |
{ '21-jun-2015' . (Date newDay:21 month:6 year:2015) } . |
|
639 |
{ '21-jul-2015' . (Date newDay:21 month:7 year:2015) } . |
|
640 |
{ '21-aug-2015' . (Date newDay:21 month:8 year:2015) } . |
|
641 |
{ '21-sep-2015' . (Date newDay:21 month:9 year:2015) } . |
|
642 |
{ '21-oct-2015' . (Date newDay:21 month:10 year:2015) } . |
|
643 |
{ '21-nov-2015' . (Date newDay:21 month:11 year:2015) } . |
|
644 |
{ '21-dec-2015' . (Date newDay:21 month:12 year:2015) } . |
|
736 | 645 |
} do:[:eachTestPair | |
1447 | 646 |
self assert:(Date |
647 |
readFrom:(eachTestPair first) |
|
648 |
printFormat:'%d-%shortMonthName-%y' |
|
649 |
language:'en' |
|
650 |
onError:[self error] |
|
651 |
) = (eachTestPair second). |
|
736 | 652 |
]. |
653 |
||
1447 | 654 |
self assert:(Date |
655 |
readFrom:'2-may-2010' |
|
656 |
printFormat:'%d-%monthName-%y' |
|
657 |
language:'en' |
|
658 |
onError:[self error] |
|
659 |
) = (Date newDay:2 month:5 year:2010). |
|
365 | 660 |
|
1447 | 661 |
self assert:(Date |
662 |
readFrom:'2-may-2010' |
|
663 |
printFormat:'%d-%(shortMonthName)-%y' |
|
664 |
language:'en' |
|
665 |
onError:[self error] |
|
666 |
) = (Date newDay:2 month:5 year:2010). |
|
366 | 667 |
|
1447 | 668 |
self assert:(Date |
669 |
readFrom:'2-may-2010' |
|
670 |
printFormat:'%d-%(monthName)-%y' |
|
671 |
language:'en' |
|
672 |
onError:[self error] |
|
673 |
) = (Date newDay:2 month:5 year:2010). |
|
366 | 674 |
|
1447 | 675 |
self assert:(Date |
676 |
readFrom:'2-5-2010' |
|
677 |
printFormat:'%d-%m-%y' |
|
678 |
onError:[self error] |
|
679 |
) = (Date newDay:2 month:5 year:2010). |
|
365 | 680 |
|
1447 | 681 |
self assert:(Date |
682 |
readFrom:'5/2/2010' |
|
683 |
printFormat:'%m/%d/%y' |
|
684 |
onError:[self error] |
|
685 |
) = (Date newDay:2 month:5 year:2010). |
|
365 | 686 |
|
1447 | 687 |
self assert:(Date |
688 |
readFrom:'2010-5-2' |
|
689 |
printFormat:'%y-%m-%d' |
|
690 |
onError:[self error] |
|
691 |
) = (Date newDay:2 month:5 year:2010). |
|
365 | 692 |
|
693 |
" |
|
694 |
self new test_02_ReadingDates |
|
695 |
" |
|
736 | 696 |
! |
697 |
||
1217
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
698 |
test_06_readingISO8601 |
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
699 |
{ |
1447 | 700 |
{ '2004-W53-6' . 'sat' . (Date newDay:1 month:1 year:2005) } . |
701 |
{ '2004-W53-7' . 'sun' . (Date newDay:2 month:1 year:2005) } . |
|
702 |
{ '2005-W52-6' . 'sat' . (Date newDay:31 month:12 year:2005) } . |
|
703 |
{ '2007-W01-1' . 'mon' . (Date newDay:1 month:1 year:2007) } . |
|
704 |
{ '2007-W52-7' . 'sun' . (Date newDay:30 month:12 year:2007) } . |
|
1217
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
705 |
|
1447 | 706 |
{ '2008-W01-1' . 'mon' . (Date newDay:31 month:12 year:2007) } . |
707 |
{ '2008-W01-2' . 'tue' . (Date newDay:1 month:1 year:2008) } . |
|
708 |
{ '2008-W52-7' . 'sun' . (Date newDay:28 month:12 year:2008) } . |
|
1217
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
709 |
|
1447 | 710 |
{ '2009-W01-1' . 'mon' . (Date newDay:29 month:12 year:2008) } . |
711 |
{ '2009-W01-2' . 'tue' . (Date newDay:30 month:12 year:2008) } . |
|
712 |
{ '2009-W01-3' . 'wed' . (Date newDay:31 month:12 year:2008) } . |
|
713 |
{ '2009-W01-4' . 'thu' . (Date newDay:1 month:1 year:2009) } . |
|
1217
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
714 |
|
1447 | 715 |
{ '2009-W53-4' . 'thu' . (Date newDay:31 month:12 year:2009) } . |
716 |
{ '2009-W53-5' . 'fri' . (Date newDay:1 month:1 year:2010) } . |
|
717 |
{ '2009-W53-6' . 'sat' . (Date newDay:2 month:1 year:2010) } . |
|
718 |
{ '2009-W53-7' . 'sun' . (Date newDay:3 month:1 year:2010) } . |
|
1217
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
719 |
} do:[:eachTriple | |
1447 | 720 |
|input expected expectedDayName got gotName| |
1217
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
721 |
|
1447 | 722 |
input := eachTriple first. |
723 |
expectedDayName := eachTriple second. |
|
724 |
expected := eachTriple third. |
|
725 |
got := (Timestamp readIso8601FormatFrom:input onError:nil) asDate. |
|
726 |
self assert:(got = expected) description:'wrong: ',input. |
|
727 |
gotName := got abbreviatedDayNameForLanguage:#en. |
|
728 |
self assert:gotName = expectedDayName description:'expected: ',expectedDayName asString,' got: ',gotName asString. |
|
1217
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
729 |
] |
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
730 |
|
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
731 |
" |
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
732 |
self new test_06_calenderWeek_fails |
ee9044742185
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1077
diff
changeset
|
733 |
" |
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
734 |
! |
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
735 |
|
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
736 |
test_07_readingISO8601 |
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
737 |
"tests reading into a 'natural' timestamp - that is if there was a TZ info, |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
738 |
that will be printed. If not, it will remain a local timestamp. |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
739 |
Presenting timestamps this way is not usually a good idea, except for GUI |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
740 |
(but not for data exchange)" |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
741 |
|
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
742 |
{ |
1447 | 743 |
{ '1995-02-20T13:11:06.123' . '1995-02-20 13:11:06.123' } . |
744 |
{ '1995-02-20T13:11:06' . '1995-02-20 13:11:06' } . |
|
745 |
{ '1995-02T13:11:06' . '1995-02-01 13:11:06' } . |
|
746 |
{ '1995T13:11:06' . '1995-01-01 13:11:06' } . |
|
747 |
{ '1995T13:11' . '1995-01-01 13:11:00' } . |
|
748 |
{ '1995T13:11.5' . '1995-01-01 13:11:30' } . |
|
749 |
{ '1995T13:11,5' . '1995-01-01 13:11:30' } . |
|
750 |
{ '1995T13' . '1995-01-01 13:00:00' } . |
|
751 |
{ '1995T13.25' . '1995-01-01 13:15:00' } . |
|
752 |
{ '1995T13.333333' . '1995-01-01 13:19:59.999' } . |
|
753 |
{ '1995' . '1995-01-01 00:00:00' } . |
|
754 |
{ '1995-02' . '1995-02-01 00:00:00' } . |
|
755 |
{ '19950204' . '1995-02-04 00:00:00' } . |
|
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
756 |
|
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
757 |
"/ day in year |
1447 | 758 |
{ '1995-001' . '1995-01-01 00:00:00' } . |
759 |
{ '1995-035' . '1995-02-04 00:00:00' } . |
|
760 |
{ '1995035' . '1995-02-04 00:00:00' } . |
|
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
761 |
|
1447 | 762 |
{ '1997-01-01' . '1997-01-01 00:00:00' } . |
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
763 |
"/ week and weekday |
1447 | 764 |
{ '1997-W01' . '1996-12-30 00:00:00' } . |
765 |
{ '1997W01' . '1996-12-30 00:00:00' } . |
|
766 |
{ '1997W01-1' . '1996-12-30 00:00:00' } . |
|
767 |
{ '1997W011' . '1996-12-30 00:00:00' } . |
|
768 |
{ '1997W01' . '1996-12-30 00:00:00' } . |
|
769 |
{ '1997W01-2' . '1996-12-31 00:00:00' } . |
|
770 |
{ '1997-W01-2' . '1996-12-31 00:00:00' } . |
|
771 |
{ '1997W012' . '1996-12-31 00:00:00' } . |
|
772 |
{ '2014W40' . '2014-09-29 00:00:00' } . |
|
773 |
{ '2014W44-4' . '2014-10-30 00:00:00' } . |
|
774 |
{ '2014W01' . '2013-12-30 00:00:00' } . |
|
775 |
{ '2014W01-1' . '2013-12-30 00:00:00' } . |
|
776 |
{ '2014W01-2' . '2013-12-31 00:00:00' } . |
|
777 |
{ '2014W01-3' . '2014-01-01 00:00:00' } . |
|
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
778 |
|
1447 | 779 |
{ '1995-02-20 13:11' . '1995-02-20 13:11:00' } . |
780 |
{ '1995-02-20 1311' . '1995-02-20 13:11:00' } . |
|
781 |
{ '1995-02-20 13' . '1995-02-20 13:00:00' } . |
|
782 |
{ '1995-02-20 235959' . '1995-02-20 23:59:59' } . |
|
783 |
{ '19950220 235959' . '1995-02-20 23:59:59' } . |
|
784 |
{ '19950220 23:59:59.9942' . '1995-02-20 23:59:59.994' } . |
|
785 |
{ '19950220 235959.9942' . '1995-02-20 23:59:59.994' } . |
|
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
786 |
|
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
787 |
"/ local vs. UTC |
1447 | 788 |
{ '1995-02-20 13:11:06' . '1995-02-20 13:11:06' } . |
789 |
{ '1995-02-20 13:11:06Z' . '1995-02-20 13:11:06Z' } . |
|
790 |
{ '1995-02-20 13:11:06+01' . '1995-02-20 13:11:06+01' } . |
|
791 |
{ '1995-02-20 13:11:06+01:00' . '1995-02-20 13:11:06+01' } . |
|
792 |
{ '1995-02-20 13:11:06+01:30' . '1995-02-20 13:11:06+01:30' } . |
|
793 |
{ '1995-02-20 13:11:06+0130' . '1995-02-20 13:11:06+01:30' } . |
|
794 |
{ '1995-02-20 13:11:06-01' . '1995-02-20 13:11:06-01' } . |
|
795 |
{ '1995-02-20 13:11:06-01:00' . '1995-02-20 13:11:06-01' } . |
|
796 |
{ '1995-02-20 13:11:06-01:30' . '1995-02-20 13:11:06-01:30' } . |
|
797 |
{ '1995-02-20 13:11:06-0130' . '1995-02-20 13:11:06-01:30' } . |
|
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
798 |
|
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
799 |
"/ 24 is allowed with ISO, and is 00:00 of the next day: |
1447 | 800 |
{ '1995-02-20 24:00:00' . '1995-02-21 00:00:00' } . |
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
801 |
} do:[:eachPair | |
1447 | 802 |
|s1 t expected got| |
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
803 |
|
1447 | 804 |
s1 := eachPair first. |
805 |
t := Timestamp readIso8601FormatFrom:s1. |
|
806 |
expected := eachPair second. |
|
807 |
got := t asString. |
|
808 |
self assert:(got = expected) description:'expected: ',expected,' got:',got. |
|
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
809 |
]. |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
810 |
|
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
811 |
" |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
812 |
self new test_07_readingISO8601 |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
813 |
" |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
814 |
! |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
815 |
|
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
816 |
test_07b_readingISO8601UTC |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
817 |
"tests reading into an utc timestamp" |
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
818 |
|
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
819 |
{ |
1447 | 820 |
{ '1995-02-20T13:11:06.123' . '1995-02-20 13:11:06.123Z' } . |
821 |
{ '1995-02-20T13:11:06' . '1995-02-20 13:11:06Z' } . |
|
822 |
{ '1995-02T13:11:06' . '1995-02-01 13:11:06Z' } . |
|
823 |
{ '1995T13:11:06' . '1995-01-01 13:11:06Z' } . |
|
824 |
{ '1995T13:11' . '1995-01-01 13:11:00Z' } . |
|
825 |
{ '1995T13:11.5' . '1995-01-01 13:11:30Z' } . |
|
826 |
{ '1995T13:11,5' . '1995-01-01 13:11:30Z' } . |
|
827 |
{ '1995T13' . '1995-01-01 13:00:00Z' } . |
|
828 |
{ '1995T13.25' . '1995-01-01 13:15:00Z' } . |
|
829 |
{ '1995T13.333333' . '1995-01-01 13:19:59.999Z' } . |
|
830 |
{ '1995' . '1995-01-01 00:00:00Z' } . |
|
831 |
{ '1995-02' . '1995-02-01 00:00:00Z' } . |
|
832 |
{ '19950204' . '1995-02-04 00:00:00Z' } . |
|
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
833 |
|
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
834 |
"/ day in year |
1447 | 835 |
{ '1995-001' . '1995-01-01 00:00:00Z' } . |
836 |
{ '1995-035' . '1995-02-04 00:00:00Z' } . |
|
837 |
{ '1995035' . '1995-02-04 00:00:00Z' } . |
|
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
838 |
|
1447 | 839 |
{ '1997-01-01' . '1997-01-01 00:00:00Z' } . |
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
840 |
"/ week and weekday |
1447 | 841 |
{ '1997-W01' . '1996-12-30 00:00:00Z' } . |
842 |
{ '1997W01' . '1996-12-30 00:00:00Z' } . |
|
843 |
{ '1997W01-1' . '1996-12-30 00:00:00Z' } . |
|
844 |
{ '1997W011' . '1996-12-30 00:00:00Z' } . |
|
845 |
{ '1997W01' . '1996-12-30 00:00:00Z' } . |
|
846 |
{ '1997W01-2' . '1996-12-31 00:00:00Z' } . |
|
847 |
{ '1997-W01-2' . '1996-12-31 00:00:00Z' } . |
|
848 |
{ '1997W012' . '1996-12-31 00:00:00Z' } . |
|
849 |
{ '2014W40' . '2014-09-29 00:00:00Z' } . |
|
850 |
{ '2014W44-4' . '2014-10-30 00:00:00Z' } . |
|
851 |
{ '2014W01' . '2013-12-30 00:00:00Z' } . |
|
852 |
{ '2014W01-1' . '2013-12-30 00:00:00Z' } . |
|
853 |
{ '2014W01-2' . '2013-12-31 00:00:00Z' } . |
|
854 |
{ '2014W01-3' . '2014-01-01 00:00:00Z' } . |
|
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
855 |
|
1447 | 856 |
{ '1995-02-20 13:11' . '1995-02-20 13:11:00Z' } . |
857 |
{ '1995-02-20 1311' . '1995-02-20 13:11:00Z' } . |
|
858 |
{ '1995-02-20 13' . '1995-02-20 13:00:00Z' } . |
|
859 |
{ '1995-02-20 235959' . '1995-02-20 23:59:59Z' } . |
|
860 |
{ '19950220 235959' . '1995-02-20 23:59:59Z' } . |
|
861 |
{ '19950220 23:59:59.9942' . '1995-02-20 23:59:59.994Z' } . |
|
862 |
{ '19950220 235959.9942' . '1995-02-20 23:59:59.994Z' } . |
|
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
863 |
|
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
864 |
"/ local vs. UTC |
1447 | 865 |
{ '1995-02-20 13:11:06' . '1995-02-20 13:11:06Z' } . |
866 |
{ '1995-02-20 13:11:06Z' . '1995-02-20 13:11:06Z' } . |
|
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
867 |
{ '1995-02-20 13:11:06+01' . '1995-02-20 12:11:06Z' } . "/ notice the changed time here!!!!!! |
1447 | 868 |
{ '1995-02-20 13:11:06+01:00' . '1995-02-20 12:11:06Z' } . "/ notice the changed time here!!!!!! |
869 |
{ '1995-02-20 13:11:06+01:30' . '1995-02-20 11:41:06Z' } . "/ notice the changed time here!!!!!! |
|
870 |
{ '1995-02-20 13:11:06+0130' . '1995-02-20 11:41:06Z' } . "/ notice the changed time here!!!!!! |
|
871 |
{ '1995-02-20 13:11:06-01' . '1995-02-20 14:11:06Z' } . |
|
872 |
{ '1995-02-20 13:11:06-01:00' . '1995-02-20 14:11:06Z' } . |
|
873 |
{ '1995-02-20 13:11:06-01:30' . '1995-02-20 14:41:06Z' } . |
|
874 |
{ '1995-02-20 13:11:06-0130' . '1995-02-20 14:41:06Z' } . |
|
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
875 |
|
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
876 |
"/ 24 is allowed with ISO, and is 00:00 of the next day: |
1447 | 877 |
{ '1995-02-20 24:00:00' . '1995-02-21 00:00:00Z' } . |
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
878 |
} do:[:eachPair | |
1447 | 879 |
|s1 t expected got| |
1226
b5123dd5c3da
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1225
diff
changeset
|
880 |
|
1447 | 881 |
s1 := eachPair first. |
882 |
t := UtcTimestamp readIso8601FormatFrom:s1. |
|
883 |
expected := eachPair second. |
|
884 |
got := t asString. |
|
885 |
self assert:(got = expected) description:'expected: ',expected,' got:',got. |
|
1219
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
886 |
]. |
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
887 |
|
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
888 |
" |
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
889 |
self new test_07_readingISO8601 |
369f5bac6379
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
890 |
" |
1220
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
891 |
! |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
892 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
893 |
test_08_readingISO8601_date |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
894 |
"/ the old ISO8601Builder tests moved to here |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
895 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
896 |
| ts reader | |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
897 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
898 |
reader := Timestamp::TimestampISO8601Builder. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
899 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
900 |
ts := UtcTimestamp |
1447 | 901 |
year: 2005 month: 6 day: 15 |
902 |
hour: 0 minute: 0 second: 0 millisecond: 0. |
|
1220
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
903 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
904 |
"Test common dates" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
905 |
self assert: ts = (reader read: '20050615' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
906 |
self assert: ts = (reader read: '2005-06-15' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
907 |
self assert: ts = (reader read: '05-06-15' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
908 |
self assert: ts = (reader read: '05-0615' withClass:UtcTimestamp). "/ Is this correct? |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
909 |
self assert: ts = (reader read: ':50615' withClass:UtcTimestamp). "/ Should not happen and should not appear after 2009 |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
910 |
self assert: ts = (reader read: '200506-15' withClass:UtcTimestamp). "/ Is this corect? |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
911 |
self assert: ts = (reader read: '105-06-15' withClass:UtcTimestamp). "/ Should not happen |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
912 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
913 |
"Test week numbers" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
914 |
self assert: ts = (reader read: '05W243' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
915 |
self assert: ts = (reader read: '2005W24-3' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
916 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
917 |
"Test day numbers" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
918 |
self assert: ts = (reader read: '2005-166' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
919 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
920 |
ts := UtcTimestamp year: 2004 month: 12 day: 31 hour: 0 minute: 0 second: 0 millisecond: 0. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
921 |
self assert: ts = (reader read: '2004-366' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
922 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
923 |
ts := UtcTimestamp year: 2005 month: 12 day: 31 hour: 0 minute: 0 second: 0 millisecond: 0. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
924 |
self assert: ts = (reader read: '2005-365' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
925 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
926 |
"Test february" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
927 |
ts := UtcTimestamp year: 2000 month: 2 day: 28 hour: 0 minute: 0 second: 0 millisecond: 0. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
928 |
self assert: ts = (reader read: '20000228' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
929 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
930 |
ts := UtcTimestamp year: 2000 month: 2 day: 29 hour: 0 minute: 0 second: 0 millisecond: 0. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
931 |
self assert: ts = (reader read: '20000229' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
932 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
933 |
" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
934 |
self new test_08_readingISO8601 |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
935 |
" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
936 |
! |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
937 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
938 |
test_09_readingISO8601_edge |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
939 |
"/ the old ISO8601Builder tests moved to here |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
940 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
941 |
| ts reader | |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
942 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
943 |
reader := Timestamp::TimestampISO8601Builder. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
944 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
945 |
self should: [reader read: '20050229' withClass:UtcTimestamp] raise:ConversionError. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
946 |
self should: [reader read: '20050029' withClass:UtcTimestamp] raise:ConversionError. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
947 |
self should: [reader read: '20050332' withClass:UtcTimestamp] raise:ConversionError. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
948 |
self should: [reader read: '2005-366' withClass:UtcTimestamp] raise:ConversionError. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
949 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
950 |
ts := UtcTimestamp year: 2005 month: 1 day: 1 hour: 0 minute: 0 second: 0 millisecond: 0. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
951 |
self assert: ts = (reader read: '20041231T22-0200' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
952 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
953 |
ts := UtcTimestamp year: 2004 month: 12 day: 31 hour: 22 minute: 0 second: 0 millisecond: 0. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
954 |
self assert: ts = (reader read: '20050101T0000+0200' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
955 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
956 |
" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
957 |
self new test_08_readingISO8601 |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
958 |
" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
959 |
! |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
960 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
961 |
test_10_readingISO8601_time |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
962 |
"/ the old ISO8601Builder tests moved to here |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
963 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
964 |
| ts reader | |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
965 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
966 |
reader := Timestamp::TimestampISO8601Builder. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
967 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
968 |
ts := UtcTimestamp year: 2005 month: 6 day: 15 hour: 17 minute: 37 second: 0 millisecond: 0. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
969 |
self assert: ts = (reader read: '2005-06-15 17:37' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
970 |
self assert: ts = (reader read: '20050615T1737' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
971 |
self assert: ts = (reader read: '05-0615T17:3700' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
972 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
973 |
ts := UtcTimestamp year: 2005 month: 6 day: 15 hour: 17 minute: 37 second: 0 millisecond: 30. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
974 |
self assert: ts = (reader read: '05-0615T17:3700.03' withClass:UtcTimestamp). |
1924 | 975 |
self assert: ts = (reader read: '2005-06-15T17:37:00.030' withClass:UtcTimestamp). |
976 |
||
977 |
ts := UtcTimestamp year: 2005 month: 6 day: 15 hour: 17 minute: 37 second: 0 microsecond:300. |
|
978 |
self assert: ts = (reader read: '05-0615T17:3700.0003' withClass:UtcTimestamp). |
|
979 |
self assert: ts = (reader read: '2005-06-15T17:37:00.0003-00:00' withClass:UtcTimestamp). |
|
1220
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
980 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
981 |
" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
982 |
self new test_10_readingISO8601_time |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
983 |
" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
984 |
! |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
985 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
986 |
test_11_readingISO8601_timezone |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
987 |
"/ the old ISO8601Builder tests moved to here |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
988 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
989 |
| ts reader | |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
990 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
991 |
reader := Timestamp::TimestampISO8601Builder. |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
992 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
993 |
ts := UtcTimestamp |
1447 | 994 |
year: 2005 month: 6 day: 15 |
995 |
hour: 17 minute: 37 second: 0 millisecond: 0. |
|
1220
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
996 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
997 |
self assert: ts = (reader read: '2005-06-15T17:37Z' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
998 |
self assert: ts = (reader read: '2005-06-15T17:37+0000' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
999 |
self assert: ts = (reader read: '2005-06-15T17:37-00:00' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
1000 |
self assert: ts = (reader read: '2005-06-15T15:37:00-0200' withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
1001 |
self assert: ts = (reader read: '2005-06-15T19:37:00+0200'withClass:UtcTimestamp). |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
1002 |
|
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
1003 |
" |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
1004 |
self new test_11_readingISO8601_timezone |
e8277d9a8677
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
1005 |
" |
1222
b476e1efa7f1
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1220
diff
changeset
|
1006 |
! |
b476e1efa7f1
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1220
diff
changeset
|
1007 |
|
1244
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1008 |
test_16_readingOtherFormats |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1009 |
| ts | |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1010 |
|
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1011 |
"/ european format |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1012 |
ts := Timestamp readFrom: '16-09-2013 00:42:35' readStream. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1013 |
|
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1014 |
self assert: ts day = 16. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1015 |
self assert: ts month = 9. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1016 |
self assert: ts year = 2013. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1017 |
self assert: ts hours = 0. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1018 |
self assert: ts minutes = 42. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1019 |
self assert: ts seconds = 35. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1020 |
|
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1021 |
"/ us format |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1022 |
ts := Timestamp readFrom: '11/21/2013 00:42:35' readStream. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1023 |
|
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1024 |
self assert: ts day = 21. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1025 |
self assert: ts month = 11. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1026 |
self assert: ts year = 2013. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1027 |
self assert: ts hours = 0. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1028 |
self assert: ts minutes = 42. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1029 |
self assert: ts seconds = 35. |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1030 |
|
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1031 |
" |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1032 |
self new test_16_readingOtherFormats |
850ca3a30a23
class: RegressionTests::TimeAndDateTest
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
1033 |
" |
1886 | 1034 |
! |
1035 |
||
1036 |
test_17_readingBrokenStrings |
|
1037 |
"endless loop happened with: |
|
1038 |
Timestamp readFrom:'0' onError:#foo |
|
1039 |
" |
|
1040 |
||
1041 |
#( |
|
1042 |
'' |
|
1043 |
'0' |
|
1044 |
'1' |
|
1045 |
'1-' |
|
1046 |
'1-1' |
|
1047 |
'1-1-' |
|
1048 |
'1-1-1 10' |
|
1049 |
'0-0-0' |
|
1050 |
) do:[:eachBadString | |
|
1051 |
| ts | |
|
1052 |
||
1053 |
"/ should not run into an endless loop |
|
1054 |
[ |
|
1055 |
ts := Timestamp readFrom:eachBadString onError:#foo. |
|
1056 |
] valueWithTimeout:(50 milliseconds). |
|
1057 |
||
1058 |
self assert: (ts notNil) description:'timestamp reading leads to endless loop'. |
|
1059 |
self assert: ts == #foo. |
|
1060 |
]. |
|
1061 |
||
1062 |
" |
|
1063 |
self new test_17_readingBrokenStrings |
|
1064 |
" |
|
1065 |
||
1066 |
"Created: / 09-11-2017 / 10:00:30 / cg" |
|
1924 | 1067 |
! |
1068 |
||
2330 | 1069 |
test_21_readingDateInVariousFormats |
1070 |
{ |
|
1071 |
'1.1.1990' . '%d %m %y' . (Date year:1990 month:1 day:1 ) . |
|
1072 |
'1.1.2090' . '%d %m %y' . (Date year:2090 month:1 day:1 ) . |
|
1073 |
||
1074 |
'1.1.49' . '%d %m %(Y1950)' . (Date year:2049 month:1 day:1 ) . |
|
1075 |
'1.1.50' . '%d %m %(Y1950)' . (Date year:1950 month:1 day:1 ) . |
|
1076 |
'1.1.51' . '%d %m %(Y1950)' . (Date year:1951 month:1 day:1 ) . |
|
1077 |
'1.1.99' . '%d %m %(Y1950)' . (Date year:1999 month:1 day:1 ) . |
|
1924 | 1078 |
|
2330 | 1079 |
'1.1.69' . '%d %m %(Y1970)' . (Date year:2069 month:1 day:1 ) . |
1080 |
'1.1.70' . '%d %m %(Y1970)' . (Date year:1970 month:1 day:1 ) . |
|
1081 |
'1.1.71' . '%d %m %(Y1970)' . (Date year:1971 month:1 day:1 ) . |
|
1082 |
'1.1.99' . '%d %m %(Y1970)' . (Date year:1999 month:1 day:1 ) . |
|
1924 | 1083 |
|
2330 | 1084 |
'1.1.79' . '%d %m %(Y1980)' . (Date year:2079 month:1 day:1 ) . |
1085 |
'1.1.80' . '%d %m %(Y1980)' . (Date year:1980 month:1 day:1 ) . |
|
1086 |
'1.1.81' . '%d %m %(Y1980)' . (Date year:1981 month:1 day:1 ) . |
|
1087 |
'1.1.99' . '%d %m %(Y1980)' . (Date year:1999 month:1 day:1 ) . |
|
1924 | 1088 |
|
2330 | 1089 |
'1.1.49' . '%d %m %(Y1900)' . (Date year:1949 month:1 day:1 ) . |
1090 |
'1.1.69' . '%d %m %(Y1900)' . (Date year:1969 month:1 day:1 ) . |
|
1091 |
'1.1.79' . '%d %m %(Y1900)' . (Date year:1979 month:1 day:1 ) . |
|
1092 |
'1.1.80' . '%d %m %(Y1900)' . (Date year:1980 month:1 day:1 ) . |
|
1093 |
'1.1.81' . '%d %m %(Y1900)' . (Date year:1981 month:1 day:1 ) . |
|
1094 |
'1.1.99' . '%d %m %(Y1900)' . (Date year:1999 month:1 day:1 ) . |
|
1924 | 1095 |
|
2330 | 1096 |
'1.1.49' . '%d %m %(Y2000)' . (Date year:2049 month:1 day:1 ) . |
1097 |
'1.1.69' . '%d %m %(Y2000)' . (Date year:2069 month:1 day:1 ) . |
|
1098 |
'1.1.79' . '%d %m %(Y2000)' . (Date year:2079 month:1 day:1 ) . |
|
1099 |
'1.1.80' . '%d %m %(Y2000)' . (Date year:2080 month:1 day:1 ) . |
|
1100 |
'1.1.81' . '%d %m %(Y2000)' . (Date year:2081 month:1 day:1 ) . |
|
1101 |
'1.1.99' . '%d %m %(Y2000)' . (Date year:2099 month:1 day:1 ) . |
|
1102 |
} inGroupsOf:3 do:[:str :fmt :expected | |
|
1103 |
| result | |
|
1924 | 1104 |
|
2330 | 1105 |
result := Date readFrom:str format:fmt onError:#foo. |
1106 |
||
1107 |
self assert: result = expected. |
|
1108 |
]. |
|
1109 |
||
1924 | 1110 |
" |
2330 | 1111 |
self new test_21_readingDateInVariousFormats |
1112 |
" |
|
1924 | 1113 |
|
2330 | 1114 |
"Created: / 09-11-2017 / 10:00:30 / cg" |
346 | 1115 |
! ! |
1116 |
||
1117 |
!TimeAndDateTest class methodsFor:'documentation'! |
|
1118 |
||
1119 |
version |
|
1120 |
^ '$Header$' |
|
737
06d8d2821c46
changed: #test_03_calenderWeek
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1121 |
! |
06d8d2821c46
changed: #test_03_calenderWeek
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1122 |
|
06d8d2821c46
changed: #test_03_calenderWeek
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1123 |
version_CVS |
06d8d2821c46
changed: #test_03_calenderWeek
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1124 |
^ '$Header$' |
346 | 1125 |
! ! |
1077 | 1126 |