Files
ww/test/lang/mixed_scalar_tuple_sret_test.ww
Hojun-Cho 07b3c74ab0 test: migrate Fam8 tuple value tests to @test + reject carriers (#5-C2)
fold-2 chunk C2 (drew's Fam8-13 plan): 14 tuple value-row C drivers migrate to
15 test/lang/*_test.ww @test row-tables (the +1 is 954_tuprecv, slimmed not
deleted -- its value rows split out while the asserttyped-stamp dimension stays
as a carrier-split C pin, mutation-proven non-vacuous). Reject rows move to 32
test/wcc/data/*/case.ww //ww:error carriers (runww asserts the substring in
BOTH stages). The test-lang byte-id (LANGBYTEID) gate gives cs==ww automatically
and is strictly more sensitive than re-running the wwstage leg; floor 59->74.
Tuple surfaced zero cs!=ww as the plan predicted -- no value-only carve. The 945
trio folds in here; 940_global_sret / 940_str_forrange / 926_tagscr untouched
(routed to drew per-file). Test count 402->388 = the 14 retired drivers.
2026-06-24 01:44:13 +09:00

65 lines
1.9 KiB
Plaintext

// mixed_scalar_tuple_sret_test — project #240: an over-cap tuple whose elements
// mix a scalar with slices/str (e.g. `(int, []u8, str)`) must lay out
// identically in both stages and round-trip through an sret return. Migrated
// from test/wcc/940_mixed_scalar_tuple_sret_run.c. Two silent, gate-blind
// cs!=ww divergences: callee SEND packed a leading scalar at the literal's
// (untyped-int, size 0) stride so trailing elements packed 8 bytes low; caller
// RECEIVE had no capacity gate so a 56B over-cap tuple was received via
// registers instead of the sret dest. The @test fns pin the runtime element
// values; T2 byte-id keeps cs==ww (rule 10). Each row covers an annotated and
// an inferred receive and a distinct scalar position.
package mixed_scalar_tuple_sret_test;
fn mk_int_slice_str() (int, []u8, str) = {
let b: []u8; b.len = 5; b.cap = 9;
let s: str = "abcd";
return (42, b, s);
};
fn mk_int_slice_str_inferred() (int, []u8, str) = {
let b: []u8; b.len = 6; b.cap = 8;
let s: str = "xyz";
return (17, b, s);
};
fn mk_slice_str_int() ([]u8, str, int) = {
let b: []u8; b.len = 7; b.cap = 9;
let s: str = "hello";
return (b, s, 99);
};
fn mk_str_int_slice() (str, int, []u8) = {
let s: str = "abcde";
let b: []u8; b.len = 3; b.cap = 4;
return (s, 77, b);
};
@test fn int_slice_str() void = {
let t: (int, []u8, str) = mk_int_slice_str();
assert(!(t.0 != 42));
assert(!(len(t.1) != 5));
assert(!(len(t.2) != 4));
};
@test fn int_slice_str_inferred() void = {
let t = mk_int_slice_str_inferred();
assert(!(t.0 != 17));
assert(!(len(t.1) != 6));
assert(!(len(t.2) != 3));
};
@test fn slice_str_int() void = {
let t: ([]u8, str, int) = mk_slice_str_int();
assert(!(len(t.0) != 7));
assert(!(len(t.1) != 5));
assert(!(t.2 != 99));
};
@test fn str_int_slice() void = {
let t: (str, int, []u8) = mk_str_int_slice();
assert(!(len(t.0) != 5));
assert(!(t.1 != 77));
assert(!(len(t.2) != 3));
};