Drop the ':' before captures (for xs (x) / for 0..n (i)); the index capture becomes the trailing open range (for xs, 0.. (x, i)). 136 headers across 26 files, mechanical. Five headless tests (banner_layout, hit_test, swipe_commit, swipe_intent, swipe_reshuffle) also gain a direct #import "modules/ui/types.sx" — they named Point/Frame through a transitive import, which bare visibility no longer permits. Gates: sx build --target ios-sim main.sx links; tools/run_tests.sh 23/23.
35 lines
1.8 KiB
Plaintext
35 lines
1.8 KiB
Plaintext
// P10.4 — Cascade-cue selection snapshot: prove the cascade-depth → combo-cue
|
|
// mapping is a PURE, headless clamp. It reuses audio.sx's `cascade_cue_index`
|
|
// (and `cascade_cue_name`) UNCHANGED — the exact functions `play_cascade` calls
|
|
// — so the escalation logic the audio playback path can't gate-cover is covered
|
|
// here with no audio. The mapping clamps depth <= 1 to the first cue (combo1)
|
|
// and depth >= COMBO_CLIPS to the last (combo5), stepping up monotonically in
|
|
// between. The depth→index/name table below is locked by the committed snapshot.
|
|
#import "modules/std.sx";
|
|
#import "audio.sx";
|
|
|
|
main :: () -> s32 {
|
|
print("== cascade cue selection (depth -> combo cue) ==\n");
|
|
|
|
// Walk a representative depth range (0..9) so both clamps and the monotonic
|
|
// middle are visible: depths 0,1 pin to the first cue; depths >= 5 pin to
|
|
// the last; 2,3,4 step up one cue at a time.
|
|
prev : s64 = -1;
|
|
for 0..10 (depth) {
|
|
idx := cascade_cue_index(depth);
|
|
print("depth {} -> idx {} ({})\n", depth, idx, cascade_cue_name(idx));
|
|
// The mapping must never step down as depth grows.
|
|
if idx < prev { print("FAIL: cue index decreased at depth {}\n", depth); return 1; }
|
|
prev = idx;
|
|
}
|
|
|
|
// Explicit clamp boundaries, independent of the loop above.
|
|
if cascade_cue_index(0) != 0 { print("FAIL: depth 0 not clamped to first cue\n"); return 1; }
|
|
if cascade_cue_index(1) != 0 { print("FAIL: depth 1 not clamped to first cue\n"); return 1; }
|
|
if cascade_cue_index(COMBO_CLIPS) != COMBO_CLIPS - 1 { print("FAIL: depth COMBO_CLIPS not at last cue\n"); return 1; }
|
|
if cascade_cue_index(9) != COMBO_CLIPS - 1 { print("FAIL: deep cascade not clamped to last cue\n"); return 1; }
|
|
|
|
print("ok: cascade cue mapping clamps into combo1..combo{}\n", COMBO_CLIPS);
|
|
return 0;
|
|
}
|