TestCard.elm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. module TestCard exposing (..)
  2. import Card exposing (ManaCost(..), ManaColor(..))
  3. import Expect exposing (Expectation)
  4. import Fuzz exposing (Fuzzer, int, list, string)
  5. import Signals
  6. import Test exposing (..)
  7. suite : Test
  8. suite =
  9. describe "Card"
  10. [ test "parseManaCost ('')" <|
  11. \_ ->
  12. Expect.equal (Card.parseManaCost "") (Just [])
  13. , test "parseManaCost ('{X}')" <|
  14. \_ ->
  15. Expect.equal (Card.parseManaCost "{X}") (Just [ X ])
  16. , test "parseManaCost ('{X}{Y}')" <|
  17. \_ ->
  18. Expect.equal (Card.parseManaCost "{X}{Y}") (Just [ X, Y ])
  19. , test "parseManaCost ('{2/G}{2/U}{2/R}')" <|
  20. \_ ->
  21. Expect.equal (Card.parseManaCost "{2/G}{2/U}{2/R}") (Just [ TwoOrColor Green, TwoOrColor Blue, TwoOrColor Red ])
  22. , test "parsePower ('')" <|
  23. \_ ->
  24. Expect.equal (Card.parsePower "") Nothing
  25. , test "parsePower ('1')" <|
  26. \_ ->
  27. Expect.equal (Card.parsePower "1") (Just (Card.ConstantPower 1))
  28. , test "parsePower ('0')" <|
  29. \_ ->
  30. Expect.equal (Card.parsePower "0") (Just (Card.ConstantPower 0))
  31. , test "parsePower ('*')" <|
  32. \_ ->
  33. Expect.equal (Card.parsePower "*") (Just (Card.VariablePower))
  34. , test "parsePower ('1+*')" <|
  35. \_ ->
  36. Expect.equal (Card.parsePower "1+*") (Just (Card.ConstantPlusVariablePower 1))
  37. ]