advent-of-code-2024

My solutions to AoC 2024
Log | Files | Refs

day-12.lisp (748B)


      1 (defpackage #:aoc-test/day-12
      2   (:use #:cl #:lisp-unit2)
      3   (:import-from #:aoc/day-12))
      4 (in-package #:aoc-test/day-12)
      5 
      6 (define-test test-day-12
      7     ()
      8   (multiple-value-bind (task-1 task-2)
      9       (aoc:run-day 12 "AAAA
     10 BBCD
     11 BBCC
     12 EEEC")
     13     (assert= 140 task-1)
     14     (assert= 80 task-2))
     15   (multiple-value-bind (task-1 task-2)
     16       (aoc:run-day 12 "OOOOO
     17 OXOXO
     18 OOOOO
     19 OXOXO
     20 OOOOO")
     21     (assert= 772 task-1)
     22     (assert= 436 task-2))
     23   (assert= 1930 (aoc:run-day 12 "RRRRIICCFF
     24 RRRRIICCCF
     25 VVRRRCCFFF
     26 VVRCCCJFFF
     27 VVVVCJJCFE
     28 VVIVCCJJEE
     29 VVIIICJJEE
     30 MIIIIIJJEE
     31 MIIISIJEEE
     32 MMMISSJEEE"))
     33   (assert= 236 (nth-value 1 (aoc:run-day 12 "EEEEE
     34 EXXXX
     35 EEEEE
     36 EXXXX
     37 EEEEE")))
     38   (assert= 368 (nth-value 1 (aoc:run-day 12 "AAAAAA
     39 AAABBA
     40 AAABBA
     41 ABBAAA
     42 ABBAAA
     43 AAAAAA"))))