Skip to content

Commit f372d4c

Browse files
committed
Benchmark colorizing function
1 parent 4768f04 commit f372d4c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

assert/colors_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package assert
2+
3+
import "testing"
4+
5+
func BenchmarkColored(b *testing.B) {
6+
b.Run("benchMarkingString", func(b *testing.B) {
7+
for i := 0; i < b.N; i++ {
8+
greenColored("helloWorld")
9+
}
10+
})
11+
b.Run("benchMarkingStruct", func(b *testing.B) {
12+
s := struct {
13+
a int
14+
b string
15+
}{3, "helloWorld"}
16+
for i := 0; i < b.N; i++ {
17+
greenColored(s)
18+
}
19+
})
20+
}

0 commit comments

Comments
 (0)