Add test
This commit is contained in:
parent
5f9f0b3371
commit
f339311520
19
reverse_test.go
Normal file
19
reverse_test.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package morestrings
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestReverseRunes(t *testing.T) {
|
||||||
|
cases := []struct {
|
||||||
|
in, want string
|
||||||
|
}{
|
||||||
|
{"Hello, world", "dlrow ,olleH"},
|
||||||
|
{"Hello, 世界", "界世 ,olleH"},
|
||||||
|
{"", ""},
|
||||||
|
}
|
||||||
|
for _, c := range cases {
|
||||||
|
got := ReverseRunes(c.in)
|
||||||
|
if got != c.want {
|
||||||
|
t.Errorf("ReverseRunes(%q) == %q, want %q", c.in, got, c.want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user