tests/containers: comments: specs only
This commit is contained in:
1 parent
53aa9a6ebf
commit
70f50917fa
5 files changed
+8
-46
No files matched your search
@@ -1,9 +1,6 @@
|
||||
-- containers/Ogg tests: real encoder files (opusenc, flac --ogg, ffmpeg vorbis) and hand-made multiplexed files,
|
||||
-- checked packet by packet against the independent Python parser of tools/fixtures/ogg.py; seeking on each; a big
|
||||
-- multiplexed file written with the muxer (bisection seeks); muxer edge cases (lacing at 255 multiples, page breaks,
|
||||
-- continued packets, flush, eos); a sub-range Reader; truncated / garbage input never throws. The muxer was also
|
||||
-- checked by hand against opus-tools: an opusenc file remuxed through it passes opusinfo and decodes identically.
|
||||
-- Ported from ogg-luau tests/ogg.luau. Fixtures: tools/fixtures/ogg.py.
|
||||
-- containers/Ogg tests: encoder and hand-made multiplexed files against the parser in tools/fixtures/ogg.py, the muxer.
|
||||
-- The muxer was checked against opus-tools: an opusenc file remuxed through it passes opusinfo, decodes identically.
|
||||
-- Fixtures: tools/fixtures/ogg.py.
|
||||
local T = require("@tests/T")
|
||||
local Ogg = require("@rosetta/containers/Ogg")
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
@@ -13,7 +10,6 @@ local Cases = require("@tests/gen/ogg_cases")
|
||||
|
||||
local t = T.suite("ogg")
|
||||
|
||||
-- seek expectations from a packet list: { size, crc, granule, bos, eos }
|
||||
local function expectSeek(list: { any }, g: number): (number, number)
|
||||
local start, idx = -1, 1
|
||||
for i, p in list do
|
||||
@@ -77,7 +73,6 @@ for _, fx in Cases do
|
||||
t:eq(counts[i], #fx.streams[i].packets, fx.name .. ": interleaved count")
|
||||
end
|
||||
end
|
||||
-- seeking
|
||||
for _, es in fx.streams do
|
||||
local serial = es.serial
|
||||
local last = es.lastGranule
|
||||
@@ -104,7 +99,6 @@ for _, fx in Cases do
|
||||
end
|
||||
end
|
||||
end
|
||||
-- a Reader over a sub-range of a bigger buffer
|
||||
local big = buffer.create(#fx.data + 20)
|
||||
buffer.writestring(big, 11, fx.data)
|
||||
local ds = Ogg.open(Bytes.reader(big, 11, #fx.data))
|
||||
@@ -221,7 +215,6 @@ do
|
||||
t:check(pages > 70, "edge: page breaks (" .. pages .. " pages)")
|
||||
t:eq(d:stream(42).lastGranule, #sizes * 10, "edge: last granule")
|
||||
t:eq(d:stream(42).codec, "unknown", "edge: codec")
|
||||
-- strings, ranges and bad arguments
|
||||
local m2 = Ogg.muxer()
|
||||
local s2 = m2:stream()
|
||||
t:check(s2:packet("OpusHead" .. string.rep("\0", 11), 0, { flush = true }), "string packet")
|
||||
@@ -237,7 +230,6 @@ do
|
||||
t:check(d2:nextPacket(1) == nil, "empty eos page ends the stream")
|
||||
end
|
||||
|
||||
-- errors and garbage
|
||||
do
|
||||
local _, e1 = Ogg.open(buffer.create(0))
|
||||
t:check(e1 and e1.code == Err.CORRUPT, "empty: " .. tostring(e1))
|
||||
@@ -246,7 +238,6 @@ do
|
||||
t:check(e2 and e2.code == Err.ARG, "not a buffer: " .. tostring(e2))
|
||||
end
|
||||
|
||||
-- fuzz: open + read every packet + seek never throws
|
||||
t:fuzz("open + read + seek", function(b: buffer)
|
||||
local d = Ogg.open(b)
|
||||
if d then
|
||||
|
||||
Reference in new issue
Block a user