Добавить stringutil/stringutil_test.go
This commit is contained in:
20
stringutil/stringutil_test.go
Normal file
20
stringutil/stringutil_test.go
Normal file
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user