mirror of
https://github.com/ProgramSnail/pass_strategy_synthesis.git
synced 2026-03-11 18:47:08 +00:00
simplest_model_with_mods: const tests
This commit is contained in:
parent
afb4ccfda4
commit
5b49f139cc
1 changed files with 24 additions and 0 deletions
|
|
@ -351,6 +351,30 @@ struct
|
||||||
|
|
||||||
(* --- *)
|
(* --- *)
|
||||||
|
|
||||||
|
let%expect_test "simple function call with value arg" =
|
||||||
|
try (eval_prog ([([(Const, Value)], [Write 0; Read 0; Write 0])], ([(Mut, Value)], [Write 0; Call (0, [0]) ]));
|
||||||
|
[%expect.unreachable])
|
||||||
|
with Incorrect_const_cast id -> Printf.printf "%i" id;
|
||||||
|
[%expect {| 0 |}]
|
||||||
|
|
||||||
|
let%expect_test "simple function call with ref arg" =
|
||||||
|
try (eval_prog ([([(Const, Ref)], [Write 0; Read 0; Write 0])], ([(Mut, Value)], [Write 0; Call (0, [0]) ]));
|
||||||
|
[%expect.unreachable])
|
||||||
|
with Incorrect_const_cast id -> Printf.printf "%i" id;
|
||||||
|
[%expect {| 0 |}]
|
||||||
|
|
||||||
|
let%expect_test "simple function call with value arg" =
|
||||||
|
eval_prog ([([(Const, Value)], [Read 0])], ([(Mut, Value)], [Write 0; Call (0, [0]) ]));
|
||||||
|
Printf.printf "done!";
|
||||||
|
[%expect {| done! |}]
|
||||||
|
|
||||||
|
let%expect_test "simple function call with ref arg" =
|
||||||
|
eval_prog ([([(Const, Ref)], [Read 0])], ([(Mut, Value)], [Write 0; Call (0, [0]) ]));
|
||||||
|
Printf.printf "done!";
|
||||||
|
[%expect {| done! |}]
|
||||||
|
|
||||||
|
(* --- *)
|
||||||
|
|
||||||
let%expect_test "simple function call with arg, recursive calls" =
|
let%expect_test "simple function call with arg, recursive calls" =
|
||||||
eval_prog ([([(Mut, Value)], [Write 0; Read 0; Write 0; Call (0, [0])])], ([(Mut, Value)], [Write 0; Call (0, [0]) ]));
|
eval_prog ([([(Mut, Value)], [Write 0; Read 0; Write 0; Call (0, [0])])], ([(Mut, Value)], [Write 0; Call (0, [0]) ]));
|
||||||
Printf.printf "done!";
|
Printf.printf "done!";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue