Skip to content

Commit

Permalink
Updated tests with new AddPlayer function
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-nguyen committed May 29, 2018
1 parent a991523 commit 6cb0b5e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/arena/arena_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func TestAddPlayer(t *testing.T) {
for i := 0; i < numPlayers; i++ {
t.Run("TestAddPlayer", func(t *testing.T) {

err := a.AddPlayer(fmt.Sprintf("player%d", i), nil)
name := fmt.Sprintf("player%d", i)
err := a.AddPlayer(name, name, nil)
if err != nil {
t.Errorf("Failed to add player: %v", err)
}
Expand Down Expand Up @@ -100,12 +101,12 @@ func TestPlayerToPlayerCollisions(t *testing.T) {
for _, tc := range testCases {
t.Run("Player to Player collision", func(t *testing.T) {
a := CreateArena(testHeight, testWidth, 0, 0)
a.AddPlayer("test", nil)
a.AddPlayer("test", "", nil)
testPlayer := a.Players["test"]
testPlayer.Position = quarterPosition
testPlayer.Velocity = testVelocity

a.AddPlayer(tc.otherPlayer, nil)
a.AddPlayer(tc.otherPlayer, "", nil)
a.Players[tc.otherPlayer].Position = tc.testPosition

a.playerCollisions()
Expand Down

0 comments on commit 6cb0b5e

Please sign in to comment.