You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
411 B
23 lines
411 B
4 years ago
|
package tools
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestShowString(t *testing.T) {
|
||
|
ShowStringByte("hello,世界")
|
||
|
}
|
||
|
func TestReverse2(t *testing.T) {
|
||
|
cases := []struct {
|
||
|
in, want string
|
||
|
}{
|
||
|
{"Hello, world", "dlrow ,olleH"},
|
||
|
{"Hello, 世界", "界世 ,olleH"},
|
||
|
{"", ""},
|
||
|
}
|
||
|
for _, c := range cases {
|
||
|
got := Reverse2(c.in)
|
||
|
if got != c.want {
|
||
|
t.Errorf("Reverse(%q) == %q, want %q", c.in, got, c.want)
|
||
|
}
|
||
|
}
|
||
|
}
|