add a test

This commit is contained in:
surtur 2022-02-21 03:08:05 +01:00
parent 29676d7697
commit 40893dc75d
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -0,0 +1,19 @@
package moarstrings
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)
}
}
}