author | Claus Gittinger <cg@exept.de> |
Sat, 01 Mar 2014 18:44:35 +0100 | |
changeset 1078 | a4829ce2f3f1 |
parent 678 | 59a4186ff252 |
child 1447 | 2351db93aa5b |
child 1499 | 26a16a04219b |
permissions | -rw-r--r-- |
333 | 1 |
"{ Package: 'exept:regression' }" |
2 |
||
3 |
"{ NameSpace: RegressionTests }" |
|
4 |
||
5 |
TestCase subclass:#TimeDurationTest |
|
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
1078 | 9 |
category:'tests-Regression-DateAndTime' |
333 | 10 |
! |
11 |
||
12 |
||
13 |
!TimeDurationTest methodsFor:'Testing'! |
|
14 |
||
15 |
test_01_PrintingReading |
|
16 |
#( |
|
17 |
(0 0 0 0) |
|
18 |
(0 0 0 1) |
|
19 |
(0 0 0 9) |
|
20 |
(0 0 0 10) |
|
21 |
(0 0 0 11) |
|
22 |
(0 0 0 99) |
|
23 |
(0 0 0 100) |
|
24 |
(0 0 0 101) |
|
25 |
(0 0 0 999) |
|
26 |
(0 0 0 1000) |
|
27 |
(0 0 0 1001) |
|
28 |
||
29 |
(0 33 0 123) |
|
30 |
(2 0 0 123) |
|
31 |
(2 33 0 123) |
|
32 |
(100 33 0 123) |
|
33 |
(10000 33 0 123) |
|
34 |
(1000000 33 0 123) |
|
35 |
||
36 |
(2 33 0 0) |
|
37 |
(2 0 0 0) |
|
38 |
(24 0 0 0) |
|
39 |
(0 0 0 123) |
|
40 |
) do:[:hmsms | |
|
41 |
|h m s ms d1 d2 s1 s2| |
|
42 |
||
43 |
h := hmsms first. |
|
44 |
m := hmsms second. |
|
45 |
s := hmsms third. |
|
46 |
ms := hmsms fourth. |
|
678
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
47 |
d1 := TimeDuration hours:h minutes:m seconds:s milliseconds:ms. |
333 | 48 |
s1 := d1 printString. |
49 |
d2 := TimeDuration readFrom:s1. |
|
50 |
s2 := d2 printString. |
|
51 |
self assert:(d1 = d2). |
|
52 |
self assert:(d1 timeEncoding = d2 timeEncoding). |
|
53 |
self assert:(s1 = s2). |
|
54 |
]. |
|
55 |
||
56 |
||
678
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
57 |
"/ (TimeDuration hours:0 minutes:0 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s' |
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
58 |
"/ (TimeDuration hours:0 minutes:0 seconds:10 milliseconds:123) printStringFormat:'%h:%m:%s' |
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
59 |
"/ (TimeDuration hours:0 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s' |
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
60 |
"/ (TimeDuration hours:2 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s' |
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
61 |
"/ (TimeDuration hours:100 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s' |
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
62 |
"/ (TimeDuration hours:10000 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s' |
59a4186ff252
changed: #test_01_PrintingReading
Stefan Vogel <sv@exept.de>
parents:
333
diff
changeset
|
63 |
"/ (TimeDuration hours:1000000 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s' |
333 | 64 |
|
65 |
" |
|
66 |
self new test_01_PrintingReading |
|
67 |
" |
|
68 |
||
69 |
"Created: / 18-07-2007 / 14:02:01 / cg" |
|
70 |
! ! |
|
71 |
||
72 |
!TimeDurationTest class methodsFor:'documentation'! |
|
73 |
||
74 |
version |
|
75 |
^ '$Header$' |
|
76 |
! ! |
|
1078 | 77 |