コード例 #1
0
    def test_dualWaitReset(self):
        """
        Test wait functions which do both at once
        """
        controller = TrafficLightController("TEST")
        controller.IncrementBothWaits()
        self.assertEqual(controller.GetRightWait(), 1, msg="Right wait")
        self.assertEqual(controller.GetOtherWait(), 1, msg="Other wait")

        controller.ResetBothWaits()
        self.assertEqual(controller.GetRightWait(), 0, msg="Right wait")
        self.assertEqual(controller.GetOtherWait(), 0, msg="Other wait")
コード例 #2
0
 def test_otherInitWait(self):
     """
     Makes sure waits are set right on init
     """
     controller = TrafficLightController("TEST")
     self.assertEqual(controller.GetRightWait(), 0, msg="Right wait")
     self.assertEqual(controller.GetOtherWait(), 0, msg="Other wait")
コード例 #3
0
 def test_dualWaitIncrement(self):
     """
     Test the method handling incrementing both waits
     """
     controller = TrafficLightController("TEST")
     controller.IncrementBothWaits()
     self.assertEqual(controller.GetRightWait(), 1, msg="Right wait")
     self.assertEqual(controller.GetOtherWait(), 1, msg="Other wait")
コード例 #4
0
    def test_waitReset(self):
        """
        Tests our wait reset functions
        """
        controller = TrafficLightController("TEST")
        self.assertEqual(controller.GetRightWait(), 0, msg="Right wait")
        controller.IncrementRightWait()
        controller.ResetRightWait()
        self.assertNotEqual(controller.GetRightWait(), 1, msg="Right wait")
        controller.ResetRightWait()
        controller.ResetRightWait()
        self.assertEqual(controller.GetRightWait(), 0, msg="Right wait")

        self.assertEqual(controller.GetOtherWait(), 0, msg="Other wait")
        controller.IncrementOtherWait()
        controller.ResetOtherWait()
        self.assertNotEqual(controller.GetOtherWait(), 1, msg="Other wait")
        controller.ResetOtherWait()
        controller.ResetOtherWait()
        self.assertEqual(controller.GetOtherWait(), 0, msg="Other wait")