Ejemplo n.º 1
0
  @Test
  public void testGetDynamicStructureSlotsForComponent_NoUpgrades() {
    when(mlc.upgrades.hasEndoSteel()).thenReturn(false);
    when(mlc.upgrades.hasFerroFibrous()).thenReturn(false);

    when(mlc.ra.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.rt.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.rl.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.hd.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.ct.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.ll.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.lt.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.la.getNumCriticalSlotsFree()).thenReturn(12);

    assertEquals(0, cut.getDynamicStructureSlots(mlc.ra));
    assertEquals(0, cut.getDynamicStructureSlots(mlc.rt));
    assertEquals(0, cut.getDynamicStructureSlots(mlc.rl));
    assertEquals(0, cut.getDynamicStructureSlots(mlc.hd));
    assertEquals(0, cut.getDynamicStructureSlots(mlc.ct));
    assertEquals(0, cut.getDynamicStructureSlots(mlc.lt));
    assertEquals(0, cut.getDynamicStructureSlots(mlc.ll));
    assertEquals(0, cut.getDynamicStructureSlots(mlc.la));

    assertEquals(0, cut.getDynamicArmorSlots(mlc.ra));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.rt));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.rl));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.hd));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.ct));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.lt));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.ll));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.la));
  }
Ejemplo n.º 2
0
  /** Dynamic armor slots are distributed before dynamic structure (arbitrary design decision). */
  @Test
  public void testMixedArmorStructurePriority() {
    when(mlc.upgrades.hasEndoSteel()).thenReturn(true);
    when(mlc.upgrades.hasFerroFibrous()).thenReturn(true);

    when(mlc.ra.getNumCriticalSlotsFree()).thenReturn(4); // 4 armor
    when(mlc.rt.getNumCriticalSlotsFree()).thenReturn(4);
    when(mlc.rl.getNumCriticalSlotsFree()).thenReturn(4);
    when(mlc.hd.getNumCriticalSlotsFree()).thenReturn(4); // 2 armor 2 structure
    when(mlc.ct.getNumCriticalSlotsFree()).thenReturn(2);
    when(mlc.lt.getNumCriticalSlotsFree()).thenReturn(4);
    when(mlc.ll.getNumCriticalSlotsFree()).thenReturn(7); // 6 structure
    when(mlc.la.getNumCriticalSlotsFree()).thenReturn(1); // 0 structure

    assertEquals(0, cut.getDynamicStructureSlots(mlc.ra));
    assertEquals(4, cut.getDynamicArmorSlots(mlc.ra));

    assertEquals(0, cut.getDynamicStructureSlots(mlc.rt));
    assertEquals(4, cut.getDynamicArmorSlots(mlc.rt));

    assertEquals(0, cut.getDynamicStructureSlots(mlc.rl));
    assertEquals(4, cut.getDynamicArmorSlots(mlc.rl));

    assertEquals(2, cut.getDynamicStructureSlots(mlc.hd));
    assertEquals(2, cut.getDynamicArmorSlots(mlc.hd));

    assertEquals(2, cut.getDynamicStructureSlots(mlc.ct));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.ct));

    assertEquals(4, cut.getDynamicStructureSlots(mlc.lt));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.lt));

    assertEquals(6, cut.getDynamicStructureSlots(mlc.ll));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.ll));

    assertEquals(0, cut.getDynamicStructureSlots(mlc.la));
    assertEquals(0, cut.getDynamicArmorSlots(mlc.la));
  }
Ejemplo n.º 3
0
  @Test
  public void testGetDynamicStructureSlotsForComponent_Priority() {
    when(mlc.upgrades.hasEndoSteel()).thenReturn(true);
    when(mlc.upgrades.hasFerroFibrous()).thenReturn(false);

    when(mlc.ra.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.rt.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.rl.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.hd.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.ct.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.ll.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.lt.getNumCriticalSlotsFree()).thenReturn(12);
    when(mlc.la.getNumCriticalSlotsFree()).thenReturn(12);

    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.ra.getNumCriticalSlotsFree()).thenReturn(1);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.rt.getNumCriticalSlotsFree()).thenReturn(1);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.rl.getNumCriticalSlotsFree()).thenReturn(2);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.hd.getNumCriticalSlotsFree()).thenReturn(1);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.ct.getNumCriticalSlotsFree()).thenReturn(3);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.lt.getNumCriticalSlotsFree()).thenReturn(1);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.ll.getNumCriticalSlotsFree()).thenReturn(1);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }

    when(mlc.la.getNumCriticalSlotsFree()).thenReturn(1);
    for (LoadoutPart part : priorityOrder) {
      assertEquals(
          expectedStructure(14), slotsOccupied(part, 14), cut.getDynamicStructureSlots(part));
    }
    // Slot overflow, fail graciously, no exceptions thrown
  }