aboutsummaryrefslogtreecommitdiff
path: root/2024/tests.scm
diff options
context:
space:
mode:
authorMatias Linares <matias@deprecated.org>2024-12-05 08:57:25 -0300
committerMatias Linares <matias@deprecated.org>2024-12-05 08:57:25 -0300
commit1a81d370510a01b482aae8033704d1a0523d11b7 (patch)
tree6ff5bc751499791a9ef36a08d221baa4bab08a5e /2024/tests.scm
parent78be8a52124f44f09cb3582cefdf736301a78a50 (diff)
downloadadvent-of-code-1a81d370510a01b482aae8033704d1a0523d11b7.tar.gz
Add day 04 of 2024
Diffstat (limited to '2024/tests.scm')
-rw-r--r--2024/tests.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/2024/tests.scm b/2024/tests.scm
new file mode 100644
index 0000000..f09a92c
--- /dev/null
+++ b/2024/tests.scm
@@ -0,0 +1,37 @@
+;(add-to-load-path "2024/")
+(use-modules (aoc-utils)
+ (srfi srfi-64))
+
+(test-begin "aoc-utils")
+
+(test-group "matrix"
+ (define test-lst '((1 2 3)
+ (4 5 6)
+ (7 8 9)))
+
+ (test-equal (list-flatten test-lst) '(1 2 3 4 5 6 7 8 9))
+
+ (define m (make-matrix test-lst))
+
+ (test-equal (matrix-inner m) (list-flatten test-lst))
+ (test-equal (matrix-width m) 3)
+ (test-equal (matrix-height m) 3)
+
+ (test-equal (matrix-ref m 0 0) 1)
+ (test-equal (matrix-ref m 1 1) 5)
+ (test-equal (matrix-ref m 2 2) 9)
+
+ (test-assert (matrix-valid-x? m 0))
+ (test-assert (matrix-valid-x? m 1))
+ (test-assert (matrix-valid-x? m 2))
+ (test-assert (not (matrix-valid-x? m 3)))
+ (test-assert (not (matrix-valid-x? m -1)))
+
+ (test-assert (matrix-valid-y? m 0))
+ (test-assert (matrix-valid-y? m 1))
+ (test-assert (matrix-valid-y? m 2))
+ (test-assert (not (matrix-valid-y? m 3)))
+ (test-assert (not (matrix-valid-y? m -1)))
+ )
+
+(test-end "aoc-utils")