20 lines
414 B
Go
20 lines
414 B
Go
package stringutil
|
|
|
|
import "testing"
|
|
|
|
func TestReverse(t *testing.T) {
|
|
result := Reverse("hello")
|
|
expected := "olleh"
|
|
if result != expected {
|
|
t.Errorf("Reverse('hello') = %s; want %s", result, expected)
|
|
}
|
|
}
|
|
|
|
func TestIsPalindrome(t *testing.T) {
|
|
if !IsPalindrome("aba") {
|
|
t.Error("IsPalindrome('aba') = false; want true")
|
|
}
|
|
if IsPalindrome("ab") {
|
|
t.Error("IsPalindrome('ab') = true; want false")
|
|
}
|
|
} |