예제 #1
0
 def test_wolf_action(self):
     time_to_repro = self.wolf["time_to_repr"]
     wolf_action(self.wolf)
     if time_to_repro == 1:
         self.assertEqual(self.wolf["time_to_repr"], WOLF_REPRO_PERIOD)
     else:
         self.assertEqual(self.wolf["time_to_repr"], time_to_repro - 1)
예제 #2
0
 def test_wolf_action(self):
     """
     Wolves act by eating a random sheep from the meadow.
     """
     time_to_repro = self.wolf["time_to_repr"]
     wolf_action(self.wolf)
     if time_to_repro == 1:
         self.assertEqual(self.wolf["time_to_repr"], WOLF_REPRO_PERIOD)
     else:
         self.assertEqual(self.wolf["time_to_repr"], time_to_repro - 1)
예제 #3
0
 def test_wolf_action(self):
     """
     Wolves act by eating a random sheep from the meadow.
     """
     time_to_repro = self.wolf["time_to_repr"]
     wolf_action(self.wolf)
     if time_to_repro == 1:
         self.assertEqual(self.wolf["time_to_repr"], WOLF_REPRO_PERIOD)
     else:
         self.assertEqual(self.wolf["time_to_repr"], time_to_repro - 1)
예제 #4
0
    def test_wolf_reproduce(self):
        """
        Check if wolf can reproduce
        """

        # Run once to initialize the attributes
        wolf_action(self.wolf)

        # Set TIME_TO_REPRODUCE to 0 for triggering reproduction
        self.wolf.set_attr(TIME_TO_REPRODUCE, 0)

        # Let wolf reproduce
        reproduce(self.wolf)

        self.assertEqual(self.wolf.get_attr(TIME_TO_REPRODUCE),
                         DEF_TIME_TO_REPRO)
예제 #5
0
    def test_wolf_action(self):
        """
        Wolves act by eating a random sheep from the meadow
        """

        # Run once to initialize the attributes
        wolf_action(self.wolf)

        # Get TIME_TO_REPRODUCE attribute
        time_to_repro = self.wolf.get_attr(TIME_TO_REPRODUCE)

        # Run again
        wolf_action(self.wolf)

        if time_to_repro == 1:
            self.assertEqual(self.wolf.get_attr(TIME_TO_REPRODUCE),
                             WOLF_REPRO_PERIOD)
        else:
            self.assertEqual(self.wolf.get_attr(TIME_TO_REPRODUCE),
                             time_to_repro - 1)