-
Notifications
You must be signed in to change notification settings - Fork 0
/
iterator_test.go
39 lines (31 loc) · 998 Bytes
/
iterator_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package split_test
import (
"crypto/rand"
)
var abcd = "abc𝚫"
var emoji = "👍🐶"
var efghi = "éfghi"
var testSeparators = []string{"", " ", ",", ", ", "🐶", "𝚫", "🌏👍", abcd, emoji, efghi}
var testStrings []string
func init() {
testStrings = append(testStrings, "") // empty
testStrings = append(testStrings, abcd)
testStrings = append(testStrings, emoji)
testStrings = append(testStrings, efghi)
// Random string
b := make([]byte, 500)
rand.Read(b)
testStrings = append(testStrings, string(b))
// Random separator
b = make([]byte, 4)
rand.Read(b)
testSeparators = append(testSeparators, string(b))
for _, sep := range testSeparators {
testStrings = append(testStrings, sep)
center := abcd + sep + emoji + sep + efghi
testStrings = append(testStrings, center)
testStrings = append(testStrings, sep+center) // leading
testStrings = append(testStrings, center+sep) // trailing
testStrings = append(testStrings, sep+center+sep) // both
}
}