Files
breeze/tests/audio_policy_behavior.zi
T
waozi b5356aaac7 Port Inbe screens, storage, and platform hosts to Ziran
Replace the remaining .kry and C application sources with Ziran modules,
move vendored dependencies to their current pointers, and add Ziran tests for
the ported hosts and policies.
2026-09-27 15:40:52 -03:00

34 lines
1.2 KiB
Ziran

#import, file "../src/app/audio_policy.zi";
#program_export
Answer :: () -> s32 {
if MusicCountFor(-8, 3, 16) != 3 { return 1 }
if MusicCountFor(99, 3, 16) != 19 { return 2 }
tracks: [3]s32 = .{-1, 2, 99}
selection := MusicSelectionFor(99, tracks[:], 3, -1)
if selection.selected != 0 || selection.mask != 2 ||
tracks[0] != -1 || tracks[1] != 2 || tracks[2] != -1 {
return 3
}
other: [3]s32 = .{4, 0, -1}
selection = MusicSelectionFor(4, other[:], 5, -1)
if selection.selected != 4 || selection.mask != 3 ||
other[0] != 4 || other[1] != 0 || other[2] != -1 {
return 4
}
if SoundVolumeFor(-1, 1.25) != 0.0 ||
SoundVolumeFor(80, 1.25) != 1.0 ||
SoundVolumeFor(40, 0.5) < 0.199 ||
SoundVolumeFor(40, 0.5) > 0.201 { return 5 }
if BreathCuePitchFor(20, 10, 30) != 2.0 ||
BreathCuePitchFor(20, 0, 40) != 0.5 ||
BreathCuePitchFor(20, 0, 0) != 1.0 ||
BreathCuePitchFor(0, 0, 0) != 1.0 { return 6 }
if MeterLevelFor(900, 0.2) < 0.899 ||
MeterLevelFor(0, 0.5) < 0.429 ||
MeterLevelFor(0, 0.5) > 0.431 ||
MeterLevelFor(0, 0.005) != 0.0 ||
MeterLevelFor(2000, 0.5) != 1.0 { return 7 }
return 42
}