Update unit tests for modified continuity check
Also, make testIsContinuous public in AerodynamicCalcutor, primarily for the benefit of unit tests.
This commit is contained in:
parent
7c57c272fb
commit
a04fc455e9
@ -67,4 +67,9 @@ public interface AerodynamicCalculator extends Monitorable {
|
|||||||
* @return a new, independent instance of this aerodynamic calculator type
|
* @return a new, independent instance of this aerodynamic calculator type
|
||||||
*/
|
*/
|
||||||
public AerodynamicCalculator newInstance();
|
public AerodynamicCalculator newInstance();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test component assembly for continuity (esp. diameter), and post any needed warnings
|
||||||
|
*/
|
||||||
|
public void testIsContinuous(FlightConfiguration configuration, final RocketComponent component, WarningSet warnings);
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,8 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
|
|||||||
return assemblyForces;
|
return assemblyForces;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testIsContinuous(FlightConfiguration configuration, final RocketComponent treeRoot, WarningSet warnings ){
|
@Override
|
||||||
|
public void testIsContinuous(FlightConfiguration configuration, final RocketComponent treeRoot, WarningSet warnings ){
|
||||||
Queue<RocketComponent> queue = new LinkedList<>();
|
Queue<RocketComponent> queue = new LinkedList<>();
|
||||||
for (RocketComponent child : treeRoot.getChildren()) {
|
for (RocketComponent child : treeRoot.getChildren()) {
|
||||||
// Ignore inactive stages
|
// Ignore inactive stages
|
||||||
|
@ -288,8 +288,10 @@ public class BarrowmanCalculatorTest {
|
|||||||
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||||
AerodynamicCalculator calc = new BarrowmanCalculator();
|
AerodynamicCalculator calc = new BarrowmanCalculator();
|
||||||
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
||||||
|
WarningSet warnings = new WarningSet();
|
||||||
|
|
||||||
assertTrue("Estes Alpha III should be continuous: ", calc.isContinuous(configuration, rocket));
|
calc.testIsContinuous(configuration, rocket, warnings);
|
||||||
|
assertTrue("Estes Alpha III should be continuous: ", warnings.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -297,8 +299,10 @@ public class BarrowmanCalculatorTest {
|
|||||||
Rocket rocket = TestRockets.makeFalcon9Heavy();
|
Rocket rocket = TestRockets.makeFalcon9Heavy();
|
||||||
AerodynamicCalculator calc = new BarrowmanCalculator();
|
AerodynamicCalculator calc = new BarrowmanCalculator();
|
||||||
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
||||||
|
WarningSet warnings = new WarningSet();
|
||||||
|
|
||||||
assertTrue("F9H should be continuous: ", calc.isContinuous(configuration, rocket));
|
calc.testIsContinuous(configuration, rocket, warnings);
|
||||||
|
assertTrue("F9H should be continuous: ", warnings.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -306,6 +310,7 @@ public class BarrowmanCalculatorTest {
|
|||||||
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||||
AerodynamicCalculator calc = new BarrowmanCalculator();
|
AerodynamicCalculator calc = new BarrowmanCalculator();
|
||||||
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
||||||
|
WarningSet warnings = new WarningSet();
|
||||||
|
|
||||||
NoseCone nose = (NoseCone)rocket.getChild(0).getChild(0);
|
NoseCone nose = (NoseCone)rocket.getChild(0).getChild(0);
|
||||||
BodyTube body = (BodyTube)rocket.getChild(0).getChild(1);
|
BodyTube body = (BodyTube)rocket.getChild(0).getChild(1);
|
||||||
@ -314,7 +319,8 @@ public class BarrowmanCalculatorTest {
|
|||||||
body.setOuterRadius( 0.012 );
|
body.setOuterRadius( 0.012 );
|
||||||
body.setName( body.getName()+" << discontinuous");
|
body.setName( body.getName()+" << discontinuous");
|
||||||
|
|
||||||
assertFalse(" Estes Alpha III has an undetected discontinuity:", calc.isContinuous(configuration, rocket));
|
calc.testIsContinuous(configuration, rocket, warnings);
|
||||||
|
assertFalse(" Estes Alpha III has an undetected discontinuity:", warnings.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -322,6 +328,7 @@ public class BarrowmanCalculatorTest {
|
|||||||
Rocket rocket = TestRockets.makeFalcon9Heavy();
|
Rocket rocket = TestRockets.makeFalcon9Heavy();
|
||||||
AerodynamicCalculator calc = new BarrowmanCalculator();
|
AerodynamicCalculator calc = new BarrowmanCalculator();
|
||||||
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
FlightConfiguration configuration = rocket.getSelectedConfiguration();
|
||||||
|
WarningSet warnings = new WarningSet();
|
||||||
|
|
||||||
final AxialStage coreStage = (AxialStage)rocket.getChild(1);
|
final AxialStage coreStage = (AxialStage)rocket.getChild(1);
|
||||||
final ParallelStage booster = (ParallelStage)coreStage.getChild(0).getChild(0);
|
final ParallelStage booster = (ParallelStage)coreStage.getChild(0).getChild(0);
|
||||||
@ -333,7 +340,8 @@ public class BarrowmanCalculatorTest {
|
|||||||
body.setOuterRadius( 0.012 );
|
body.setOuterRadius( 0.012 );
|
||||||
body.setName( body.getName()+" << discontinuous");
|
body.setName( body.getName()+" << discontinuous");
|
||||||
|
|
||||||
assertFalse(" Missed discontinuity in Falcon 9 Heavy:", calc.isContinuous(configuration, rocket));
|
calc.testIsContinuous(configuration, rocket, warnings);
|
||||||
|
assertFalse(" Missed discontinuity in Falcon 9 Heavy:" , warnings.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user