63 lines
1.3 KiB
Common Lisp
63 lines
1.3 KiB
Common Lisp
(defpackage :aoc/2024/23/tests
|
|
(:use :cl :aoc :aoc/tests :aoc/2024/tests :parachute :aoc/2024/23))
|
|
|
|
(in-package :aoc/2024/23/tests)
|
|
|
|
(define-test suite-2024-23
|
|
;:parent suite-2024
|
|
)
|
|
|
|
(define-test test-find-loops-n
|
|
:parent suite-2024-23
|
|
|
|
(let ((network (make-hash-table :test #'equal)))
|
|
(setf (gethash "ab" network) '("cd" "ef"))
|
|
(setf (gethash "cd" network) '("ab" "ef"))
|
|
(setf (gethash "ef" network) '("ab" "cd"))
|
|
(is equal '(("ab" "cd" "ef") ("cd" "ab" "ef")) (find-loops-n network 3))
|
|
)
|
|
)
|
|
|
|
(defparameter expected-groups "aq,cg,yn
|
|
aq,vc,wq
|
|
co,de,ka
|
|
co,de,ta
|
|
co,ka,ta
|
|
de,ka,ta
|
|
kh,qp,ub
|
|
qp,td,wh
|
|
tb,vc,wq
|
|
tc,td,wh
|
|
td,wh,yn
|
|
ub,vc,wq")
|
|
|
|
(define-test test-find-groups
|
|
:parent suite-2024-23
|
|
|
|
(is equal expected-groups (format-groups (find-lan-party-groups sample-data)))
|
|
|
|
)
|
|
|
|
(defparameter historian-groups "co,de,ta
|
|
co,ka,ta
|
|
de,ka,ta
|
|
qp,td,wh
|
|
tc,td,wh
|
|
tb,vc,wq
|
|
td,wh,yn
|
|
")
|
|
|
|
(define-test test-historian-groups
|
|
:parent suite-2024-23
|
|
(is string-equal historian-groups (format-groups (find-historian-groups sample-data)))
|
|
)
|
|
|
|
|
|
|
|
(define-test+run test-part1
|
|
:parent suite-2024-23
|
|
(is equal nil (part1 sample-data)))
|
|
|
|
(define-test+run test-part2
|
|
:parent suite-2024-23
|
|
(is equal nil (part2 sample-data)))
|