From aa7176e798dd5ff41a095a678ccfcd3320cb2449 Mon Sep 17 00:00:00 2001 From: Peter Hart Date: Sat, 6 Feb 2021 18:23:15 -0500 Subject: [PATCH] Actually added missing tests this time? --- src/MyCounter-Tests/CounterTest.class.st | 20 ++++++++++++++++++++ src/MyCounter/Counter.class.st | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) 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 ]