summaryrefslogtreecommitdiff
path: root/2023/go/internal/day_01/day_01_test.go
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2025-11-29 20:23:02 +0100
committerDJ O'Leary <dijitol@proton.me>2025-11-29 20:23:02 +0100
commit4c3a50166bf0f78ce89459c352cc1c6536a8b96d (patch)
tree02e4b66a1435680ef1e92bf82576747b27f16447 /2023/go/internal/day_01/day_01_test.go
parentbe2f8528b3829f8263507da301812d852297c168 (diff)
chore: make language folders snake_case
Diffstat (limited to '2023/go/internal/day_01/day_01_test.go')
-rw-r--r--2023/go/internal/day_01/day_01_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/2023/go/internal/day_01/day_01_test.go b/2023/go/internal/day_01/day_01_test.go
new file mode 100644
index 0000000..8063619
--- /dev/null
+++ b/2023/go/internal/day_01/day_01_test.go
@@ -0,0 +1,31 @@
+package day_01
+
+import (
+ "testing"
+)
+
+type input string
+type answer string
+
+func TestFindNumbers(t *testing.T) {
+ data := map[input]answer{
+ "1abc2": "12",
+ "pqr3stu8vwx": "38",
+ "a1b2c3d4e5f": "15",
+ "treb7uchet": "77",
+ }
+
+ for input, expected := range data {
+ actual_first, actual_last, err := findNumbers(string(input))
+
+ if err != nil {
+ t.Error("find_numbers returned an error")
+ }
+
+ actual := actual_first + actual_last
+
+ if actual != string(expected) {
+ t.Errorf("Expected %s, got %s", expected, actual)
+ }
+ }
+}