Skip to content
Snippets Groups Projects
Commit 8d4962c9 authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

add unit test for gopalindrome

parent 9a9d8818
No related branches found
No related tags found
No related merge requests found
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)
}
})
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment