blob: ba2afe5e694c2faf552d9cfbf658a4ab51db1edf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
Class {
#name : #CounterTest,
#superclass : #TestCase,
#category : #MyCounter
}
{ #category : #tests }
CounterTest >> testCountIsSetAndRead [
| c |
c := Counter new.
c count: 7.
self assert: c count equals: 7
]
{ #category : #tests }
CounterTest >> testCounterWellInitialized [
self assert: (Counter new increment; increment; count) equals: 2
]
{ #category : #tests }
CounterTest >> testDecrement [
| c |
c := Counter new.
c count: 2.
c decrement; decrement.
self assert: c count equals: 0
]
{ #category : #tests }
CounterTest >> testIncrement [
| c |
c := Counter new.
c count: 2.
c increment; increment.
self assert: c count equals: 4
]
{ #category : #tests }
CounterTest >> testInizialize [
self assert: Counter new count equals: 0
]
{ #category : #tests }
CounterTest >> testStartingAt5 [
| c |
c := Counter startingAt: 5.
self assert: c count equals: 5
]
{ #category : #tests }
CounterTest >> testStartingAt5Increment [
| c |
c := Counter startingAt: 5.
self assert: (c increment; count) equals: 6
]
|