Commit Diff


commit - 35dfaacf7838e916e7bebf9a02c17488493785b6
commit + e5bbdca6d8fff8576b98fcbe5cb98a9167d20a59
blob - 146ba36404a2684aecfd0cfba9c183c8880615f7
blob + 60b23430cd31f295b30bf233b2eca7a150764096
--- src/day-2.lisp
+++ src/day-2.lisp
@@ -1,6 +1,8 @@
 (defpackage #:aoc/day-2
   (:use #:cl #:aoc/utils)
-  (:export #:day-2))
+  (:export
+   #:report-safe-p
+   #:day-2))
 (in-package #:aoc/day-2)
 
 (defun report-safe-p (report &key direction allow-skip)
blob - f9502fdbc22266d46561c352bc11f23f7e555d2c
blob + eadca6709ef0dfe8564ee9953c3e8e1e05f49a1a
--- src/main.lisp
+++ src/main.lisp
@@ -91,34 +91,34 @@
                                                                 :value *cookie*
                                                                 :domain ".adventofcode.com"))))
        input-pathname))
-    (values
-     (unless (probe-file source-pathname)
-       (with-open-file (stream source-pathname :direction :output)
-         (let ((fun (make-symbol (format nil "DAY-~A" day)))
-               (package (make-symbol (format nil "AOC/DAY-~A" day)))
-               (*print-case* :downcase))
+    (let ((package (make-symbol (format nil "AOC/DAY-~A" day)))
+          (test-package (make-symbol (format nil "AOC-TEST/DAY-~A" day)))
+          (fun (make-symbol (format nil "DAY-~A" day)))
+          (*print-case* :downcase))
+      (values
+       (unless (probe-file source-pathname)
+         (with-open-file (stream source-pathname :direction :output)
            (format stream "~S~%~S~%~%(defun ~A (input)~%  )"
                    `(defpackage ,package
                       (:use #:cl #:aoc/utils)
                       (:export
                        ,fun))
                    `(in-package ,package)
-                   fun)))
-       ;; return function, makes it easy to jump into the file from Emacs
-       (day-fun day))
-     (unless (probe-file test-pathname)
-       (let ((package (make-symbol (format nil "AOC-TEST/DAY-~A" day)))
-             (*print-case* :downcase))
+                   fun))
+         ;; return function, makes it easy to jump into the file from Emacs
+         (day-fun day))
+       (unless (probe-file test-pathname)
          (with-open-file (stream test-pathname :direction :output)
            (format stream "~S~%~S~%~%(define-test test-day-~A~%    ()~%  )"
-                   `(defpackage ,package
-                      (:use #:cl #:lisp-unit2))
-                   `(in-package ,package)
+                   `(defpackage ,test-package
+                      (:use #:cl #:lisp-unit2)
+                      (:import-from ,package))
+                   `(in-package ,test-package)
                    day))
          (asdf:load-system (format nil "aoc-test/day-~A" day))
          (symbol-function
           (find-symbol (format nil "TEST-DAY-~A" day)
-                       (find-package package))))))))
+                       (find-package test-package))))))))
 
 (defun main ()
   (let* ((args (uiop:command-line-arguments))
blob - f8892b1d94866bb1fd40092e891c475f6dcd0131
blob + 1ba1296bb3e969281a836db98c572af556625c75
--- t/day-1.lisp
+++ t/day-1.lisp
@@ -1,5 +1,6 @@
 (defpackage #:aoc-test/day-1
-  (:use #:cl #:lisp-unit2))
+  (:use #:cl #:lisp-unit2)
+  (:import-from aoc/day-1))
 (in-package #:aoc-test/day-1)
 
 (define-test test-day-1
blob - 17bd3b5b674bdf909b561a6d8cd0b6806e626c2f
blob + 875dacd9a6830fc6e4d8cd57288e78ad388644c5
--- t/day-2.lisp
+++ t/day-2.lisp
@@ -1,16 +1,17 @@
 (defpackage #:aoc-test/day-2
-  (:use #:cl #:lisp-unit2))
+  (:use #:cl #:lisp-unit2)
+  (:import-from aoc/day-2))
 (in-package #:aoc-test/day-2)
 
 (define-test test-day-2
     ()
   ;;; Test resets
   ;; Report where the first item needs to be skipped
-  (assert (aoc/day-2::report-safe-p (list 30 24 25 28 31 33 35) :allow-skip t))
+  (assert (aoc/day-2:report-safe-p (list 30 24 25 28 31 33 35) :allow-skip t))
   ;; Report where the second item needs to be skipped
-  (assert (aoc/day-2::report-safe-p (list 24 21 25 28 31 33 35) :allow-skip t))
+  (assert (aoc/day-2:report-safe-p (list 24 21 25 28 31 33 35) :allow-skip t))
   ;; Report where reset target needs to be removed
-  (assert (aoc/day-2::report-safe-p (list 25 22 19 21 20 17 14 13) :allow-skip t))
+  (assert (aoc/day-2:report-safe-p (list 25 22 19 21 20 17 14 13) :allow-skip t))
   ;;; Test task 1 & 2
   (multiple-value-bind (task-1 task-2)
       (aoc:run-day 2 "7 6 4 2 1
blob - c4ebb6afc96cdfa83cc4d6fa4b580944a32c1b69
blob + d7bb04c6df72d4661bcfaa7f2eabf55f8c2dac60
--- t/day-3.lisp
+++ t/day-3.lisp
@@ -1,5 +1,6 @@
 (defpackage #:aoc-test/day-3
-  (:use #:cl #:lisp-unit2))
+  (:use #:cl #:lisp-unit2)
+  (:import-from aoc/day-3))
 (in-package #:aoc-test/day-3)
 
 (define-test test-day-3