world: publish decorated region batches

This commit is contained in:
Daniar Mannanov 2026-08-25 03:59:29 +03:00
parent d8b5d0f79b
commit c4be38acdd
10 changed files with 471 additions and 25 deletions

View file

@ -1,6 +1,7 @@
package server
import (
"context"
"errors"
"sync"
"sync/atomic"
@ -128,3 +129,24 @@ func TestServerRejectsNegativeCacheLimit(t *testing.T) {
t.Fatal("negative cache limit was accepted")
}
}
func TestNewUsesProductionBatchGenerator(t *testing.T) {
cfg := DefaultConfig()
cfg.WorldDir = ""
cfg.WorldSeed = 12345
cfg.MaxCachedChunks = 64
srv, err := New(cfg)
if err != nil {
t.Fatal(err)
}
if err := srv.Chunks().PreloadErrContext(context.Background(), 0, 0); err != nil {
t.Fatal(err)
}
for cx := int32(-1); cx <= 1; cx++ {
for cz := int32(-1); cz <= 1; cz++ {
if !srv.Chunks().IsChunkLoaded(cx, cz) {
t.Fatalf("production batch did not publish neighbor (%d,%d)", cx, cz)
}
}
}
}