solved day1 2024

This commit is contained in:
Peter Tillemans 2024-12-01 11:57:25 +01:00
parent 4d7762fdaf
commit c0cc758e85
4 changed files with 10 additions and 42 deletions

View file

@ -14,11 +14,15 @@
#:lquery
#:3d-vectors
#:array-operations
#:lla)
#:lla
#:queues.simple-queue
#:bt-semaphore)
:components ((:module "src"
:components
((:file "main")
(:file "2018/day06"))))
(:file "2018/day06")
(:file "2018/day07")
)))
:description "Advent of Code challenges and solutions."
:long-description "Solutions for the AOC challenges."
:in-order-to ((test-op (test-op "aoc/tests"))))

View file

@ -1,6 +1,7 @@
(defpackage aoc
(:use :cl)
(:export
#:split-lines
#:test-input
#:clear-data-cache))

View file

@ -1,33 +0,0 @@
(defpackage :aoc/2018/06/tests
(:use :cl :aoc :aoc/tests :parachute :aoc/2018/06)
(:export
#:suite-2018-06
#:test-find-top-left
#:test-find-bottom-right
#:test-manhattan-distance
))
(in-package :aoc/2018/06/tests)
(define-test suite-2018-06
:parent suite-2018)
(define-test+run test-find-top-left
:parent suite-2018-06
(let ((result (top-left sample-points)))
(true (equalp (make-vector-2d :x 1 :y 1) result))))
(define-test+run test-find-bottom-right
:parent suite-2018-06
(let ((result (bottom-right sample-points)))
(true (equalp (make-vector-2d :x 8 :y 9) result))))
(define-test test-manhattan-distance
:parent suite-2018-06
(let ((p0 (make-vector-2d :x 0 :y 0))
(p1 (make-vector-2d :x 1 :y 1))
(p2 (make-vector-2d :x 3 :y 2)))
(true (eq 0 (manhattan-distance p0 p0)))
(true (eq 2 (manhattan-distance p0 p1)))
(true (eq 5 (manhattan-distance p0 p2)))
))

View file

@ -1,7 +1,7 @@
(defpackage aoc/tests
(:use :cl :aoc :parachute
:aoc/2018/06/tests )
(:export #:suite-2018))
(:use :cl :aoc :parachute)
(:export
#:aoc-suite))
(in-package :aoc/tests)
@ -10,10 +10,6 @@
;; top of test suite tree
(define-test aoc-suite)
;; suite for every year
(define-test suite-2018
:parent aoc-suite)
(define-test "should (= 1 1) to be true"
:parent aoc-suite
(true (= 1 1)))