advent-of-code-2023

My solutions to AoC 2023
git clone git://git.entf.net/advent-of-code-2023
Log | Files | Refs

day-21.lisp (836B)


      1 (defpackage #:aoc-test/day-21
      2   (:use #:cl #:lisp-unit2))
      3 (in-package #:aoc-test/day-21)
      4 
      5 (defparameter *test-map* "...........
      6 .....###.#.
      7 .###.##..#.
      8 ..#.#...#..
      9 ....#.#....
     10 .##..S####.
     11 .##..#...#.
     12 .......##..
     13 .##.#.####.
     14 .##..##.##.
     15 ...........")
     16 
     17 (define-test test-day-21
     18     ()
     19   (multiple-value-bind (task-1 task-2)
     20       (aoc:run-day 21 *test-map* 6 6)
     21     (assert= 16 task-1)
     22     (assert= 16 task-2))
     23   ;; Tests don't work for task 2
     24   #+nil(loop for (expected steps) in '((50 10)
     25                                        (1594 50)
     26                                        (6536 100)
     27                                        (167004 500)
     28                                        (668697 1000)
     29                                        (16733044 5000))
     30              do (assert= expected (nth-value 1 (aoc:run-day 21 *test-map* 0 steps)))))