tests/archive: comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:49:50 -05:00
1 parent 54f53a35f6
commit 96602286f8
33 files changed
+34 -226

No files matched your search

+1 -14
View File
@@ -1,9 +1,4 @@
-- archive/wad tests: a cut-down Freedoom IWAD (tools/fixtures/wad.py) lists its lumps (names, sizes, data CRCs,
-- namespaces, map lumps as "MAP01/THINGS"); every flat, patch, sprite and graphic decodes to the pixels DeuTex
-- extracts (RGBA CRC, offsets); composed wall textures; MAP01 parses to the counts of an independent parse and its
-- Scene's floor area matches Green's theorem over the sectors' sides; a hand-made room with a pillar (exact areas,
-- walls, things on floors), a UDMF stub, duplicate names, a tall patch; the writer round-trips byte for byte;
-- errors; the fuzz pass. Fixtures: tools/fixtures/wad.py.
-- archive/wad tests: a cut-down Freedoom IWAD against DeuTex, map floor areas by Green's theorem (tools/fixtures/wad.py).
local T = require("@tests/T")
local F = require("@rosetta")
local Wad = require("@rosetta/archive/wad")
@@ -22,7 +17,6 @@ t:check(a, "freedoom: " .. tostring(err))
t:eq(F.detect(fd.data), "wad", "F.detect")
t:eq(a.meta.source.type, "IWAD", "IWAD")
-- 1. lumps
do
local lumps = Wad.lumps(a) :: { Wad.Lump }
t:eq(#lumps, #fd.lumps, "lump count")
@@ -46,7 +40,6 @@ do
t:eq(#Wad.maps(a), 1, "one map")
end
-- 2. images against DeuTex
do
local n = 0
for _, w in fd.images do
@@ -74,7 +67,6 @@ do
end
end
-- 3. MAP01
do
local m = Wad.mapData(a, "MAP01") :: any
local r = fd.map
@@ -116,7 +108,6 @@ do
t:check(lean.textures[1].image == nil and lean.textures[1].uri ~= nil, "textures = false")
end
-- 4. the hand-made room
do
local rm = Wad.decode(Bytes.reader(buffer.fromstring(Fx.room.data)))
t:check(rm, "room decodes")
@@ -170,7 +161,6 @@ do
t:check(buffer.tostring(F.save(rm) :: buffer) == Fx.room.data, "room: decode + save is byte-identical")
end
-- 5. writer
do
t:check(buffer.tostring(F.save(a) :: buffer) == fd.data, "freedoom: decode + save is byte-identical")
local p = Wad.new()
@@ -188,7 +178,6 @@ do
t:eq(Wad.lumps(F.load(F.save(zip, nil, { format = "wad" }) :: buffer))[1].name, "X.LMP", "zip -> wad")
end
-- 6. errors
do
local _, e1 = Wad.decode(Bytes.reader(buffer.fromstring(string.sub(fd.data, 1, 100))))
t:check(e1 and e1.code == Err.TRUNCATED, "truncated: " .. tostring(e1))
@@ -200,7 +189,6 @@ do
t:check(e4 and e4.code == Err.ARG, "missing map")
end
-- 7. fuzz: the directory, then the lumps of the room (maps, pictures)
t:fuzz("decode", function(b: buffer)
local w = Wad.decode(Bytes.reader(b))
if w then
@@ -217,7 +205,6 @@ t:fuzz("decode", function(b: buffer)
return w
end, { Fx.room.data }, { mutations = 300 })
do
-- mutate inside the lumps of the real map and pictures (the directory kept intact)
local rand = T.rng(9)
local threw = 0
for i = 1, 60 do