tests/model: comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:50:23 -05:00
1 parent 5f7f6005f6
commit fe7566cbba
37 files changed
+72 -440

No files matched your search

+2 -12
View File
@@ -1,8 +1,5 @@
-- model/vox tests: MagicaVoxel files (ephtracy samples, opengametools scene files saved by MagicaVoxel 0.99.x) and
-- synthetic files with every chunk type, against an independent reader (tools/fixtures/vox.py): grids (CRC), palette,
-- the default palette (parsed from the spec text), scene graph world transforms (rotations, mirrors, nesting), layers,
-- materials, notes, cameras, render objects; greedy meshes (MeshOps) against the exposed face count; round trips
-- through the writer; error codes; the fuzz no-throw pass. Fixtures: tools/fixtures/vox.py.
-- model/vox tests: MagicaVoxel and synthetic files against an independent reader; greedy meshes against the exposed face count.
-- Fixtures: tools/fixtures/vox.py.
local T = require("@tests/T")
local Vox = require("@rosetta/model/vox")
local MeshOps = require("@rosetta/ops/MeshOps")
@@ -20,7 +17,6 @@ local function decode(data: any, opts: any?): (any, any)
return Vox.decode(Bytes.reader(b), opts)
end
-- the contract
t:eq(Vox.name, "vox", "name")
t:eq(Vox.category, "model", "category")
t:check(Vox.extensions[1] == "vox" and Vox.caps.decode and Vox.caps.encode, "contract")
@@ -57,7 +53,6 @@ local function countKeys(tbl: any): number
return n
end
-- shape nodes depth first with world matrices (column-major 4x4)
local function shapes(scene: any): { any }
local out = {}
local function walk(i: number, parent: { number })
@@ -121,7 +116,6 @@ local function checkScene(scene: any, c: any, label: string)
end
end
-- area and winding of a greedy mesh
local function meshFacts(prim: any): (number, boolean, number)
local pos, nrm = prim.attributes.POSITION.data, prim.attributes.NORMAL.data
local ind = prim.indices.data
@@ -166,7 +160,6 @@ for _, c in Cases do
totalQuads += tris // 2
totalFaces += m.faces
end
-- round trip through the writer
local out, eerr = Vox.encode(scene)
t:check(out, label .. ": encode: " .. tostring(eerr))
local back, berr = Vox.decode(Bytes.reader(out :: buffer))
@@ -181,7 +174,6 @@ for _, c in Cases do
end
t:note("%d files: grids, palettes, scene graphs and round trips match; greedy: %d quads for %d faces", #Cases, totalQuads, totalFaces)
-- the synthetic scene in detail: names, hidden, layers, animation frames, materials, notes, IMAP, unknown chunks
do
local c
for _, x in Cases do
@@ -246,7 +238,6 @@ do
t:eq(prim.indices.count, 72, "two separate cubes: 12 quads")
end
-- errors
do
local _, e = decode("nope")
t:check(e and e.code == Err.CORRUPT, "junk: " .. tostring(e))
@@ -268,7 +259,6 @@ do
t:check(e7 and e7.code == Err.ARG, "voxelsToPrimitive of junk")
end
-- fuzz
do
local samples = {}
for _, c in Cases do