This commit is contained in:
2026-04-11 18:44:53 +02:00
parent 644c1bc55d
commit 5f3c70c8b3
5 changed files with 145 additions and 127 deletions
@@ -1,54 +1,157 @@
package it.polimi.ingsw.gc14.Model.GamePackage;
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.EventCard;
import it.polimi.ingsw.gc14.Model.Player;
import it.polimi.ingsw.gc14.Model.Slot;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import static org.junit.jupiter.api.Assertions.*;
class BoardTest {
@Test
@DisplayName("Slot initialization")
void getSlotList() {
//Board board = new Board(3);
//assertEquals("Ciao", board.getSlotList().toString());
// 0 players
Board b0 = new Board(0);
assertEquals('B', b0.getSlotList().get(0).getSlotId());
assertEquals('C', b0.getSlotList().get(1).getSlotId());
assertEquals('E', b0.getSlotList().get(2).getSlotId());
assertEquals('F', b0.getSlotList().get(3).getSlotId());
// 1 players
Board b1 = new Board(1);
assertEquals('B', b1.getSlotList().get(0).getSlotId());
assertEquals('C', b1.getSlotList().get(1).getSlotId());
assertEquals('E', b1.getSlotList().get(2).getSlotId());
assertEquals('F', b1.getSlotList().get(3).getSlotId());
// 2 players
Board b2 = new Board(2);
assertEquals('B', b2.getSlotList().get(0).getSlotId());
assertEquals('C', b2.getSlotList().get(1).getSlotId());
assertEquals('E', b2.getSlotList().get(2).getSlotId());
assertEquals('F', b2.getSlotList().get(3).getSlotId());
// 3 players
Board b3 = new Board(3);
assertEquals('B', b3.getSlotList().get(0).getSlotId());
assertEquals('C', b3.getSlotList().get(1).getSlotId());
assertEquals('D', b3.getSlotList().get(2).getSlotId());
assertEquals('E', b3.getSlotList().get(3).getSlotId());
assertEquals('F', b3.getSlotList().get(4).getSlotId());
// 4 players
Board b4 = new Board(4);
assertEquals('B', b4.getSlotList().get(0).getSlotId());
assertEquals('C', b4.getSlotList().get(1).getSlotId());
assertEquals('D', b4.getSlotList().get(2).getSlotId());
assertEquals('E', b4.getSlotList().get(3).getSlotId());
assertEquals('F', b4.getSlotList().get(4).getSlotId());
assertEquals('G', b4.getSlotList().get(5).getSlotId());
// 5 players
Board b5 = new Board(5);
assertEquals('A', b5.getSlotList().get(0).getSlotId());
assertEquals('B', b5.getSlotList().get(1).getSlotId());
assertEquals('C', b5.getSlotList().get(2).getSlotId());
assertEquals('D', b5.getSlotList().get(3).getSlotId());
assertEquals('E', b5.getSlotList().get(4).getSlotId());
assertEquals('F', b5.getSlotList().get(5).getSlotId());
assertEquals('G', b5.getSlotList().get(6).getSlotId());
}
@Test
@DisplayName("Testing constructor")
void testConstructor() {
}
// TODO non ho idea di come testare delle estrazioni randomiche
@Test
@DisplayName("Testing constructor")
void generateTribeDeck() {
}
@Test
@DisplayName("get events testing")
void getPendingEvents() {
Board bd = new Board(0);
Queue<EventCard> eventQueue = new LinkedList<>();
for (TribeCard card : bd.lowerListTribe) {
if (card.IsEventCard()) {
eventQueue.add((EventCard) card);
}
}
assertEquals(eventQueue, bd.getPendingEvents());
}
@Test
void containsUpperTribeCard() {
}
@Test
@DisplayName("Removing a card from upper row of tribe cards")
void removeUpperTribeCard() {
Board bd = new Board(3);
List<TribeCard> before = bd.upperListTribe;
TribeCard cardToRemove = before.get(2);
before.remove(2);
bd.removeUpperTribeCard(cardToRemove);
assertEquals(before, bd.upperListTribe);
}
@Test
void containsLowerTribeCard() {
}
@Test
@DisplayName("Removing a card from lower row of tribe cards")
void removeLowerTribeCard() {
Board bd = new Board(3);
List<TribeCard> before = bd.lowerListTribe;
TribeCard cardToRemove = before.get(2);
before.remove(2);
bd.removeLowerTribeCard(cardToRemove);
assertEquals(before, bd.lowerListTribe);
}
@Test
void containsUpperBuildingCard() {
}
@Test
@DisplayName("Removing a card from upper row of building cards")
void removeUpperBuildingCard() {
Board bd = new Board(3);
List<BuildingCard> before = bd.upperListBuilding;
BuildingCard cardToRemove = before.get(0);
before.remove(0);
bd.removeUpperBuildingCard(cardToRemove);
assertEquals(before, bd.upperListBuilding);
}
@Test
void containsLowerBuildingCard() {
}
@Test
@DisplayName("Removing a card from lower row of building cards")
void removeLowerBuildingCard() {
Board bd = new Board(3);
bd.nextEra();
List<BuildingCard> before = bd.lowerListBuilding;
BuildingCard cardToRemove = before.get(0);
before.remove(0);
bd.removeUpperBuildingCard(cardToRemove);
assertEquals(before, bd.lowerListBuilding);
}
@Test
void nextRound() {
}
}