spatial-db/templates_test.go
2023-12-13 23:48:53 -08:00

29 lines
506 B
Go

package main
import (
"errors"
"testing"
"github.com/NickyBoy89/spatial-db/storage"
"github.com/NickyBoy89/spatial-db/world"
)
func readBlockTemplate(
storageServer storage.StorageServer,
b *testing.B,
pointSpread int,
) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
pos := world.RandomBlockPosWithRange(float64(pointSpread))
if _, err := storageServer.ReadBlockAt(pos); err != nil {
if errors.Is(err, storage.ChunkNotFoundError) {
continue
} else {
b.Error(err)
}
}
}
}