Skip to content

Commit

Permalink
add LAM tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Algebro7 committed Aug 8, 2024
1 parent f6b60f6 commit 0439bed
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions megamek/unittests/megamek/server/GameManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void setUp() {
}

@Test
void testAddControlWithAdvAtmosphericMergesIntoOneRoll() {
void testAddControlWithAdvAtmosphericMergesIntoOneRollAero() {
AeroSpaceFighter aero = new AeroSpaceFighter();
game.addEntity(aero);
Vector<PilotingRollData> rolls = new Vector<>();
Expand All @@ -47,7 +47,7 @@ void testAddControlWithAdvAtmosphericMergesIntoOneRoll() {
}

@Test
void testAddControlWithAdvAtmosphericIncludesAllReasons() {
void testAddControlWithAdvAtmosphericIncludesAllReasonsAero() {
AeroSpaceFighter aero = new AeroSpaceFighter();
game.addEntity(aero);
Vector<PilotingRollData> rolls = new Vector<>();
Expand All @@ -63,4 +63,37 @@ void testAddControlWithAdvAtmosphericIncludesAllReasons() {
assertTrue(reasons.toString().contains("threshold"));
assertTrue(reasons.toString().contains("highest damage threshold exceeded"));
}

@Test
void testAddControlWithAdvAtmosphericMergesIntoOneRollLAM() {
LandAirMech mech = new LandAirMech(LandAirMech.GYRO_STANDARD, LandAirMech.COCKPIT_STANDARD, LandAirMech.LAM_STANDARD);
game.addEntity(mech);
Vector<PilotingRollData> rolls = new Vector<>();
StringBuilder reasons = new StringBuilder();

game.addControlRoll(new PilotingRollData(mech.getId(), 0, "avionics hit"));
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "threshold"));
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "highest damage threshold exceeded"));
gameManager.addControlWithAdvAtmospheric(mech, rolls, reasons);
assertEquals(1, rolls.size());
assertTrue(reasons.toString().contains("avionics hit"));
assertTrue(reasons.toString().contains("threshold"));
assertTrue(reasons.toString().contains("highest damage threshold exceeded"));
}

@Test
void testAddControlWithAdvAtmosphericIncludesAllReasonsLAM() {
LandAirMech mech = new LandAirMech(LandAirMech.GYRO_STANDARD, LandAirMech.COCKPIT_STANDARD, LandAirMech.LAM_STANDARD);
game.addEntity(mech);
Vector<PilotingRollData> rolls = new Vector<>();
StringBuilder reasons = new StringBuilder();

game.addControlRoll(new PilotingRollData(mech.getId(), 0, "avionics hit"));
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "threshold"));
game.addControlRoll(new PilotingRollData(mech.getId(), 0, "highest damage threshold exceeded"));
gameManager.addControlWithAdvAtmospheric(mech, rolls, reasons);
assertTrue(reasons.toString().contains("avionics hit"));
assertTrue(reasons.toString().contains("threshold"));
assertTrue(reasons.toString().contains("highest damage threshold exceeded"));
}
}

0 comments on commit 0439bed

Please sign in to comment.