From 2348034ca5f37c6889be2f319f9ca1b5a989f8ac Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Thu, 20 Feb 2020 20:45:16 -0600 Subject: [PATCH] test that get is doing what I think it is --- tests/GridTests.elm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/GridTests.elm b/tests/GridTests.elm index f5fe9af..68cae4f 100644 --- a/tests/GridTests.elm +++ b/tests/GridTests.elm @@ -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" <|