-
Notifications
You must be signed in to change notification settings - Fork 0
/
round_test.go
34 lines (29 loc) · 905 Bytes
/
round_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"testing"
)
func TestRoundCreation(t *testing.T) {
players := []*Player{NewPlayer("Player1"), NewPlayer("Player2")}
r := NewRound(players)
if r.Active() != true {
t.Errorf("Expected Round.Active to be true but was %t", r.Active())
}
}
func TestNumberOfPlayers(t *testing.T) {
players := []*Player{NewPlayer("Player1"), NewPlayer("Player2")}
r := NewRound(players)
if r.NumberOfPlayers() != 2 {
t.Errorf("Round did not have the correct number of players. Expected 2, but got %d", r.NumberOfPlayers())
}
}
func TestInitialisationOfRound(t *testing.T) {
players := []*Player{NewPlayer("Player1")}
p1 := players[0]
r := NewRound(players)
if p1.CurrentRound != r {
t.Error("Expected player to be enrolled in the current round but was not.")
}
if len(p1.Hand) != 1 {
t.Errorf("Expected player to have 1 card in their hand, but had %d cards", len(p1.Hand))
}
}