From fe1f02402bfa34f92fb622cd06922abe1eb0b2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9onard=20G=C3=A9rard?= Date: Tue, 29 Nov 2011 14:23:53 +0100 Subject: [PATCH] Test to watch sampling of returned stateful exps. --- compiler/minils/mls_utils.ml | 2 +- test/async/rapide_lent_a.ept | 2 +- test/good/sampling_stateful_output.ept | 20 ++++++++++++++++++++ test/tt.ept | 17 +++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 test/good/sampling_stateful_output.ept create mode 100644 test/tt.ept diff --git a/compiler/minils/mls_utils.ml b/compiler/minils/mls_utils.ml index e65ba77..1a01a9e 100644 --- a/compiler/minils/mls_utils.ml +++ b/compiler/minils/mls_utils.ml @@ -188,7 +188,7 @@ struct acc end -(* Assumes normal form, all fby are solo rhs *) +(* Assumes normal form, all fby are solo rhs or inside a when *) let node_memory_vars n = let rec eq funs acc ({ eq_lhs = pat; eq_rhs = e } as equ) = match pat, e.e_desc with diff --git a/test/async/rapide_lent_a.ept b/test/async/rapide_lent_a.ept index 76bd479..dd7a4e1 100644 --- a/test/async/rapide_lent_a.ept +++ b/test/async/rapide_lent_a.ept @@ -13,7 +13,7 @@ let cpt = size fby (if big_step then size else cpt - 1); y = merge big_step (true -> 0 -> !(pre (async lent(size)))) - (false -> 0 fby y when false(big_step)); + (false -> 0 fby y when false(big_step)); z = do_stuff(1) - y; tel diff --git a/test/good/sampling_stateful_output.ept b/test/good/sampling_stateful_output.ept new file mode 100644 index 0000000..32366a7 --- /dev/null +++ b/test/good/sampling_stateful_output.ept @@ -0,0 +1,20 @@ +node f(c :bool; x :int) returns (y :int) +let + y = (0 fby x) when c +tel + +node nn(x:int) returns (y:int) +let + y = 0 fby x +tel + +node ff(x:int) returns (y :int) +let + y = x + 1 +tel + +node g(c :bool) returns (y,y2 :int) +let + y = nn(1) when c; + y2 = ff(1) when c +tel \ No newline at end of file diff --git a/test/tt.ept b/test/tt.ept new file mode 100644 index 0000000..b664499 --- /dev/null +++ b/test/tt.ept @@ -0,0 +1,17 @@ +node f(a : int) = (o : int) +var x : int; c : bool; +let + c = true fby false fby c; + x = 0 fby ((merge c a (x whenot c)) + 1); + o = x when c +tel + +node g(a : int) = (o : int) +var x1, x2:int; c1, c2: bool; +let + c1 = true fby false fby c1; + c2 = true fby false fby c2; + x1 = 0 fby ((merge c1 a (x1 whenot c1)) + 1); + x2 = 0 fby ((merge c2 x1 (x2 whenot c2)) + 1); + o = x2 when c2 when c1; +tel \ No newline at end of file