-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntime_test.go
More file actions
43 lines (35 loc) · 988 Bytes
/
runtime_test.go
File metadata and controls
43 lines (35 loc) · 988 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
// Copyright 2024 FishGoddess. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package errors
import (
"testing"
)
// go test -v -run=^$ -bench=^BenchmarkCaller$ -benchtime=1s
// BenchmarkCaller-2 1390318 876.7 ns/op 296 B/op 3 allocs/op
func BenchmarkCaller(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
Caller()
}
}
// go test -v -run=^$ -bench=^BenchmarkCallers$ -benchtime=1s
// BenchmarkCallers-2 443419 2573 ns/op 732 B/op 12 allocs/op
func BenchmarkCallers(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
Callers()
}
}
// go test -v -cover -count=1 -test.cpu=1 -run=^TestCaller$
func TestCaller(t *testing.T) {
caller := Caller()
t.Log(caller)
}
// go test -v -cover -count=1 -test.cpu=1 -run=^TestCallers$
func TestCallers(t *testing.T) {
callers := Callers()
t.Log(callers)
}