adventofcode2022

My solutions for Advent of Code 2022
Log | Files | Refs

day15.lisp (1096B)


      1 (in-package #:adventofcode2022/test)
      2 
      3 (define-constant +testdata-day15+ "Sensor at x=2, y=18: closest beacon is at x=-2, y=15
      4 Sensor at x=9, y=16: closest beacon is at x=10, y=16
      5 Sensor at x=13, y=2: closest beacon is at x=15, y=3
      6 Sensor at x=12, y=14: closest beacon is at x=10, y=16
      7 Sensor at x=10, y=20: closest beacon is at x=10, y=16
      8 Sensor at x=14, y=17: closest beacon is at x=10, y=16
      9 Sensor at x=8, y=7: closest beacon is at x=2, y=10
     10 Sensor at x=2, y=0: closest beacon is at x=2, y=10
     11 Sensor at x=0, y=11: closest beacon is at x=2, y=10
     12 Sensor at x=20, y=14: closest beacon is at x=25, y=17
     13 Sensor at x=17, y=20: closest beacon is at x=21, y=22
     14 Sensor at x=16, y=7: closest beacon is at x=15, y=3
     15 Sensor at x=14, y=3: closest beacon is at x=15, y=3
     16 Sensor at x=20, y=1: closest beacon is at x=15, y=3"
     17   :test 'equal)
     18 
     19 (def-test day15-task1 ()
     20   (is-true
     21    (= 26
     22       (run-task 15 1
     23                 (make-string-input-stream +testdata-day15+)))))
     24 
     25 (def-test day15-task2 ()
     26   (is-true
     27    (= 56000011
     28       (run-task 15 2
     29                 (make-string-input-stream +testdata-day15+)))))