1447
|
1 |
"{ Package: 'stx:goodies/regression' }"
|
333
|
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 |
#(
|
1447
|
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)
|
333
|
28 |
|
1447
|
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)
|
333
|
35 |
|
1447
|
36 |
(2 33 0 0)
|
|
37 |
(2 0 0 0)
|
|
38 |
(24 0 0 0)
|
|
39 |
(0 0 0 123)
|
333
|
40 |
) do:[:hmsms |
|
1447
|
41 |
|h m s ms d1 d2 s1 s2|
|
333
|
42 |
|
1447
|
43 |
h := hmsms first.
|
|
44 |
m := hmsms second.
|
|
45 |
s := hmsms third.
|
|
46 |
ms := hmsms fourth.
|
|
47 |
d1 := TimeDuration hours:h minutes:m seconds:s milliseconds:ms.
|
|
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).
|
333
|
54 |
].
|
|
55 |
|
|
56 |
|
1447
|
57 |
"/ (TimeDuration hours:0 minutes:0 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s'
|
|
58 |
"/ (TimeDuration hours:0 minutes:0 seconds:10 milliseconds:123) printStringFormat:'%h:%m:%s'
|
|
59 |
"/ (TimeDuration hours:0 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s'
|
|
60 |
"/ (TimeDuration hours:2 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s'
|
|
61 |
"/ (TimeDuration hours:100 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s'
|
|
62 |
"/ (TimeDuration hours:10000 minutes:33 seconds:0 milliseconds:123) printStringFormat:'%h:%m:%s'
|
|
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 |
|