From d19f9ddb866ac2415cbfe66966897a8efe8ddb63 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 20:53:55 +0800 Subject: test(compiler): add seeded C++ differential tests across seven groups Generate 10000 random records per group plus boundary inputs using a portable SHA-256 stream. Compare native and runner output independently. Co-Authored-By: Claude Fable 5.1 --- tests/ii/calls/program.cps | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/ii/calls/program.cps (limited to 'tests/ii/calls/program.cps') diff --git a/tests/ii/calls/program.cps b/tests/ii/calls/program.cps new file mode 100644 index 0000000..9a79ad6 --- /dev/null +++ b/tests/ii/calls/program.cps @@ -0,0 +1,40 @@ +TYPE Pair + DECLARE X : INTEGER + DECLARE Y : INTEGER +ENDTYPE +TYPE PairPtr = ^Pair +PROCEDURE IgnoreCopy(P : Pair) + P.X <- 999 +ENDPROCEDURE +PROCEDURE Shift(BYREF X : INTEGER, Y : INTEGER) + X <- X + 1 + Y <- Y - 1 +ENDPROCEDURE +FUNCTION Triangle(N : INTEGER) RETURNS INTEGER + IF N = 0 THEN + RETURN 0 + ENDIF + RETURN N + Triangle(N - 1) +ENDFUNCTION +DECLARE Count : INTEGER +DECLARE Index : INTEGER +DECLARE N : INTEGER +DECLARE Value : Pair +DECLARE Saved : Pair +DECLARE P : PairPtr +INPUT Count +FOR Index <- 1 TO Count + INPUT N + DECLARE X : INTEGER + DECLARE Y : INTEGER + INPUT X + INPUT Y + Value.X <- X + Value.Y <- Y + Saved <- Value + CALL IgnoreCopy(Value) + P <- ^Value + P^.X <- P^.X + P^.Y + CALL Shift(X, Y) + OUTPUT Value.X, ":", Saved.X, ":", X, ":", Y, ":", Triangle(N) +NEXT Index -- cgit v1.3.1-4-g156e