示例#1
0
    def test_feeding_carnivore_fit(self):
        """
        Test for carnivore feeding method, with fit carnivore.

        Returns
        -------

        """
        c1 = Carnivore(1, 3000) # fitness ~= 1
        c1.set_parameters({'DeltaPhiMax': 1.00001})
        j1 = Jungle()
        j1.add_herbivore(5,10)
        j1.herbivores[0].fitness = 0

        boolean = c1.feeding(j1.herbivores)

        c1.set_parameters({'DeltaPhiMax': 10.0}) # default-value
        assert c1.weight == 3007.5
        assert boolean == [False]
示例#2
0
    def test_feeding_carnivore_appetite(self):
        """
        Test for a fit carnivore's feeding method, with low appetite.

        Returns
        -------

        """
        c1 = Carnivore(1, 20)
        c1.fitness = 1
        c1.set_parameters({'DeltaPhiMax': 1.00001, 'F': 10.0})
        j1 = Jungle()
        j1.add_herbivore(5,20)
        j1.herbivores[0].fitness = 0

        boolean = c1.feeding(j1.herbivores)

        c1.set_parameters({'DeltaPhiMax': 10.0, 'F': 50.0}) # default-value
        assert c1.weight == 27.5
        assert boolean == [False]