mirror of
https://github.com/Jguer/yay.git
synced 2025-12-27 10:01:53 -05:00
Fixed tests for unified structure
This commit is contained in:
36
print_test.go
Normal file
36
print_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func benchmarkPrintSearch(search string, b *testing.B) {
|
||||
old := os.Stdout
|
||||
_, w, _ := os.Pipe()
|
||||
os.Stdout = w
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
res, _, _ := queryRepo(append([]string{}, search))
|
||||
res.printSearch()
|
||||
}
|
||||
os.Stdout = old
|
||||
}
|
||||
|
||||
func BenchmarkPrintSearchSimpleTopDown(b *testing.B) {
|
||||
config.SortMode = TopDown
|
||||
benchmarkPrintSearch("chromium", b)
|
||||
}
|
||||
func BenchmarkPrintSearchComplexTopDown(b *testing.B) {
|
||||
config.SortMode = TopDown
|
||||
benchmarkPrintSearch("linux", b)
|
||||
}
|
||||
|
||||
func BenchmarkPrintSearchSimpleBottomUp(b *testing.B) {
|
||||
config.SortMode = BottomUp
|
||||
benchmarkPrintSearch("chromium", b)
|
||||
}
|
||||
func BenchmarkPrintSearchComplexBottomUp(b *testing.B) {
|
||||
config.SortMode = BottomUp
|
||||
benchmarkPrintSearch("linux", b)
|
||||
}
|
||||
Reference in New Issue
Block a user