aboutsummaryrefslogtreecommitdiff
path: root/2017/t
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2020-12-05 10:55:56 -0300
committerMatias Linares <matiaslina@gmail.com>2020-12-05 10:55:56 -0300
commita0fcb600572ea0da9dee1b5b9e7a24ce674ebe7e (patch)
treea663ee4f6a427e98db0878ca539c9288bfbc70d0 /2017/t
parent5fa17cd54a1170449a91da48a2fe88a99349daa2 (diff)
downloadadvent-of-code-a0fcb600572ea0da9dee1b5b9e7a24ce674ebe7e.tar.gz
Add 2018 and 2017
Diffstat (limited to '2017/t')
-rw-r--r--2017/t/01-day.t17
-rw-r--r--2017/t/02-day.t23
-rw-r--r--2017/t/03-day.t11
3 files changed, 51 insertions, 0 deletions
diff --git a/2017/t/01-day.t b/2017/t/01-day.t
new file mode 100644
index 0000000..7a3333b
--- /dev/null
+++ b/2017/t/01-day.t
@@ -0,0 +1,17 @@
+use v6;
+use Test;
+use AdventOfCode;
+
+plan 4 + 5;
+
+is day01('1122'), 3;
+is day01('1111'), 4;
+is day01('1234'), 0;
+is day01('91212129'), 9;
+
+
+is day01b('1212'), 6;
+is day01b('1221'), 0;
+is day01b('123425'), 4;
+is day01b('123123'), 12;
+is day01b('12131415'), 4;
diff --git a/2017/t/02-day.t b/2017/t/02-day.t
new file mode 100644
index 0000000..787caff
--- /dev/null
+++ b/2017/t/02-day.t
@@ -0,0 +1,23 @@
+use v6;
+use Test;
+use AdventOfCode;
+
+plan 2;
+
+# First part
+my @mat = (
+ <5 1 9 5>,
+ <7 5 3>,
+ <2 4 6 8>,
+);
+
+is checksum(@mat), 18;
+
+# Second part
+my @spreadsheet2 = (
+ <5 9 2 8>,
+ <9 4 7 3>,
+ <3 8 6 5>,
+);
+
+is evenly-divisible-values(@spreadsheet2), 9;
diff --git a/2017/t/03-day.t b/2017/t/03-day.t
new file mode 100644
index 0000000..7a06465
--- /dev/null
+++ b/2017/t/03-day.t
@@ -0,0 +1,11 @@
+use v6;
+use Test;
+use AdventOfCode;
+
+plan 5;
+
+is spiral-memory(1), 0;
+is spiral-memory(9), 2;
+is spiral-memory(12), 3;
+is spiral-memory(23), 2;
+is spiral-memory(1024), 31;