generated from BudDavis/TicTacToe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d0d414
commit 5a1b2ce
Showing
1 changed file
with
23 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,35 @@ | ||
package uta.cse3310; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
import java.util.List; | ||
|
||
class ScoreboardTest { | ||
|
||
private Scoreboard scoreboard; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
scoreboard = new Scoreboard(); | ||
} | ||
@Test | ||
void testUpdateScoreboard() { | ||
Scoreboard scoreboard = new Scoreboard(); | ||
Player player1 = new Player("1", "Player1"); | ||
player1.updateScore(100); | ||
scoreboard.updateScoreboard(player1); | ||
|
||
@Test | ||
void testUpdateScoreboard() { | ||
Player player1 = new Player("1", "Player1"); | ||
player1.updateScore(100); | ||
scoreboard.updateScoreboard(player1); | ||
List<Player> topPlayers = scoreboard.getTopPlayers(); | ||
assertEquals(1, topPlayers.size()); | ||
assertEquals("Player1", topPlayers.get(0).getName()); | ||
assertEquals(100, topPlayers.get(0).getScore()); | ||
} | ||
|
||
List<Player> topPlayers = scoreboard.getTopPlayers(); | ||
assertEquals(1, topPlayers.size()); | ||
assertEquals("Player1", topPlayers.get(0).getName()); | ||
assertEquals(100, topPlayers.get(0).getScore()); | ||
@Test | ||
void testTopPlayersLimit() { | ||
Scoreboard scoreboard = new Scoreboard(); | ||
for (int i = 0; i < 15; i++) { | ||
Player player = new Player(String.valueOf(i), "Player" + i); | ||
player.updateScore(i * 100); | ||
scoreboard.updateScoreboard(player); | ||
} | ||
|
||
@Test | ||
void testTopPlayersLimit() { | ||
for (int i = 0; i < 15; i++) { | ||
Player player = new Player(String.valueOf(i), "Player" + i); | ||
player.updateScore(i * 100); | ||
scoreboard.updateScoreboard(player); | ||
} | ||
|
||
List<Player> topPlayers = scoreboard.getTopPlayers(); | ||
assertEquals(10, topPlayers.size()); | ||
assertEquals(1400, topPlayers.get(0).getScore()); | ||
} | ||
} | ||
List<Player> topPlayers = scoreboard.getTopPlayers(); | ||
assertEquals(10, topPlayers.size()); | ||
assertEquals(1400, topPlayers.get(0).getScore()); | ||
} | ||
} |