Skip to content

Commit

Permalink
Revert changes in guess game
Browse files Browse the repository at this point in the history
  • Loading branch information
meatball133 committed Oct 11, 2024
1 parent 9bc75c1 commit c4b7ac0
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions exercises/concept/guessing-game/test/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ import Test.Hspec (describe, hspec, it, shouldBe)
main :: IO ()
main = hspec $
describe "reply" $ do
it "correct when the guessed number equals secret" $ do
reply 7 (Guess 7) `shouldBe` "Correct"

it "too high when guessed number is greater than the secret" $ do
reply 9 (Guess 18) `shouldBe` "Too high"

it "too low when guessed number is less than the secret" $ do
reply 42 (Guess 30) `shouldBe` "Too low"

it "so close when guess differs from secret by -1" $ do
reply 64 63 `shouldBe` "So close!"

it "so close when guess differs from secret by +1" $ do
reply 52 53 `shouldBe` "So close!"

it "when no guess is supplied, ask the player to make a guess" $ do
reply 42 NoGuess `shouldBe` "Please make a guess"
it "1 should be 'Too low'" $
reply 1 `shouldBe` "Too low"
it "100 should be 'Too high'" $
reply 100 `shouldBe` "Too high"
it "41 should be 'So close'" $
reply 41 `shouldBe` "So close"
it "43 should be 'So close'" $
reply 43 `shouldBe` "So close"
it "42 should be 'Correct'" $
reply 42 `shouldBe` "Correct"

0 comments on commit c4b7ac0

Please sign in to comment.