Files
rosetta/tests/music/mtm.luau
T

21 lines
948 B
Luau

-- music/mtm tests: generated MultiTracker modules (tools/fixtures/mtm.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 Mtm = require("@rosetta/music/mtm")
local Cases = require("@tests/gen/mtm_cases")
local t = T.suite("mtm")
t:eq(Mtm.name, "mtm", "name")
t:eq(Mtm.category, "music", "category")
t:check(Mtm.caps.decode and not Mtm.caps.encode, "caps")
local mods = S.against(t, Mtm, Cases, { gainDb = 0.5, envErr = 1.0, spectral = 0.95, balance = 0.04, duration = 0.01 }, "xm")
t:check(mods[1] and #mods[1].samples == 5 and mods[1].samples[3].bits == 16, "16-bit sample")
t:check(mods[1] and mods[1].meta.message ~= nil, "message")
t:fuzz("decode", S.fuzzer(Mtm), S.samples(Cases), { mutations = 30 })
t:done()