Skip to content

Commit 40c4d8f

Browse files
authored
Merge pull request #185 from nu-cs-sqe/feature/documentation-mutation
Remove shuffle cardpile test and update documentation
2 parents 7eaf420 + 240e4d4 commit 40c4d8f

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

docs/design/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ This folder contains the design documents for the project.
3131

3232
### Mutation Notes:
3333
- The mutation in `CardPile.addCardAt` is an equivalent mutation
34+
- We don't test the call to java/util/Collections::shuffle. This is a static function from a standard library, so we can assume that it is highly reliable.
3435

3536
### General testing justifications:
3637
- Suppressed unchecked type casting warnings in card pile tests due to needing a workaround for mocking shuffling feature

src/test/java/explodingwildcats/CardPileTests.java

-35
Original file line numberDiff line numberDiff line change
@@ -731,39 +731,4 @@ public void addCardAt_Twenty_AddsCard() {
731731
assertEquals(existingCard, cards[i]);
732732
}
733733
}
734-
735-
@Test
736-
public void shuffleList_expectOrderChanged() {
737-
CardPile pile = new CardPile();
738-
739-
// Create a list with known order
740-
List<Card> originalList = new ArrayList<>();
741-
originalList.add(Card.ATTACK);
742-
originalList.add(Card.SKIP);
743-
originalList.add(Card.SHUFFLE);
744-
originalList.add(Card.DEFUSE);
745-
746-
// Create a copy of the list to compare later
747-
List<Card> copyList = new ArrayList<>(originalList);
748-
749-
// Flag to track whether the shuffle changes the order
750-
boolean orderChanged = false;
751-
752-
// Loop until the order changes or a maximum number of attempts is reached
753-
while (!orderChanged) {
754-
pile.shuffleList(originalList);
755-
756-
// Check if the shuffled list is different from the original
757-
if (!originalList.equals(copyList)) {
758-
orderChanged = true;
759-
}
760-
}
761-
762-
// Assert that the shuffle changed the order
763-
assertTrue(orderChanged);
764-
765-
// Optional: Check that the contents remain the same
766-
assertTrue(originalList.containsAll(copyList), "The shuffled list is missing elements");
767-
assertTrue(copyList.containsAll(originalList), "The shuffled list has extra elements");
768-
}
769734
}

0 commit comments

Comments
 (0)