Files
m3te/tests/fx_combo.sx
swipelab 6f7d2f4db2 lang migration: rename signed integer types sN -> iN
Mechanical sweep of all .sx sources, plan docs, and tests/expected
snapshots for the sx language rename (s8/s16/s32/s64 -> i8/i16/i32/i64).
Verified: tools/run_tests.sh 23/23.

Note: the ios-sim build has 2 pre-existing 'restart' dot-call errors
from the sx opt-in UFCS change (sx a47ea14) — independent of this
rename (present pre-sweep); migrated in the follow-up commit.
2026-06-12 09:36:51 +03:00

58 lines
3.0 KiB
Plaintext

// P11.2 — Combo-emphasis selection snapshot: prove the cascade-depth → combo-
// emphasis mapping is a PURE, headless clamp that steps up in LOCKSTEP with the
// cascade SFX cue. The on-screen combo emphasis (`board_fx.sx`'s `fx_combo_level`,
// which drives the popup size/colour step + the burst depth boost) must use the
// SAME depth→level clamp the audio path uses (`audio.sx`'s `cascade_cue_index`):
// depth <= 1 pins to the floor, depth >= 5 to the ceiling, stepping up
// monotonically between — so a deeper cascade always looks AND sounds more
// escalated. `expect_level` below is exactly the index column locked by
// `tests/expected/cascade_cue.stdout`, so any drift on EITHER side breaks a
// snapshot. (audio.sx isn't imported here: its AudioToolbox `#foreign` symbols
// can't link into the same headless binary as board_fx.sx's GL imports.) The
// derived popup-font table is locked by this test's own committed snapshot.
#import "modules/std.sx";
#import "board_fx.sx";
main :: () -> i32 {
print("== combo emphasis selection (depth -> fx level / popup font) ==\n");
// The cascade-cue index per depth 0..9, copied from cascade_cue.stdout. The
// FX level must equal this entry for entry — the audio/visual lockstep.
expect_level : [10]i64 = .{ 0, 0, 1, 2, 3, 4, 4, 4, 4, 4 };
prev : i64 = -1;
for 0..10 (depth) {
lvl := fx_combo_level(depth);
font := fx_popup_font(depth);
combo := depth > 1;
print("depth {} -> level {} font {} combo {}\n", depth, lvl, font, combo);
if lvl < prev { print("FAIL: fx level decreased at depth {}\n", depth); return 1; }
if lvl != expect_level[depth] {
print("FAIL: fx level {} != cascade cue index {} at depth {}\n",
lvl, expect_level[depth], depth);
return 1;
}
prev = lvl;
}
// Explicit clamp boundaries, independent of the loop above.
if fx_combo_level(0) != 0 { print("FAIL: depth 0 not clamped to floor\n"); return 1; }
if fx_combo_level(1) != 0 { print("FAIL: depth 1 not clamped to floor\n"); return 1; }
if fx_combo_level(5) != FX_COMBO_MAX_LEVEL { print("FAIL: depth 5 not at ceiling\n"); return 1; }
if fx_combo_level(9) != FX_COMBO_MAX_LEVEL { print("FAIL: deep cascade not clamped to ceiling\n"); return 1; }
// A single clear (depth 1) keeps the plain popup font; a combo is strictly
// larger and the font never shrinks as the cascade deepens.
if fx_popup_font(1) != FX_POPUP_FONT { print("FAIL: single-clear popup not plain font\n"); return 1; }
pf : f32 = 0.0;
for 2..10 (depth) {
f := fx_popup_font(depth);
if f <= FX_POPUP_FONT { print("FAIL: combo popup not larger than plain at depth {}\n", depth); return 1; }
if depth > 2 and f < pf { print("FAIL: popup font shrank at depth {}\n", depth); return 1; }
pf = f;
}
print("ok: combo emphasis clamps into level 0..{} in lockstep with the cascade cue\n", FX_COMBO_MAX_LEVEL);
return 0;
}