aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2022/16/solver.lisp
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2022-12-18 21:14:45 +0100
committerOscar Najera <hi@oscarnajera.com>2022-12-18 21:14:45 +0100
commit090806c11b808cac4505759f0a8102c9481fd1be (patch)
tree7be53f9b0c727e1e8e2af141b0af175c6c472e1b /AoC2022/16/solver.lisp
parent0e776454e8c53c996f1bade2ccc59ad7e4b3ac92 (diff)
downloadscratch-090806c11b808cac4505759f0a8102c9481fd1be.tar.gz
scratch-090806c11b808cac4505759f0a8102c9481fd1be.tar.bz2
scratch-090806c11b808cac4505759f0a8102c9481fd1be.zip
test cleanup
Diffstat (limited to 'AoC2022/16/solver.lisp')
-rw-r--r--AoC2022/16/solver.lisp39
1 files changed, 23 insertions, 16 deletions
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"))