implemented Player and PlayerStats

This commit is contained in:
Jonathan Lamothe
2019-08-09 11:06:13 -04:00
parent e20de2a50f
commit 57b0b74cd1
4 changed files with 113 additions and 1 deletions

26
test/TypesSpec.hs Normal file
View File

@@ -0,0 +1,26 @@
module TypesSpec (spec) where
import Lens.Micro ((&), (.~))
import Test.Hspec (Spec, context, describe, it, shouldBe)
import Mtlstats.Types
spec :: Spec
spec = describe "Mtlstats.Types" pPointsSpec
pPointsSpec = describe "pPoints" $ mapM_
(\(goals, assists, points) -> let
desc = "goals: " ++ show goals ++
", assists: " ++ show assists
stats = newPlayerStats &
psGoals .~ goals &
psAssists .~ assists
in context desc $
it ("should be " ++ show points) $
pPoints stats `shouldBe` points)
-- goals, assists, points
[ ( 0, 0, 0 )
, ( 1, 0, 1 )
, ( 0, 1, 1 )
, ( 2, 3, 5 )
]