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/Dice/DieTest.class.st | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pharo-mooc/redo/src/Dice/DieTest.class.st (limited to 'pharo-mooc/redo/src/Dice/DieTest.class.st') diff --git a/pharo-mooc/redo/src/Dice/DieTest.class.st b/pharo-mooc/redo/src/Dice/DieTest.class.st new file mode 100644 index 0000000..f62b2af --- /dev/null +++ b/pharo-mooc/redo/src/Dice/DieTest.class.st @@ -0,0 +1,30 @@ +Class { + #name : #DieTest, + #superclass : #TestCase, + #category : #Dice +} + +{ #category : #tests } +DieTest >> testCreationIsOk [ + + | d | + d := Die withFaces: 20. + self assert: d faces equals: 20 +] + +{ #category : #tests } +DieTest >> testInitializationIsOk [ + + | d | + d := Die new. + self assert: d faces equals: 6 +] + +{ #category : #tests } +DieTest >> testRolling [ + + | d | + d := Die new. + 10 timesRepeat: + [ self assert: (d roll between: 1 and: 6) ] +] -- cgit v1.2.3