Day 5 Part 2

This commit is contained in:
Jens Kadenbach
2022-12-05 15:59:01 +01:00
parent 5af46b73dd
commit d62259bf75
6 changed files with 124 additions and 79 deletions

View File

@@ -6,6 +6,8 @@ import Text.Heredoc
import qualified Data.Sequence as S
import Day5.Part1
import Day5.Part2
import Day5.Shared
inputPart1 :: String
inputPart1 = [str| [D]
@@ -72,4 +74,11 @@ spec =
findTopOfStacks row `shouldBe` S.fromList "NDP"
it "solves the demo" $ do
day5_1 inputPart1 `shouldBe` "CMZ"
describe "Part1" $ do
it "executes 9001 operations on a row" $ do
let op = Operation { count = 2, from = StackIndex 2, to = StackIndex 3}
let row = S.fromList [Stack "NZ", Stack "DCM", Stack "P"]
execute9001Operation row op `shouldBe` S.fromList [Stack "NZ", Stack "M", Stack "DCP"]
it "solves the demo" $ do
day5_2 inputPart1 `shouldBe` "MCD"