diff --git a/src/gopalindrome/main_test.go b/src/gopalindrome/main_test.go new file mode 100644 index 0000000000000000000000000000000000000000..14b9ca0faa8bdaced4d1bfc308f5aa49863a0d6a --- /dev/null +++ b/src/gopalindrome/main_test.go @@ -0,0 +1,33 @@ +package main + +import ( + "testing" +) + +func TestIsPalindrome(t *testing.T) { + tests := []struct { + str string + expected bool + }{ + { + "Reit nie, ein Tier", + true, + }, + { + "Kein Palidrom", + false, + }, + { + "Abba", + true, + }, + } + for _, tt := range tests { + t.Run(tt.str, func(t *testing.T) { + isPalindrome := isPalindrome(tt.str) + if isPalindrome != tt.expected { + t.Errorf(`IsPalindrome("%s") returns %v but must be %v`, tt.str, isPalindrome, tt.expected) + } + }) + } +}