{-# LANGUAGE QuasiQuotes #-} module Day12Spec (spec) where import Day12 import Test.Hspec import Text.Heredoc import Data.Maybe (fromJust, isJust) testInput :: String testInput = [str|Sabqponm |abcryxxl |accszExk |acctuvwj |abdefghi |] spec :: Spec spec = describe "Day12" $ do describe "Part1" $ do it "finds a path" $ do let (points, grid) = parseGrid testInput let result = findPath grid points isJust result `shouldBe` True fst (fromJust result) `shouldBe` 31 it "finds shortest paths from all lowest points" $ do let (points, grid) = parseGrid testInput let fastest = findBestPath grid points fst fastest `shouldBe` 29