[fix] adjusted RocketTest unit tests to match auto-radius across stages.
This commit is contained in:
parent
5bea957e50
commit
0c47f2eba3
@ -551,7 +551,7 @@ public class TestRockets {
|
||||
}
|
||||
}
|
||||
|
||||
// This is an extra stage tacked onto the end of an Estes Alpha III
|
||||
// This is an extra stage tacked onto the end of an Estes Alpha III
|
||||
// http://www.rocketreviews.com/alpha-iii---estes-221256.html
|
||||
//
|
||||
// This function is used for unit, integration tests, DO NOT CHANGE WITHOUT UPDATING TESTS
|
||||
@ -586,7 +586,7 @@ public class TestRockets {
|
||||
double finRootChord = .05;
|
||||
double finTipChord = .03;
|
||||
double finSweep = 0.02;
|
||||
double finHeight = 0.05;
|
||||
double finHeight = 0.03;
|
||||
FinSet finset = new TrapezoidFinSet(finCount, finRootChord, finTipChord, finSweep, finHeight);
|
||||
finset.setName("Booster Fins");
|
||||
finset.setThickness( 0.0032);
|
||||
@ -611,6 +611,14 @@ public class TestRockets {
|
||||
}
|
||||
boosterBody.addChild(boosterMMT);
|
||||
}
|
||||
|
||||
// Tail Cone
|
||||
Transition boosterTail = new Transition();
|
||||
boosterTail.setForeRadius(0.012);
|
||||
boosterTail.setAftRadius(0.01);
|
||||
boosterTail.setLength(0.005);
|
||||
boosterTail.setName("Booster Tail Cone");
|
||||
boosterStage.addChild( boosterTail);
|
||||
}
|
||||
|
||||
rocket.setSelectedConfiguration( TEST_FCID_1 );
|
||||
|
@ -5,6 +5,7 @@ import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.position.AxialMethod;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sf.openrocket.rocketcomponent.position.AngleMethod;
|
||||
@ -55,29 +56,6 @@ public class RocketTest extends BaseTestCase {
|
||||
//ComponentCompare.assertDeepEquality(r1, r2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoAlphaIII() {
|
||||
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||
|
||||
AxialStage stage = (AxialStage) rocket.getChild(0);
|
||||
|
||||
BodyTube body = (BodyTube)stage.getChild(1);
|
||||
final double expRadius = 0.012;
|
||||
double actRadius = body.getOuterRadius();
|
||||
assertEquals(" radius match: ", expRadius, actRadius, EPSILON);
|
||||
|
||||
body.setOuterRadiusAutomatic(true);
|
||||
actRadius = body.getOuterRadius();
|
||||
assertEquals(" radius match: ", expRadius, actRadius, EPSILON);
|
||||
|
||||
final Transition transition = new Transition();
|
||||
stage.addChild(transition);
|
||||
|
||||
transition.setForeRadiusAutomatic(true);
|
||||
actRadius = transition.getForeRadius();
|
||||
assertEquals(" trailing transition match: ", expRadius, actRadius, EPSILON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEstesAlphaIII(){
|
||||
Rocket rocket = TestRockets.makeEstesAlphaIII();
|
||||
@ -179,7 +157,84 @@ public class RocketTest extends BaseTestCase {
|
||||
assertThat(locPost.x, equalTo(0.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAutoSizePreviousComponent() {
|
||||
Rocket rocket = TestRockets.makeBeta();
|
||||
|
||||
final AxialStage sustainer = (AxialStage) rocket.getChild(0);
|
||||
final AxialStage booster = (AxialStage) rocket.getChild(1);
|
||||
final double expRadius = 0.012;
|
||||
|
||||
{ // test auto-radius within a stage: nose -> body tube
|
||||
final NoseCone nose = (NoseCone) sustainer.getChild(0);
|
||||
assertEquals(" radius match: ", expRadius, nose.getAftRadius(), EPSILON);
|
||||
final BodyTube body = (BodyTube) sustainer.getChild(1);
|
||||
assertEquals(" radius match: ", expRadius, body.getOuterRadius(), EPSILON);
|
||||
|
||||
body.setOuterRadiusAutomatic(true);
|
||||
assertEquals(" radius match: ", expRadius, body.getOuterRadius(), EPSILON);
|
||||
}
|
||||
{ // test auto-radius within a stage: body tube -> trailing transition
|
||||
final BodyTube body = (BodyTube) booster.getChild(0);
|
||||
assertEquals(" radius match: ", expRadius, body.getOuterRadius(), EPSILON);
|
||||
final Transition tailCone = (Transition)booster.getChild(1);
|
||||
assertEquals(" radius match: ", expRadius, tailCone.getForeRadius(), EPSILON);
|
||||
|
||||
tailCone.setForeRadiusAutomatic(true);
|
||||
assertEquals(" trailing transition match: ", expRadius, tailCone.getForeRadius(), EPSILON);
|
||||
}
|
||||
{ // test auto-radius across stages: sustainer body -> booster body
|
||||
BodyTube sustainerBody = (BodyTube) sustainer.getChild(1);
|
||||
assertEquals(" radius match: ", expRadius, sustainerBody.getOuterRadius(), EPSILON);
|
||||
BodyTube boosterBody = (BodyTube) booster.getChild(0);
|
||||
assertEquals(" radius match: ", expRadius, boosterBody.getOuterRadius(), EPSILON);
|
||||
|
||||
boosterBody.setOuterRadiusAutomatic(true);
|
||||
assertEquals(" radius match: ", expRadius, boosterBody.getOuterRadius(), EPSILON);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoSizeNextComponent() {
|
||||
Rocket rocket = TestRockets.makeBeta();
|
||||
|
||||
final AxialStage sustainer = (AxialStage) rocket.getChild(0);
|
||||
final AxialStage booster = (AxialStage) rocket.getChild(1);
|
||||
final double expRadius = 0.012;
|
||||
|
||||
{ // test auto-radius within a stage: nose <- body tube
|
||||
System.err.println("## Testing auto-radius: sustainer: nose <- body");
|
||||
final NoseCone nose = (NoseCone) sustainer.getChild(0);
|
||||
assertEquals(" radius match: ", expRadius, nose.getAftRadius(), EPSILON);
|
||||
final BodyTube body = (BodyTube) sustainer.getChild(1);
|
||||
assertEquals(" radius match: ", expRadius, body.getOuterRadius(), EPSILON);
|
||||
|
||||
nose.setAftRadiusAutomatic(true);
|
||||
assertEquals(" radius match: ", expRadius, nose.getAftRadius(), EPSILON);
|
||||
}
|
||||
{ // test auto-radius within a stage: body tube <- trailing transition
|
||||
System.err.println("## Testing auto-radius: booster: body <- tail");
|
||||
final BodyTube boosterBody = (BodyTube) booster.getChild(0);
|
||||
assertEquals(" radius match: ", expRadius, boosterBody.getOuterRadius(), EPSILON);
|
||||
final Transition tailCone = (Transition)booster.getChild(1);
|
||||
assertEquals(" radius match: ", expRadius, tailCone.getForeRadius(), EPSILON);
|
||||
|
||||
boosterBody.setOuterRadiusAutomatic(true);
|
||||
assertEquals(" trailing transition match: ", expRadius, boosterBody.getOuterRadius(), EPSILON);
|
||||
}
|
||||
{ // test auto-radius across stages: sustainer body <- booster body
|
||||
System.err.println("## Testing auto-radius: booster:body -> sustainer:body");
|
||||
BodyTube sustainerBody = (BodyTube) sustainer.getChild(1);
|
||||
assertEquals(" radius match: ", expRadius, sustainerBody.getOuterRadius(), EPSILON);
|
||||
BodyTube boosterBody = (BodyTube) booster.getChild(0);
|
||||
assertEquals(" radius match: ", expRadius, boosterBody.getOuterRadius(), EPSILON);
|
||||
|
||||
sustainerBody.setOuterRadiusAutomatic(true);
|
||||
assertEquals(" radius match: ", expRadius, sustainerBody.getOuterRadius(), EPSILON);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBeta(){
|
||||
Rocket rocket = TestRockets.makeBeta();
|
||||
|
Loading…
x
Reference in New Issue
Block a user