tests/codecs (a-m): comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:50:19 -05:00
1 parent a80299dce0
commit 5f7f6005f6
24 files changed
+46 -181

No files matched your search

+2 -10
View File
@@ -1,7 +1,5 @@
-- codecs/compress/Brotli tests: every fixture stream (reference encoder: qualities 0..11, windows 10..24, text / font / generic
-- modes, large windows) decodes to its corpus; consumedEnd; offsets inside a bigger buffer; the static dictionary;
-- hand-made streams (empty, metadata, uncompressed); maxBytes; truncated / corrupted / random input returns nil, Err
-- and never throws. Fixtures: tools/fixtures/brotli.py.
-- codecs/compress/Brotli tests: reference encoder streams (qualities 0..11, windows 10..24), hand-made streams.
-- Fixtures: tools/fixtures/brotli.py.
local T = require("@tests/T")
local Brotli = require("@rosetta/codecs/compress/Brotli")
local Err = require("@rosetta/core/Err")
@@ -10,14 +8,12 @@ local Fx = require("@tests/gen/brotli")
local t = T.suite("brotli")
-- the static dictionary
do
local d = Brotli.dictionary()
t:check(d and buffer.len(d) == 122784, "dictionary size")
t:eq(buffer.readstring(d :: buffer, 0, 8), "timedown", "dictionary starts with the length-4 words")
end
-- every case
local nbytes = 0
for _, c in Fx.cases do
local want = Fx.corpora[c.corpus]
@@ -31,7 +27,6 @@ for _, c in Fx.cases do
end
t:note("%d fixture streams, %.1f MB decoded", #Fx.cases, nbytes / 1e6)
-- at an offset inside a bigger buffer, with trailing bytes
do
local c = Fx.cases[30]
local big = buffer.create(#c.data + 13)
@@ -41,7 +36,6 @@ do
t:check(out and buffer.tostring(out) == Fx.corpora[c.corpus] and e == 5 + #c.data, "at an offset")
end
-- hand-made streams
do
local bytes = T.bytes
-- WBITS 16 (bit 0), ISLAST, ISLASTEMPTY: 0b110 = 6
@@ -72,7 +66,6 @@ do
t:check(ok and r1 == nil and r2.code == Err.ARG, "a non-buffer argument returns Err.ARG")
end
-- maxBytes
do
local c
for _, x in Fx.cases do
@@ -110,7 +103,6 @@ do
t:eq(bad, 0, "corrupted streams never decode to the original")
end
-- truncation, corruption and garbage never throw
do
local samples = {}
for i, c in Fx.cases do