-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrstr_test.go
39 lines (35 loc) · 895 Bytes
/
rstr_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
/* ====================================================
# Copyright (C)2019 All rights reserved.
#
# Author : domchan
# Email : [email protected]
# File Name : str.go
# Created : 2019-04-30 16:14
# Last Modified : 2019-04-30 16:14
# Describe :
#
# ====================================================*/
package gotask
import (
"testing"
)
const n = 20
func BenchmarkRandStringBytesMaskImprSrc(b *testing.B) {
var temp = make(map[string]bool, b.N)
for i := 0; i < b.N; i++ {
temp[RandStringBytesMaskImprSrc(n)] = true
}
if len(temp) != b.N {
b.Error("error len:", len(temp))
}
}
func TestRandStringBytesMaskImprSrc(t *testing.T) {
const length = 2000
var temp = make(map[string]bool, length)
for i := 0; i < length; i++ {
temp[RandStringBytesMaskImprSrc(n)] = true
}
if len(temp) != length {
t.Error("error len:", len(temp))
}
}