From 8bd8c0ea98b7acb254c2bd6d770c783cc54948bb Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Tue, 15 Sep 2020 08:59:28 -0500 Subject: [PATCH] fix up tests --- src/League.elm | 6 ++---- tests/LeagueTest.elm | 12 ++++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/League.elm b/src/League.elm index 6cba5b3..45157b9 100644 --- a/src/League.elm +++ b/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 ) {-| @@ -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 -} @@ -300,8 +300,6 @@ playInMatches = 5 -{-| Chesterton's export --} kFactor : Player -> Int kFactor player = if player.matches < playInMatches then diff --git a/tests/LeagueTest.elm b/tests/LeagueTest.elm index bf574f1..36b2c40 100644 --- a/tests/LeagueTest.elm +++ b/tests/LeagueTest.elm @@ -157,7 +157,7 @@ finishMatchTests = \winner -> let newRatings = - Elo.win Elo.sensitiveKFactor + Elo.win (League.kFactor winner) { won = winner.rating , lost = dummy.rating } @@ -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 }