This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
generated from benjivesterby/go-template-repo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alog_bench_test.go
105 lines (86 loc) · 1.57 KB
/
alog_bench_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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package alog
import "testing"
func Benchmark_Println(b *testing.B) {
mock := &passmock{make(chan []byte)}
if err := testg(nil, mock); err != nil {
b.Error(err)
return
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
Println(nil)
if _, ok := <-mock.msg; !ok {
return
}
}
}
func Benchmark_Printf(b *testing.B) {
mock := &passmock{make(chan []byte)}
if err := testg(nil, mock); err != nil {
b.Error(err)
return
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
Println("%s", "hello")
if _, ok := <-mock.msg; !ok {
return
}
}
}
func Benchmark_Print(b *testing.B) {
mock := &passmock{make(chan []byte)}
if err := testg(nil, mock); err != nil {
b.Error(err)
return
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
Print(nil)
if _, ok := <-mock.msg; !ok {
return
}
}
}
func Benchmark_Debugln(b *testing.B) {
mock := &passmock{make(chan []byte)}
if err := testg(nil, mock); err != nil {
b.Error(err)
return
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
Debugln(nil, nil)
if _, ok := <-mock.msg; !ok {
return
}
}
}
func BenchmarkDebugf(b *testing.B) {
mock := &passmock{make(chan []byte)}
if err := testg(nil, mock); err != nil {
b.Error(err)
return
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
Debugln(nil, "%s", "hello")
if _, ok := <-mock.msg; !ok {
return
}
}
}
func Benchmark_Debug(b *testing.B) {
mock := &passmock{make(chan []byte)}
if err := testg(nil, mock); err != nil {
b.Error(err)
return
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
Debug(nil, nil)
if _, ok := <-mock.msg; !ok {
return
}
}
}