add import storage and test

This commit is contained in:
adman
2026-04-23 22:36:34 +02:00
parent 841d91b91d
commit bd3139754d
5 changed files with 116 additions and 2 deletions
+51
View File
@@ -1,9 +1,11 @@
package level_test
import (
"fmt"
"testing"
"github.com/admin-else/strom/level"
"github.com/admin-else/strom/util"
)
var possibleBpe = []uint8{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
@@ -133,3 +135,52 @@ func TestResizeElementsPerLong(t *testing.T) {
t.Errorf("ElementsPerLong = %d, want 16 (Resize stores old ElementsPerLong)", s.ElementsPerLong)
}
}
func TestImportData(t *testing.T) {
data := []uint64{
2924043581155788451,
3014291839833165474,
2924008396783439527,
3014291770978157730,
2905993930227668138,
2978157076574191776,
2888296810347582631,
2941952219986869920,
3122589749976320164,
2833795322612367018,
3086525630071259805,
2833830575707083949,
3014115504847927964,
2851845594302469291,
2905958400778123933,
3014291839833162913,
2815745670742620830,
2942057979530264736,
2815745670876841123,
2887944277684467868,
2815745740402934945,
2887944277549201564,
3032094718851891360,
2887908817896552616,
2887944277684469920,
2869788867884569248,
2869894626083422368,
2834183176950988960,
2869894625949204127,
3032376331669946015,
2869894694802636456,
2996136153003671199,
2869929879174992040,
2869894625948941983,
2887944277684735139,
2869894625948941983,
22322953887,
}
n := int32(384 + 1)
bpe := util.BpeByNum(float64(n)) // overworld world height
s, err := level.ImportStorage[int32](data, bpe, util.SliceRange(0, n), level.ChunkColumns, nil)
if err != nil {
t.Fatal(err)
}
fmt.Println(s.RealValues())
}