Skip to content

Commit

Permalink
test that get is doing what I think it is
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Feb 21, 2020
1 parent e444442 commit 2348034
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/GridTests.elm
Expand Up @@ -6,6 +6,31 @@ import Grid exposing (Grid)
import Test exposing (..)


getTest : Test
getTest =
let
grid =
Grid.fromRowsAndColumns [ [ () ] ]
in
describe "get"
[ test "in-bounds coordinates should return the value at the coordinates" <|
\_ ->
Expect.equal (Just ()) (Grid.get { row = 0, column = 0 } grid)
, test "coordinates above the top row should return Nothing" <|
\_ ->
Expect.equal Nothing (Grid.get { row = -1, column = 0 } grid)
, test "coordinates below the bottom row should return Nothing" <|
\_ ->
Expect.equal Nothing (Grid.get { row = 1, column = 0 } grid)
, test "coordinates to the left of the leftmost column should return Nothing" <|
\_ ->
Expect.equal Nothing (Grid.get { row = 0, column = -1 } grid)
, test "coordinates to the right of the rightmost row should return Nothing" <|
\_ ->
Expect.equal Nothing (Grid.get { row = 0, column = 1 } grid)
]


getAndSetTest : Test
getAndSetTest =
fuzz coordsFuzzer "setting a value and then getting the same value should work" <|
Expand Down

0 comments on commit 2348034

Please sign in to comment.