struct column and chunk, and optimization

This commit is contained in:
Tnze
2019-08-03 18:02:18 +08:00
parent 2db368fe4a
commit 1073099cbd
10 changed files with 212 additions and 58 deletions

View File

@ -22,7 +22,7 @@ func TestIn(t *testing.T) {
}
func TestReadRegion(t *testing.T) {
r, err := OpenRegion("../testdata/region/r.0.-1.mca")
r, err := Open("../testdata/region/r.0.-1.mca")
if err != nil {
t.Fatal(err)
}
@ -77,3 +77,21 @@ func TestFindSpace(t *testing.T) {
}
}
}
func TestCountChunks(t *testing.T) {
r, err := Open("../testdata/region/r.-1.-1.mca")
if err != nil {
t.Fatal(err)
}
defer r.Close()
var count int
for i := 0; i < 32; i++ {
for j := 0; j < 32; j++ {
if r.ExistSector(i, j) {
count++
}
}
}
t.Logf("chunk count: %d", count)
}