diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 05:27:14 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 05:27:14 +0000 |
| commit | e782898e420c7f2abd83b97c160194d0e70598dd (patch) | |
| tree | f1d95ee7b2766ac2f443df0cb6d5ba419085649e /tests | |
| parent | 42c1649264153940de143741337c38042c32e60b (diff) | |
feat(calls): support standalone calls and void pointer casts
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i/function-call-statements/case.json | 1 | ||||
| -rw-r--r-- | tests/i/function-call-statements/expected.txt | 6 | ||||
| -rw-r--r-- | tests/i/function-call-statements/notes.md | 5 | ||||
| -rw-r--r-- | tests/i/function-call-statements/program.cps | 36 |
4 files changed, 48 insertions, 0 deletions
diff --git a/tests/i/function-call-statements/case.json b/tests/i/function-call-statements/case.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/tests/i/function-call-statements/case.json @@ -0,0 +1 @@ +{} diff --git a/tests/i/function-call-statements/expected.txt b/tests/i/function-call-statements/expected.txt new file mode 100644 index 0000000..d2576ac --- /dev/null +++ b/tests/i/function-call-statements/expected.txt @@ -0,0 +1,6 @@ +17 +23 +7 +19 +[Fatal] line 33: Division by zero +caught diff --git a/tests/i/function-call-statements/notes.md b/tests/i/function-call-statements/notes.md new file mode 100644 index 0000000..c7e0c0a --- /dev/null +++ b/tests/i/function-call-statements/notes.md @@ -0,0 +1,5 @@ +# Trace notes + +Human review: pending. + +This case exercises compiler extensions. Pointer casts preserve the addresses of INTEGER 17 and C int 23. Echo prints 7 even when its result is discarded. Discarded LENGTH calls print nothing. Two BYREF procedure calls increment 17 to 19. The argument division on line 33 throws before Echo runs; CATCH prints caught. diff --git a/tests/i/function-call-statements/program.cps b/tests/i/function-call-statements/program.cps new file mode 100644 index 0000000..403414b --- /dev/null +++ b/tests/i/function-call-statements/program.cps @@ -0,0 +1,36 @@ +TYPE Raw = C_TYPE("void*") +TYPE NativePointer = C_TYPE("int*") +TYPE IntPointer = ^INTEGER +DECLARE Number : INTEGER +DECLARE Pointer : IntPointer +DECLARE Address : Raw +DECLARE Native : C_INT +DECLARE NativeAddress : NativePointer +Number <- 17 +Pointer <- ^Number +Address <- (Raw)Pointer +Pointer <- (IntPointer)Address +OUTPUT Pointer^ +Native <- (C_INT)23 +NativeAddress <- ^Native +Address <- (Raw)NativeAddress +NativeAddress <- (NativePointer)Address +OUTPUT NativeAddress^ +FUNCTION Echo(Value : INTEGER) RETURNS INTEGER + OUTPUT Value + RETURN Value +ENDFUNCTION +Echo(7) +LENGTH("discard") +CALL LENGTH("also discard") +PROCEDURE Change(BYREF Value : INTEGER) + Value <- Value + 1 +ENDPROCEDURE +Change(Number) +CALL Change(Number) +OUTPUT Number +TRY + Echo(1 DIV 0) +CATCH + OUTPUT "caught" +ENDTRY |
