From bf11813e4fa859a4833cab226c4ea560765d6d77 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 23 Nov 2025 17:01:59 +0100 Subject: Add ReDo Pharo excercises --- pharo-mooc/redo/src/MyCounter/CounterTest.class.st | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 pharo-mooc/redo/src/MyCounter/CounterTest.class.st (limited to 'pharo-mooc/redo/src/MyCounter/CounterTest.class.st') diff --git a/pharo-mooc/redo/src/MyCounter/CounterTest.class.st b/pharo-mooc/redo/src/MyCounter/CounterTest.class.st new file mode 100644 index 0000000..ba2afe5 --- /dev/null +++ b/pharo-mooc/redo/src/MyCounter/CounterTest.class.st @@ -0,0 +1,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 +] -- cgit v1.2.3