2024-03-31 21:08:01 +00:00
|
|
|
package markdown_test
|
|
|
|
|
|
|
|
import (
|
2024-04-02 08:44:47 +00:00
|
|
|
"os"
|
2024-03-31 21:08:01 +00:00
|
|
|
"testing"
|
|
|
|
|
2024-04-02 08:44:47 +00:00
|
|
|
"git.akyoto.dev/go/assert"
|
2024-03-31 21:08:01 +00:00
|
|
|
"git.akyoto.dev/go/markdown"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkSmall(b *testing.B) {
|
2024-04-02 08:44:47 +00:00
|
|
|
small, err := os.ReadFile("testdata/small.md")
|
|
|
|
assert.Nil(b, err)
|
|
|
|
input := string(small)
|
|
|
|
|
|
|
|
for range b.N {
|
|
|
|
markdown.Render(input)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkMedium(b *testing.B) {
|
|
|
|
medium, err := os.ReadFile("testdata/medium.md")
|
|
|
|
assert.Nil(b, err)
|
|
|
|
input := string(medium)
|
|
|
|
|
|
|
|
for range b.N {
|
|
|
|
markdown.Render(input)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkLarge(b *testing.B) {
|
|
|
|
small, err := os.ReadFile("testdata/large.md")
|
|
|
|
assert.Nil(b, err)
|
|
|
|
input := string(small)
|
|
|
|
|
2024-03-31 21:08:01 +00:00
|
|
|
for range b.N {
|
2024-04-02 08:44:47 +00:00
|
|
|
markdown.Render(input)
|
2024-03-31 21:08:01 +00:00
|
|
|
}
|
|
|
|
}
|