tests/audio: comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:51:26 -05:00
1 parent 75ddfb4068
commit 0eec255bfb
30 files changed
+66 -244

No files matched your search

+3 -9
View File
@@ -1,8 +1,5 @@
-- Shared checks of the lossless audio format tests (wavpack, ape, tta): every fixture opened, decoded bit-exact
-- against the reference decoder's samples (readInt for integer streams, the f32 bytes for float ones), f32 scaling
-- and output reuse, seeking to sample-accurate positions, reading past the end, tags, sniff. A fixture is a table
-- { name, data, rate, channels, bits, float, frames, crc, tags?, partial? } (partial: a cut file whose decode stops
-- with an error; the reference decoded its first `frames` frames).
-- Shared checks of the lossless audio format tests (wavpack, ape, tta): bit-exact against the reference decoder.
-- partial: a cut file whose decode stops with an error; the reference decoded its first `frames` frames.
local T = require("@tests/T")
local Bytes = require("@rosetta/core/Bytes")
local Crc32 = require("@rosetta/core/Crc32")
@@ -20,7 +17,6 @@ local function open(mod: any, b: any, opts: any?): (any, any)
end
L.open = open
-- all(dec, fx) -> crc of every sample read (i32 for integer streams, f32 bytes for floats), frames, the values
function L.all(dec: any, fx: any): (number, number, { number })
local ch = dec.channels
local vals = table.create(fx.frames * ch, 0)
@@ -52,7 +48,6 @@ function L.all(dec: any, fx: any): (number, number, { number })
return crc, n, vals
end
-- cases(t, mod, cases, optsOf?) -> seeks checked: the per-fixture checks; optsOf(fx) gives the open options
function L.cases(t: any, mod: any, cases: { any }, optsOf: ((any) -> any)?): number
local seekChecks = 0
for _, fx in cases do
@@ -73,7 +68,6 @@ function L.cases(t: any, mod: any, cases: { any }, optsOf: ((any) -> any)?): num
end
t:eq(n, fx.frames, name .. ": decoded frames")
t:eq(crc, fx.crc, name .. ": samples identical to the reference decoder")
-- f32 scaling, output reuse
local ch = dec.channels
dec:seek(0)
local reuse = buffer.create(100 * ch * 4)
@@ -120,7 +114,7 @@ function L.cases(t: any, mod: any, cases: { any }, optsOf: ((any) -> any)?): num
return seekChecks
end
-- subrange(t, mod, fx, depth) : decode() from a Reader over a sub-range equals read(); meta.source
-- decode() from a Reader over a sub-range equals read()
function L.subrange(t: any, mod: any, fx: any, format: string)
local name = fx.name
local big = buffer.create(#fx.data + 13)