From ed1a8fb0fc62b27ea410b183f73ad09291c90407 Mon Sep 17 00:00:00 2001 From: Coppio Date: Tue, 5 Nov 2024 12:15:13 -0300 Subject: [PATCH] fix: return the test --- .../verifier/TestSupportVehicleTest.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 megamek/unittests/megamek/common/verifier/TestSupportVehicleTest.java diff --git a/megamek/unittests/megamek/common/verifier/TestSupportVehicleTest.java b/megamek/unittests/megamek/common/verifier/TestSupportVehicleTest.java new file mode 100644 index 0000000000..72f5638605 --- /dev/null +++ b/megamek/unittests/megamek/common/verifier/TestSupportVehicleTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 - The MegaMek Team. All Rights Reserved. + * + * This file is part of MegaMek. + * + * MegaMek is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * MegaMek is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with MegaMek. If not, see . + */ +package megamek.common.verifier; + +import static megamek.common.EquipmentType.T_ARMOR_FERRO_FIBROUS; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import megamek.common.EquipmentType; +import megamek.common.ITechnology; +import megamek.common.MiscType; +import megamek.common.SupportTank; +import megamek.common.equipment.ArmorType; +import megamek.common.verifier.TestSupportVehicle.ChassisModification; + +class TestSupportVehicleTest { + + @BeforeAll + static void initialize() { + EquipmentType.initializeTypes(); + } + + @Test + void testChassisModLookup() { + for (ChassisModification mod : ChassisModification.values()) { + assertNotNull(mod.equipment); + assertTrue(mod.equipment.hasFlag(MiscType.F_SUPPORT_TANK_EQUIPMENT)); + assertTrue(mod.equipment.hasFlag(MiscType.F_CHASSIS_MODIFICATION)); + } + } + + @Test + void testBAR10ArmorCorrectSlots() { + SupportTank st = new SupportTank(); + st.setArmorType(EquipmentType.T_ARMOR_SV_BAR_10); + // Rating E should return CV slots for IS FF + st.setArmorTechRating(ITechnology.RATING_E); + assertEquals( + 2, + ArmorType.of(T_ARMOR_FERRO_FIBROUS, false).getSupportVeeSlots(st)); + + // Rating F should return CV slots for Clan FF + st.setArmorTechRating(ITechnology.RATING_F); + assertEquals( + 1, + ArmorType.of(T_ARMOR_FERRO_FIBROUS, true).getSupportVeeSlots(st)); + } +}