-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmisc_test.go
More file actions
57 lines (48 loc) · 920 Bytes
/
misc_test.go
File metadata and controls
57 lines (48 loc) · 920 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package gofaker
import (
"fmt"
"reflect"
"sort"
"testing"
"github.com/tinygg/gofaker/data"
)
func ExampleBool() {
Seed(11)
fmt.Println(Bool())
// Output: false
}
func BenchmarkBool(b *testing.B) {
for i := 0; i < b.N; i++ {
Bool()
}
}
func TestUUID(t *testing.T) {
id := UUID()
if len(id) != 36 {
t.Error("unique length does not equal requested length")
}
}
func ExampleUUID() {
Seed(11)
fmt.Println(UUID())
// Output: 590c1440-9888-45b0-bd51-a817ee07c3f2
}
func BenchmarkUUID(b *testing.B) {
for i := 0; i < b.N; i++ {
UUID()
}
}
func TestCategories(t *testing.T) {
var got, expected []string
for k := range Categories() {
got = append(got, k)
}
for k := range data.Data() {
expected = append(expected, k)
}
sort.Strings(got)
sort.Strings(expected)
if !reflect.DeepEqual(got, expected) {
t.Error("Type arrays are not the same.\nExpected: ", expected, "\nGot: ", got)
}
}