Skip to content
Snippets Groups Projects
Commit 5ba0d3d3 authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

Corrected some errors in testing

parent 7d4eb03d
No related branches found
No related tags found
No related merge requests found
Pipeline #9006 passed
...@@ -4,7 +4,7 @@ import model.genes.RegulatoryGene; ...@@ -4,7 +4,7 @@ import model.genes.RegulatoryGene;
import java.util.List; import java.util.List;
public interface SimulationEvent extends Comparable<SimulationEvent> { public interface SimulationEvent {
void updateGenes(); void updateGenes();
double getTime(); double getTime();
......
...@@ -37,7 +37,6 @@ public class RegulatoryNetwork { ...@@ -37,7 +37,6 @@ public class RegulatoryNetwork {
this.timeStepLength = timeStepLength; this.timeStepLength = timeStepLength;
this.timeUpperBound = timeUpperBound; this.timeUpperBound = timeUpperBound;
this.simulationEvents.addAll(simulationEvents); this.simulationEvents.addAll(simulationEvents);
Collections.sort(simulationEvents);
} }
public List<XYChart.Series<Number, Number>> getData() { public List<XYChart.Series<Number, Number>> getData() {
...@@ -68,7 +67,7 @@ public class RegulatoryNetwork { ...@@ -68,7 +67,7 @@ public class RegulatoryNetwork {
private List<SimulationEvent> getCurrentEvents(double time) { private List<SimulationEvent> getCurrentEvents(double time) {
List<SimulationEvent> currentEvents = new ArrayList<>(); List<SimulationEvent> currentEvents = new ArrayList<>();
for(SimulationEvent event : simulationEvents) { for(SimulationEvent event : simulationEvents) {
if (event.getTime() == time) { if (Math.abs(event.getTime() - time) < timeStepLength/2.) {
currentEvents.add(event); currentEvents.add(event);
} }
} }
......
...@@ -5,7 +5,7 @@ import static org.assertj.core.api.Assertions.*; ...@@ -5,7 +5,7 @@ import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
public class NoProductionRegulatoryGeneTest { public class ConstantRegulatoryGeneTest {
public static final double EPSILON = 0.0000001; public static final double EPSILON = 0.0000001;
private ConstantRegulatoryGene geneX; private ConstantRegulatoryGene geneX;
...@@ -36,7 +36,7 @@ public class NoProductionRegulatoryGeneTest { ...@@ -36,7 +36,7 @@ public class NoProductionRegulatoryGeneTest {
@Test @Test
void testGetInitialProteinConcentration_afterSettingProteinConcentration() { void testGetInitialProteinConcentration_afterSettingProteinConcentration() {
geneX.setProteinConcentration(11); geneX.setProteinConcentration(11);
assertThat(geneX.getInitialProteinConcentration()).isCloseTo(11, within(EPSILON)); assertThat(geneX.getInitialProteinConcentration()).isCloseTo(1, within(EPSILON));
geneY.setProteinConcentration(10); geneY.setProteinConcentration(10);
assertThat(geneY.getInitialProteinConcentration()).isCloseTo(2, within(EPSILON)); assertThat(geneY.getInitialProteinConcentration()).isCloseTo(2, within(EPSILON));
geneZ.setProteinConcentration(2); geneZ.setProteinConcentration(2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment