diff --git a/src/MyCounter-Tests/CounterTest.class.st b/src/MyCounter-Tests/CounterTest.class.st index 99d9148..f8dbebc 100644 --- a/src/MyCounter-Tests/CounterTest.class.st +++ b/src/MyCounter-Tests/CounterTest.class.st @@ -14,3 +14,23 @@ CounterTest >> testCountIsSetAndRead [ c count: 7. self assert: c count equals: 7. ] + +{ #category : #tests } +CounterTest >> testDecrement [ + self assert: (Counter new count: 2 ; decrement ; decrement) count equals: 0 +] + +{ #category : #tests } +CounterTest >> testIncrement [ + self assert: (Counter new increment; increment) count equals: 2 +] + +{ #category : #tests } +CounterTest >> testInitialize [ + self assert: (Counter new count) equals: 0 +] + +{ #category : #tests } +CounterTest >> testPrintOn [ + self assert: (Counter new printString) equals: 'a Counter with value: 0' +] diff --git a/src/MyCounter/Counter.class.st b/src/MyCounter/Counter.class.st index 8a0ac10..fb1bb6a 100644 --- a/src/MyCounter/Counter.class.st +++ b/src/MyCounter/Counter.class.st @@ -31,7 +31,7 @@ Counter >> count [ Counter >> count: val [ "sets the counter to a specific value" count := val. - ^ val + ^ self ]