Skip to content

Commit 3956878

Browse files
committed
lint fixes
1 parent b786cbf commit 3956878

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

sauce_bench_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func BenchmarkIndex(b *testing.B) {
1919
}
2020

2121
b.ResetTimer()
22-
for i := 0; i < b.N; i++ {
22+
for b.Loop() {
2323
_ = sauce.Index(raw)
2424
}
2525
}
@@ -33,12 +33,12 @@ func BenchmarkIndexLargeFile(b *testing.B) {
3333

3434
// Create a larger file by repeating the content
3535
largeFile := make([]byte, 0, len(raw)*10)
36-
for j := 0; j < 10; j++ {
36+
for range 10 {
3737
largeFile = append(largeFile, raw...)
3838
}
3939

4040
b.ResetTimer()
41-
for i := 0; i < b.N; i++ {
41+
for b.Loop() {
4242
_ = sauce.Index(largeFile)
4343
}
4444
}
@@ -51,7 +51,7 @@ func BenchmarkDecode(b *testing.B) {
5151
}
5252

5353
b.ResetTimer()
54-
for i := 0; i < b.N; i++ {
54+
for b.Loop() {
5555
_ = sauce.Decode(raw)
5656
}
5757
}
@@ -64,7 +64,7 @@ func BenchmarkTrim(b *testing.B) {
6464
}
6565

6666
b.ResetTimer()
67-
for i := 0; i < b.N; i++ {
67+
for b.Loop() {
6868
_ = sauce.Trim(raw)
6969
}
7070
}
@@ -77,7 +77,7 @@ func BenchmarkRead(b *testing.B) {
7777
}
7878

7979
b.ResetTimer()
80-
for i := 0; i < b.N; i++ {
80+
for b.Loop() {
8181
reader := bytes.NewReader(raw)
8282
_, _ = sauce.Read(reader)
8383
}
@@ -90,7 +90,7 @@ func BenchmarkUnsignedBinary1(b *testing.B) {
9090
testData := [1]byte{0xFF}
9191

9292
b.ResetTimer()
93-
for i := 0; i < b.N; i++ {
93+
for b.Loop() {
9494
_ = layout.UnsignedBinary1(testData)
9595
}
9696
}
@@ -100,7 +100,7 @@ func BenchmarkUnsignedBinary2(b *testing.B) {
100100
testData := [2]byte{0xFF, 0x00}
101101

102102
b.ResetTimer()
103-
for i := 0; i < b.N; i++ {
103+
for b.Loop() {
104104
_ = layout.UnsignedBinary2(testData)
105105
}
106106
}
@@ -110,7 +110,7 @@ func BenchmarkUnsignedBinary4(b *testing.B) {
110110
testData := [4]byte{0xFF, 0x00, 0x00, 0x00}
111111

112112
b.ResetTimer()
113-
for i := 0; i < b.N; i++ {
113+
for b.Loop() {
114114
_ = layout.UnsignedBinary4(testData)
115115
}
116116
}
@@ -121,7 +121,7 @@ func BenchmarkCommentByLine(b *testing.B) {
121121
commentData := []byte(strings.Repeat("A", 64) + strings.Repeat("B", 64) + strings.Repeat("C", 48))
122122

123123
b.ResetTimer()
124-
for i := 0; i < b.N; i++ {
124+
for b.Loop() {
125125
_ = layout.CommentByLine(commentData)
126126
}
127127
}
@@ -135,7 +135,7 @@ func BenchmarkCommentByLineLarge(b *testing.B) {
135135
}
136136

137137
b.ResetTimer()
138-
for i := 0; i < b.N; i++ {
138+
for b.Loop() {
139139
_ = layout.CommentByLine(commentData)
140140
}
141141
}
@@ -146,7 +146,7 @@ func BenchmarkCommentByBreak(b *testing.B) {
146146
commentData := []byte("Line 1\nLine 2\nLine 3\nLine 4\nLine 5")
147147

148148
b.ResetTimer()
149-
for i := 0; i < b.N; i++ {
149+
for b.Loop() {
150150
_ = layout.CommentByBreak(commentData)
151151
}
152152
}
@@ -162,7 +162,7 @@ func BenchmarkJSON(b *testing.B) {
162162
rec := sauce.Decode(raw)
163163

164164
b.ResetTimer()
165-
for i := 0; i < b.N; i++ {
165+
for b.Loop() {
166166
_, _ = rec.JSON()
167167
}
168168
}
@@ -176,7 +176,7 @@ func BenchmarkJSONIndent(b *testing.B) {
176176
rec := sauce.Decode(raw)
177177

178178
b.ResetTimer()
179-
for i := 0; i < b.N; i++ {
179+
for b.Loop() {
180180
_, _ = rec.JSONIndent(" ")
181181
}
182182
}
@@ -190,7 +190,7 @@ func BenchmarkXML(b *testing.B) {
190190
rec := sauce.Decode(raw)
191191

192192
b.ResetTimer()
193-
for i := 0; i < b.N; i++ {
193+
for b.Loop() {
194194
_, _ = rec.XML()
195195
}
196196
}
@@ -204,7 +204,7 @@ func BenchmarkXMLIndent(b *testing.B) {
204204
rec := sauce.Decode(raw)
205205

206206
b.ResetTimer()
207-
for i := 0; i < b.N; i++ {
207+
for b.Loop() {
208208
_, _ = rec.XMLIndent(" ")
209209
}
210210
}
@@ -219,7 +219,7 @@ func BenchmarkContains(b *testing.B) {
219219
}
220220

221221
b.ResetTimer()
222-
for i := 0; i < b.N; i++ {
222+
for b.Loop() {
223223
_ = sauce.Contains(raw)
224224
}
225225
}

0 commit comments

Comments
 (0)