From 090806c11b808cac4505759f0a8102c9481fd1be Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sun, 18 Dec 2022 21:14:45 +0100 Subject: test cleanup --- AoC2022/16/solver.lisp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'AoC2022/16/solver.lisp') diff --git a/AoC2022/16/solver.lisp b/AoC2022/16/solver.lisp index 9bda6f2..0d2d9d7 100644 --- a/AoC2022/16/solver.lisp +++ b/AoC2022/16/solver.lisp @@ -79,11 +79,15 @@ sum (* flow (- start-time runtime)) into release finally (return release))) -(shortest-path (data "eg-in") 'AA 'CC) - -(= 1648 (path-release '(AA DD JJ BB CC HH EE) (worthwhile-graph (data "eg-in")) 30)) -(= 1651 (path-release '(AA DD BB JJ HH EE CC) (worthwhile-graph (data "eg-in")) 30)) -(= 560 (path-release '(AA DD) (worthwhile-graph (data "eg-in")) 30)) +;; (shortest-path (data "eg-in") 'AA 'CC) +(fiveam:test loads + (fiveam:is + (= 1648 (path-release '(AA DD JJ BB CC HH EE) (worthwhile-graph (data "eg-in")) 30))) + (fiveam:is + (= 1651 (path-release '(AA DD BB JJ HH EE CC) (worthwhile-graph (data "eg-in")) 30))) + (fiveam:is + (= 560 (path-release '(AA DD) (worthwhile-graph (data "eg-in")) 30)))) +(fiveam:run-all-tests) ;; ;; part 1 (let* ((open '(aa)) @@ -131,8 +135,8 @@ ;; '(AA RA XK YH NM YP XS) ;; (worthwhile-graph (data "input"))) -(defun part2 () - (let* ((action-graph (worthwhile-graph (data "eg-in"))) +(defun part2 (filename) + (let* ((action-graph (worthwhile-graph (data filename))) (start-time 26) (actor (list `((aa) ,start-time) `((aa) ,start-time)))) @@ -169,16 +173,19 @@ ;; (princ) (traverse action-graph actor '(aa))))) -(require :sb-sprof) +(part2 "eg-in") + +(part2 "input") +;; (require :sb-sprof) -(sb-sprof:with-profiling (:max-samples 1000 - :report :flat - :loop t - :show-progress t) - (dotimes (_ 100) - (part2)) - ) -(time (part2)) +;; (sb-sprof:with-profiling (:max-samples 1000 +;; :report :flat +;; :loop t +;; :show-progress t) +;; (dotimes (_ 100) +;; (part2 "eg-in")) +;; ) +;; (time (part2 "eg-in")) ;; (length (worthwhile-graph (data "input"))) ;; (loop for (name flow . neighbors) in (worthwhile-graph (data "input")) -- cgit v1.2.3