This commit is contained in:
VicRen
2020-11-24 09:00:01 +08:00
parent 6ac236008b
commit f645fead63
2 changed files with 59 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package main
import "testing"
func Test_compress(t *testing.T) {
type args struct {
s string
}
tests := []struct {
name string
args args
want string
}{
{
"test1",
args{"aabcccccaaa"},
"a2b1c5a3",
},
{
"test2",
args{"abbccd"},
"abbccd",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := compress(tt.args.s); got != tt.want {
t.Errorf("compress() = %v, want %v", got, tt.want)
}
})
}
}