예제 #1
0
    def test_fodder_eaten_only_eat_available_fodder(self):
        """Test to show that fodder_eaten only returns the available
        fodder if the location contains less fodder than optimal fodder
        """
        jungle_loc = (2, 7)
        Island._param_changer("J", {"f_max": 5})
        i_sim = Island()
        s_1 = Herbivore(i_sim, jungle_loc)

        assert s_1.fodder_eaten() == 5
예제 #2
0
    def test_fodder_eaten_for_full_landscapes(self):
        """Test to show that fodder eaten returns the optimal fodder for
        Herbivore when landscape is full, and 0 if landscape is empty
        """
        jungle_loc = (2, 7)
        savannah_loc = (2, 1)
        ocean_loc = (0, 0)
        i = Island()
        j_sim = Herbivore(i, jungle_loc)
        j_sim.fodder_eaten()
        s_sim = Herbivore(i, savannah_loc)
        s_sim.fodder_eaten()
        o_sim = Herbivore(i, ocean_loc)
        o_sim.fodder_eaten()
        optimal_fodder = Herbivore.parameters["F"]

        assert j_sim.fodder_eaten() == optimal_fodder
        assert s_sim.fodder_eaten() == optimal_fodder
        assert o_sim.fodder_eaten() == 0