diff --git a/stringutil/stringutil_test.go b/stringutil/stringutil_test.go new file mode 100644 index 0000000..4777fe0 --- /dev/null +++ b/stringutil/stringutil_test.go @@ -0,0 +1,20 @@ +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") + } +} \ No newline at end of file