コード例 #1
0
    def test_whenHandlingSaidStateThenPathfinderIsNotCalled(self):
        testedState = SequencerState.StopMovingState()

        testedState.handle(self.sequencer, self.map, self.pathfinder)

        assert not self.pathfinder.findPath.called
        assert not self.sequencer.setState.called
コード例 #2
0
    def test_whenHandlingSaidStateThenPathfinderIsCalled(self):
        testedState = SequencerState.SendingBotToTreasureState()

        testedState.handle(self.sequencer,self.map, self.pathfinder)

        assert self.pathfinder.findPath.called
        assert self.sequencer.setState.called
コード例 #3
0
    def test_whenHandlingSaidStateThenReturnsCorrectNextSignalInSequence(self):
        testedState = SequencerState.DetectTreasureState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual("detectTreasure", signal)
コード例 #4
0
    def test_whenHandlingSaidStateThenReturnsNoneAsOrientation(self):
        testedState = SequencerState.StopMovingState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual(None, orientation)
コード例 #5
0
    def test_whenHandlingSaidStateThenReturnsCorrectNextSignalInSequence(self):
        testedState = SequencerState.SendingBotToTargetState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual("alignPositionToTarget", signal)
コード例 #6
0
    def test_whenHandlingSaidStateThenReturnsCorrectOrientationToGiveRobot(
            self):
        testedState = SequencerState.DetectTreasureState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual(180, orientation)
コード例 #7
0
    def test_whenHandlingSaidStateThenReturnsCorrectOrientationToGiveRobot(
            self):
        testedState = SequencerState.SendingBotToTargetState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual(90, orientation)