Files
rosetta/tests/music/ptm.luau
T

20 lines
906 B
Luau

-- music/ptm tests: generated PolyTracker modules (tools/fixtures/ptm.py) parsed, rendered through codecs/audio/Tracker
-- and compared with openmpt123's render (loudness envelope, band spectrum, stereo balance, song length), the contract,
-- and the fuzz no-throw pass.
local T = require("@tests/T")
local S = require("@tests/music/_similar")
local Ptm = require("@rosetta/music/ptm")
local Cases = require("@tests/gen/ptm_cases")
local t = T.suite("ptm")
t:eq(Ptm.name, "ptm", "name")
t:eq(Ptm.category, "music", "category")
t:check(Ptm.caps.decode and not Ptm.caps.encode, "caps")
local mods = S.against(t, Ptm, Cases, { gainDb = 0.5, envErr = 1.0, spectral = 0.95, balance = 0.04, duration = 0.01 }, "it")
t:check(mods[1] and mods[1].samples[3].bits == 16 and mods[1].samples[3].loopType == 2, "16-bit ping-pong loop")
t:fuzz("decode", S.fuzzer(Ptm), S.samples(Cases), { mutations = 30 })
t:done()