public void ThenTheTwoPlantsWillHaveTheSameUpwardsPhototropismFitnessValue() { PlantFitness plantFitness = new PlantFitness(new LeafFitness(new SunInformation())); Mock <GeometryRenderSystem> geometryRenderMock = new Mock <GeometryRenderSystem>(); TurtlePen turtlePen = new TurtlePen(geometryRenderMock.Object) { ForwardStep = 1, RotationStep = 22.5f, }; Mock <ILSystem> lSystem1Mock = new Mock <ILSystem>(); lSystem1Mock.Setup(x => x.GetCommandString()).Returns("-F-FO"); PersistentPlantGeometryStorage geometryStorage1 = new PersistentPlantGeometryStorage(); Plant plant1 = new Plant(lSystem1Mock.Object, turtlePen, geometryStorage1, Vector3.zero, Color.black); plant1.Generate(); float plant1Fitness = plantFitness.EvaluateUpwardsPhototrophicFitness(plant1); Mock <ILSystem> lSystem2Mock = new Mock <ILSystem>(); lSystem2Mock.Setup(x => x.GetCommandString()).Returns("+F+FO"); PersistentPlantGeometryStorage geometryStorage2 = new PersistentPlantGeometryStorage(); Plant plant2 = new Plant(lSystem2Mock.Object, turtlePen, geometryStorage2, Vector3.zero, Color.black); plant2.Generate(); float plant2Fitness = plantFitness.EvaluateUpwardsPhototrophicFitness(plant2); Debug.Log("Plant 1 Fitness: " + plant1Fitness); Debug.Log("Plant 2 Fitness: " + plant2Fitness); Assert.That(plant2Fitness, Is.EqualTo(plant1Fitness)); }
public void ThenThePlantWithHigherLeavesHasAHigherUpwardsPhototropismFitnessValue() { PlantFitness plantFitness = new PlantFitness(new LeafFitness(new SunInformation())); Mock <GeometryRenderSystem> geometryRenderMock = new Mock <GeometryRenderSystem>(); TurtlePen turtlePen = new TurtlePen(geometryRenderMock.Object) { ForwardStep = 1 }; Mock <ILSystem> lSystem1Mock = new Mock <ILSystem>(); lSystem1Mock.Setup(x => x.GetCommandString()).Returns("FO"); PersistentPlantGeometryStorage geometryStorage1 = new PersistentPlantGeometryStorage(); Plant plant1 = new Plant(lSystem1Mock.Object, turtlePen, geometryStorage1, Vector3.zero, Color.black); plant1.Generate(); float plant1Fitness = plantFitness.EvaluateUpwardsPhototrophicFitness(plant1); Mock <ILSystem> lSystem2Mock = new Mock <ILSystem>(); lSystem2Mock.Setup(x => x.GetCommandString()).Returns("FFO"); PersistentPlantGeometryStorage geometryStorage2 = new PersistentPlantGeometryStorage(); Plant plant2 = new Plant(lSystem2Mock.Object, turtlePen, geometryStorage2, Vector3.zero, Color.black); plant2.Generate(); float plant2Fitness = plantFitness.EvaluateUpwardsPhototrophicFitness(plant2); Debug.Log("Small Plant Fitness: " + plant1Fitness); Debug.Log("Larger Plant Fitness: " + plant2Fitness); Assert.That(plant2Fitness, Is.GreaterThan(plant1Fitness)); }
public void ThenThePlantHasZeroUpwardsPhototrophicFitness() { float plant1Fitness = _plantFitness.EvaluateUpwardsPhototrophicFitness(_plant); Debug.Log("Small Plant Fitness: " + plant1Fitness); Assert.That(plant1Fitness, Is.EqualTo(0)); }