Skip to content

Commit

Permalink
fix up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Sep 15, 2020
1 parent 09cf006 commit 8bd8c0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/League.elm
@@ -1,7 +1,7 @@
module League exposing
( League, init, decoder, encode
, addPlayer, players, getPlayer, retirePlayer
, Match(..), currentMatch, nextMatch, startMatch, Outcome(..), finishMatch
, Match(..), currentMatch, nextMatch, startMatch, Outcome(..), finishMatch, kFactor
)

{-|
Expand All @@ -10,7 +10,7 @@ module League exposing
@docs addPlayer, players, getPlayer, retirePlayer
@docs Match, currentMatch, nextMatch, startMatch, Outcome, finishMatch
@docs Match, currentMatch, nextMatch, startMatch, Outcome, finishMatch, kFactor
-}

Expand Down Expand Up @@ -300,8 +300,6 @@ playInMatches =
5


{-| Chesterton's export
-}
kFactor : Player -> Int
kFactor player =
if player.matches < playInMatches then
Expand Down
12 changes: 10 additions & 2 deletions tests/LeagueTest.elm
Expand Up @@ -157,7 +157,7 @@ finishMatchTests =
\winner ->
let
newRatings =
Elo.win Elo.sensitiveKFactor
Elo.win (League.kFactor winner)
{ won = winner.rating
, lost = dummy.rating
}
Expand Down Expand Up @@ -204,7 +204,15 @@ finishMatchTests =
\player ->
let
newRatings =
Elo.draw Elo.sensitiveKFactor
Elo.draw
(League.kFactor
(if player.rating > dummy.rating then
player

else
dummy
)
)
{ playerA = player.rating
, playerB = dummy.rating
}
Expand Down

0 comments on commit 8bd8c0e

Please sign in to comment.