aboutsummaryrefslogtreecommitdiffstats
path: root/exercises/switch
diff options
context:
space:
mode:
authorMaurĂ­cio Antunes <mauricio.abreua@gmail.com>2022-11-17 08:48:01 -0300
committerMaurĂ­cio Antunes <mauricio.abreua@gmail.com>2022-11-17 08:48:01 -0300
commitcb8e07a53feefc1ba376cd679b96eeb587a87138 (patch)
tree7316b54a8b81de58bad8889e3b851ab55c58efa8 /exercises/switch
parent74c961d6cdeda92c22f964f346cac404d1fb8473 (diff)
feat: add one more switch exercise
Diffstat (limited to 'exercises/switch')
-rw-r--r--exercises/switch/switch3/main_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/exercises/switch/switch3/main_test.go b/exercises/switch/switch3/main_test.go
new file mode 100644
index 0000000..30015ee
--- /dev/null
+++ b/exercises/switch/switch3/main_test.go
@@ -0,0 +1,35 @@
+// switch3
+// Make me compile!
+
+// I AM NOT DONE
+package main_test
+
+import "testing"
+
+func weekDay(day int) string {
+ // Return the day of the week based on the
+ // integer. Use a switch case to satisfy all test cases below
+ return "Sunday"
+}
+
+func TestWeekDay(t *testing.T) {
+ tests := []struct {
+ input int
+ want string
+ }{
+ {input: 0, want: "Sunday"},
+ {input: 1, want: "Monday"},
+ {input: 2, want: "Tuesday"},
+ {input: 3, want: "Wednesday"},
+ {input: 4, want: "Thursday"},
+ {input: 5, want: "Friday"},
+ {input: 6, want: "Saturday"},
+ }
+
+ for _, tc := range tests {
+ day := weekDay(tc.input)
+ if day != tc.want {
+ t.Errorf("expected %s but got %s", tc.want, day)
+ }
+ }
+}