diff options
author | MaurĂcio Antunes <mauricio.abreua@gmail.com> | 2022-11-14 20:47:12 -0300 |
---|---|---|
committer | MaurĂcio Antunes <mauricio.abreua@gmail.com> | 2022-11-14 20:55:18 -0300 |
commit | fd4caed165737f6ffbaef02eb85139f1feaa765d (patch) | |
tree | ddfa2652f8b01d5ed65f3d6e57fb466e407e2e41 /exercises | |
parent | 807e94432911680a17913c733b24386ade358c80 (diff) |
feat: add one more if exercise
Diffstat (limited to 'exercises')
-rw-r--r-- | exercises/if/if2/main_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/exercises/if/if2/main_test.go b/exercises/if/if2/main_test.go new file mode 100644 index 0000000..5119dab --- /dev/null +++ b/exercises/if/if2/main_test.go @@ -0,0 +1,36 @@ +// if1 +// Make me compile! + +// I AM NOT DONE +package main_test + +import "testing" + +func fooIfFizz(fizzish string) string { + if fizzish == "fizz" { + return "foo" + } else { + return "complete me" + } +} + +func TestFooForFizz(t *testing.T) { + result := fooIfFizz("fizz") + if result != "foo" { + t.Errorf("should be 'foo' but got %s", result) + } +} + +func TestBarForFuzz(t *testing.T) { + result := fooIfFizz("fuzz") + if result != "bar" { + t.Errorf("should be 'bar' but got %s", result) + } +} + +func TestDefaultForBazz(t *testing.T) { + result := fooIfFizz("random stuff") + if result != "baz" { + t.Errorf("should be 'baz' but got %s", result) + } +} |