2024-03-05 16:47:02 +00:00
|
|
|
package color_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"git.akyoto.dev/go/color"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkRGB(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
color.RGB(1.0, 1.0, 1.0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-05 23:18:51 +00:00
|
|
|
func BenchmarkLCH(b *testing.B) {
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
color.LCH(0.5, 0.5, 0.0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-11 21:08:28 +00:00
|
|
|
func BenchmarkFprint(b *testing.B) {
|
2024-03-05 23:18:51 +00:00
|
|
|
color.Terminal = true
|
|
|
|
c := color.RGB(1.0, 1.0, 1.0)
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
c.Fprint(io.Discard, "")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkFprintRaw(b *testing.B) {
|
|
|
|
color.Terminal = false
|
2024-03-05 16:47:02 +00:00
|
|
|
c := color.RGB(1.0, 1.0, 1.0)
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
c.Fprint(io.Discard, "")
|
|
|
|
}
|
|
|
|
}
|
2024-03-11 21:08:28 +00:00
|
|
|
|
|
|
|
func BenchmarkPrint(b *testing.B) {
|
|
|
|
color.Terminal = true
|
|
|
|
c := color.RGB(1.0, 1.0, 1.0)
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
c.Print("")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkPrintRaw(b *testing.B) {
|
|
|
|
color.Terminal = false
|
|
|
|
c := color.RGB(1.0, 1.0, 1.0)
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
c.Print("")
|
|
|
|
}
|
|
|
|
}
|