diff --git a/src/attributes.py b/src/attributes.py index 31e6239..101dc10 100644 --- a/src/attributes.py +++ b/src/attributes.py @@ -86,5 +86,5 @@ class attributes: @population_size.setter def population_size(self, value_input): if(value_input == 0): - raise ValueError("Population length must be greater then 0") + raise ValueError("Population size must be greater then 0") self._population_size = value_input diff --git a/src/test_EasyGA.py b/src/test_EasyGA.py index cc33dc3..6c6644a 100644 --- a/src/test_EasyGA.py +++ b/src/test_EasyGA.py @@ -12,13 +12,23 @@ import EasyGA def test_population_size(): """Test the population size is create correctly""" - pass + + for i in range(1,100): + # Create the ga to test + ga = EasyGA.GA() + # Set the upper limit of testing + ga.population_size = i + # Evolve the ga + ga.evolve() + + # If they are not equal throw an error + assert ga.population.size() == ga.population_size def test_chromosome_length(): """ Test to see if the actual chromosome length is the same as defined.""" # Test from 0 to 100 chromosome length - for i in range(0,100): + for i in range(1,100): # Create the ga to test ga = EasyGA.GA() # Set the upper limit of testing