diff --git a/src/2024/day06.lisp b/src/2024/day06.lisp index 30b61bc..b919785 100644 --- a/src/2024/day06.lisp +++ b/src/2024/day06.lisp @@ -115,7 +115,6 @@ (defun guard-path (labo guard &optional (path (make-hash-table :size 10000)) (extra-block nil)) (let ((hash (guard-hash guard))) - (format t "~A~%" guard) (cond ((not guard) (remove-duplicates (loop for k being the hash-keys of path collect (floor (/ k 10))))) ((gethash hash path) nil) diff --git a/src/2024/day08.lisp b/src/2024/day08.lisp index 64560ef..43e98f6 100644 --- a/src/2024/day08.lisp +++ b/src/2024/day08.lisp @@ -1,6 +1,9 @@ (defpackage :aoc/2024/08 (:use :cl :aoc :alexandria :trivia :lla) (:export + #:parse-line + #:parse-input + #:sample-text #:sample-data #:sample-data2 #:part1 @@ -19,7 +22,6 @@ (defun parse-line (line) - "return an equation with the result and the operands in reverse order as in the text" (loop for x from 0 to (1- (length line)) for c = (aref line x) diff --git a/src/2024/day12.lisp b/src/2024/day12.lisp index 35d7a29..3effce3 100644 --- a/src/2024/day12.lisp +++ b/src/2024/day12.lisp @@ -172,7 +172,7 @@ MMMISSJEEE )) (defun part2 (data) - (format nil "~A" (calculate-costs (calculate-info (scan-regions data) #'si)))) + (format nil "~A" (calculate-costs (calculate-info (scan-regions data) #'sides)))) (defun solve-day () (format t "part1: ~A~%" (part1 input-data)) diff --git a/tests/2024/day06-test.lisp b/tests/2024/day06-test.lisp index 607e025..a015fcf 100644 --- a/tests/2024/day06-test.lisp +++ b/tests/2024/day06-test.lisp @@ -15,6 +15,6 @@ (define-test+run test-part2 :parent suite-2024-06 - (true (equalp "6" (part2 sample-data2)))) + (true (equalp "6" (part2 sample-data)))) diff --git a/tests/2024/day08-test.lisp b/tests/2024/day08-test.lisp index 3f25842..93bac75 100644 --- a/tests/2024/day08-test.lisp +++ b/tests/2024/day08-test.lisp @@ -1,5 +1,6 @@ (defpackage :aoc/2024/08/tests - (:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/08)) + (:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/08) + (:export :run-tests)) (in-package :aoc/2024/08/tests) @@ -11,20 +12,18 @@ (define-test+run test-part1 :parent suite-2024-08 - (true (equalp '( '()) (part1 sample-data)))) + (is equal "14" (part1 sample-data))) (define-test+run test-part2 :parent suite-2024-08 - (true - (equalp "34" (part2 sample-data))) - (true - (equalp "9" (part2 sample-data2)))) - + (is equalp "34" (part2 sample-data)) + (is equalp "9" (part2 sample-data2))) (define-test test-parse-line :parent suite-2024-08 - (is equalp '() (parse-line (first sample-data))) - (is equalp '((8 #\0)) (parse-line (second sample-data))) - ) + (is equalp '() (parse-line (first sample-text))) + (is equalp '((8 #\0)) (parse-line (second sample-text)))) +(defun run-tests () + (test 'suite-2024-08)) diff --git a/tests/2024/main.lisp b/tests/2024/main.lisp index b1fa81b..def052a 100644 --- a/tests/2024/main.lisp +++ b/tests/2024/main.lisp @@ -7,3 +7,11 @@ (define-test suite-2024 :parent 'aoc-suite) + + +(define-test test-day08 + :parent 'suite-2024 + (aoc/2024/08/tests:run-tests)) + + +