Skip to content

Commit

Permalink
fix redeclarations2
Browse files Browse the repository at this point in the history
  • Loading branch information
teelau committed May 24, 2018
1 parent d7b5d28 commit 7cf6a33
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions server/models/player_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,42 +132,6 @@ func TestUpdatePosition(t *testing.T) {
})
}
}

func TestHitjunk(t *testing.T) {
testCases := []struct {
description string
playerVelocity Velocity
}{
{"Moving NW", Velocity{5, -5}},
{"Moving NE", Velocity{5, 5}},
{"Moving SW", Velocity{-5, -5}},
{"Moving SE", Velocity{-5, 5}},
{"Stationary", Velocity{0, 0}},
{"Moving N", Velocity{5, 0}},
{"Moving E", Velocity{0, 5}},
{"Moving S", Velocity{-5, 0}},
{"Moving W", Velocity{0, -5}},
}
for _, tc := range testCases {
t.Run(tc.description, func(t *testing.T) {
p := new(Player)
p.Velocity = tc.playerVelocity
p.hitJunk()
if p.Velocity.Dx != tc.playerVelocity.Dx*JunkBounceFactor {
t.Error("Error calculating player Dx hitting junk")
}
if p.Velocity.Dy != tc.playerVelocity.Dy*JunkBounceFactor {
t.Error("Error calculating player Dy hitting junk")
}
if p.Velocity.Dx < tc.playerVelocity.Dx*JunkBounceFactor {
t.Error("Error x axis bounce factor greater than 1")
}
if p.Velocity.Dy < tc.playerVelocity.Dy*JunkBounceFactor {
t.Error("Error y axis bounce factor greater than 1")
}
})
}
}
func TestHitjunk(t *testing.T) {
testCases := []struct {
description string
Expand Down

0 comments on commit 7cf6a33

Please sign in to comment.