From 303cdd468606b50cfa2bef5a9b196fd04ea58187 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Fri, 16 Dec 2022 17:09:05 +0100 Subject: test --- AoC2022/14/solver.el | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'AoC2022/14/solver.el') diff --git a/AoC2022/14/solver.el b/AoC2022/14/solver.el index 749b29b..0ad36fb 100644 --- a/AoC2022/14/solver.el +++ b/AoC2022/14/solver.el @@ -128,15 +128,13 @@ (setq x 500 y 0))))) drops)) -(let* ((instr "498,4 -> 498,6 -> 496,6 -503,4 -> 502,4 -> 502,9 -> 494,9") - (instr (find-file-noselect "input")) - (bounds (solver-bounds instr)) - (grid (solver-grid-create bounds)) - ) - (solver-walls instr grid) - ;; sim - (solver-simulate grid) +(defun solver-part1 (instructions) + (let* ((bounds (solver-bounds instructions)) + (grid (solver-grid-create bounds))) + (solver-walls instructions grid) + (solver-simulate grid))) - ;; (solver-draw-grid grid) - ) +(ert-deftest test-part1 () + (should (= 24 (solver-part1 "498,4 -> 498,6 -> 496,6 +503,4 -> 502,4 -> 502,9 -> 494,9"))) + (should (= 665 (solver-part1 (find-file-noselect "input"))))) -- cgit v1.2.3