KarelFixture.
PinSetterTask1

The Pin Setter task: Chapter 3, problem 2



kareltherobot.KarelFixture
kareltherobot.PinSetter
World reset
Create karel 1 5 North 10
Message karel setPins
Assert At karel 6 5
Assert FacingSouth karel
Assert NotRunning karel
Assert NoBeepersInBeeperBag karel
Assert BeepersInWorld 10
Assert BeepersAt 5 2 1
Assert BeepersAt 5 4 1
Assert BeepersAt 5 6 1
Assert BeepersAt 5 8 1
Assert BeepersAt 4 3 1
Assert BeepersAt 4 5 1
Assert BeepersAt 4 7 1
Assert BeepersAt 3 4 1
Assert BeepersAt 3 6 1
Assert BeepersAt 2 5 1

You can insert this page into another with the !include widget. Its full name is .KarelFixture.PinSetterTask1

Each student could then include this into her own page for this exercise elsewhere in this system.

Note that the test property is not turned on here. If you import it into a page that does have the test property, then this test will be run with all the others when you hit the test button. We reset the world at the beginning of this so that if it is included after other tests on such a page, then what they do won't affect the validity of this test.

Typically, a student could write other tests for the pin setter, exercising other methods they use to support setPins. This one could be included at the top or the bottom of the student's test page.

[ User Guide] [.FrontPage] [.RecentChanges]