Skip to content

Commit

Permalink
implemented testSwapAllCards
Browse files Browse the repository at this point in the history
  • Loading branch information
Mosrepos committed Jul 30, 2022
1 parent 5e11483 commit ca29575
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/test/kotlin/serviceTest/PlayerServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class PlayerServiceTest {
swimService.startGame()
}


/**
* test if the function pass works correctly
*/
@Test
fun testPass() {
assertEquals(0, game.passes)
Expand All @@ -36,6 +40,10 @@ class PlayerServiceTest {
assertEquals(2, game.passes)
}


/**
* test if the function call works correctly
*/
@Test
fun testCall() {
game.passes = 1
Expand All @@ -45,6 +53,10 @@ class PlayerServiceTest {
assert(game.passes == 0)
}


/**
* test if the function swapOneCard works correctly
*/
@Test
fun testSwapOneCard() {
val playerCard = game.currentPlayer.playerHand.cards[0]
Expand All @@ -53,11 +65,31 @@ class PlayerServiceTest {
//println(tableCard.toString())
}

/**
* test if the function swapAllCards works correctly
*/
@Test
fun testSwapAllCards() {
val hand = game.currentPlayer.playerHand.cards
val table = game.tableDeck.cards


//check if the variables assigned correctly
assertEquals(hand,game.currentPlayer.playerHand.cards)
assertEquals(table,game.tableDeck.cards)

playerService.swapAllCards()

//check if swapped correctly
assertEquals(table,game.currentPlayer.playerHand.cards)
assertEquals(hand,game.tableDeck.cards)

}


/**
* test if the function calculatePoints works correctly
*/
@Test
fun testCalculatePoints() {
for (i in game.players){
Expand Down

0 comments on commit ca29575

Please sign in to comment.