-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoardSpec.hs
43 lines (41 loc) · 1.85 KB
/
BoardSpec.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
module BoardSpec where
import Test.Hspec
import Board
import Inventory
main :: IO ()
main = hspec $do
describe "The display of a plain cell" $do
context "when it is empty" $do
it "appears empty" $do
displayCell (PlainCell NoCreature NoItem) `shouldBe` " "
context "when it has a creature in it" $do
it "appears as the creature's symbol" $do
displayCell (PlainCell User NoItem) `shouldBe` "@"
context "when it has an item in it" $do
it "appears as the item's symbol" $do
displayCell (PlainCell NoCreature Money) `shouldBe` "$"
context "when it has a creature and an item in it" $do
it "appears as the creature's symbol" $do
displayCell (PlainCell User Money) `shouldBe` "@"
describe "The display of the exit cell" $do
context "when it is empty" $do
it "appears as the Apple command symbol" $do
displayCell (ExitCell NoCreature) `shouldBe` "⌘"
describe "Creating a two-by-three default board" $do
context "results in a board" $do
let subject = (boardWithSize 2 3)
it "with a length of two" $do
lengthOf subject `shouldBe` 2
it "with a height of two" $do
heightOf subject `shouldBe` 3
it "with all empty plain cells" $do
displayBoard subject `shouldBe` " \n \n \n"
describe "Creating a three-by-two default board" $do
context "results in a board" $do
let subject = (boardWithSize 3 2)
it "with a length of two" $do
lengthOf subject `shouldBe` 3
it "with a height of two" $do
heightOf subject `shouldBe` 2
it "with all empty plain cells" $do
displayBoard subject `shouldBe` " \n \n"