1package v2
2
3import (
4	"encoding/json"
5	"testing"
6)
7
8func BenchmarkCheckRequestMarshal(b *testing.B) {
9	req := FixtureCheckRequest("cake")
10	b.ResetTimer()
11	b.RunParallel(func(pb *testing.PB) {
12		for pb.Next() {
13			_, _ = json.Marshal(req)
14		}
15	})
16}
17
18func BenchmarkCheckRequestUnmarshal(b *testing.B) {
19	req := FixtureCheckRequest("cake")
20	data, err := json.Marshal(req)
21	if err != nil {
22		b.Fatal(err)
23	}
24	b.ResetTimer()
25	b.RunParallel(func(pb *testing.PB) {
26		for pb.Next() {
27			var req CheckRequest
28			_ = json.Unmarshal(data, &req)
29		}
30	})
31}
32
33func BenchmarkCheckConfigMarshal(b *testing.B) {
34	req := FixtureCheckConfig("cake")
35	b.ResetTimer()
36	b.RunParallel(func(pb *testing.PB) {
37		for pb.Next() {
38			_, _ = json.Marshal(req)
39		}
40	})
41}
42
43func BenchmarkCheckConfigUnmarshal(b *testing.B) {
44	req := FixtureCheckConfig("cake")
45	data, err := json.Marshal(req)
46	if err != nil {
47		b.Fatal(err)
48	}
49	b.RunParallel(func(pb *testing.PB) {
50		for pb.Next() {
51			var req CheckConfig
52			_ = json.Unmarshal(data, &req)
53		}
54	})
55}
56