aboutsummaryrefslogtreecommitdiff
path: root/lib/strings/string_test.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-01-07 12:02:31 +0700
committerShulhan <m.shulhan@gmail.com>2020-01-07 12:02:31 +0700
commit84ba21902eef9620dc129a03f7ceec7d4ba0fc19 (patch)
treec107eb86851e27bc3a1b230b45e5ad625d251e08 /lib/strings/string_test.go
parent887038fe4b0373534256e95dd3acf240f6977cd8 (diff)
downloadpakakeh.go-84ba21902eef9620dc129a03f7ceec7d4ba0fc19.tar.xz
strings: add function to reverse a string
Diffstat (limited to 'lib/strings/string_test.go')
-rw-r--r--lib/strings/string_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/strings/string_test.go b/lib/strings/string_test.go
index 0afdcdf5..11644de8 100644
--- a/lib/strings/string_test.go
+++ b/lib/strings/string_test.go
@@ -169,6 +169,22 @@ func TestMergeSpaces(t *testing.T) {
}
}
+func TestReverse(t *testing.T) {
+ cases := []struct {
+ input string
+ exp string
+ }{{
+ input: "The quick bròwn 狐 jumped over the lazy 犬",
+ exp: "犬 yzal eht revo depmuj 狐 nwòrb kciuq ehT",
+ }}
+
+ for _, c := range cases {
+ got := Reverse(c.input)
+
+ test.Assert(t, "Reverse", c.exp, got, true)
+ }
+}
+
func TestSplit(t *testing.T) {
cases := []struct {
text string