Application create: #LMExamples with: (#( AbtViewApplication SUnitUI) collect: [:each | Smalltalk at: each ifAbsent: [ Application errorPrerequisite: #LMExamples missing: each]])! LMExamples becomeDefault! Application subclass: #LMExamples instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''! LMExamples becomeDefault! TestCase subclass: #FactorialTests instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''! LMExamples becomeDefault! TestCase subclass: #MyTest instanceVariableNames: 'empty full ' classVariableNames: '' poolDictionaries: ''! LMExamples becomeDefault! !FactorialTests publicMethods ! setUp "dummy" ^true! testAgainstBuiltin "Testing our factorial against the one provided in Integer. self run: #testAgainstBuiltin" 1 to: 20 do: [:n | self assert: (n fact) = n factorial].! testFactExtra "Some extra tests. self run: #testFactExtra" 1 to: 10 do: [:n | self assert: ((n fact) / ((n - 1) fact)) = n].! testSimple "Some well known results self run: testSimple" self assert: (1 fact) = 1. self assert: (2 fact) = 2. self assert: (3 fact) = 6. self assert: (4 fact) = 24. ! ! !LMExamples class privateMethods ! abtIsViewApplication ^true! ! !MyTest publicMethods ! setUp "self run: #setUp" empty := Set new. full := Set with: 5 with: 'abc'.! testOccurrences "First test to be run self run: #testOccurrences" | result | self assert: (empty occurrencesOf: 0) = 0. self assert: (full occurrencesOf: 5) = 1. full add: 5. self assert: (full occurrencesOf: 5) = 1. ! testRemove "Test on removing elements from a Set self run: #testRemove" full remove: 5. self assert: (full includes: 'abc'). self deny: (full includes: 5).! ! LMExamples initializeAfterLoad! FactorialTests initializeAfterLoad! MyTest initializeAfterLoad! LMExamples loaded!