heptagon/test/good/current.ept
Gwenal Delaval 87f359a6fd Added main to several tests
Added main to tests
Added dependency statics -> statics2 in scripts
2012-07-17 17:57:04 +02:00

43 lines
843 B
Text

node current (c : bool; x : int on c) returns ( y : int )
let
y = merge c (true -> x) (false -> 0 fby y whenot c)
tel
node internal_current (c : bool; x : int on c) returns ( y : int on c)
var x_cur : int;
let
x_cur = merge c (true -> x) (false -> 0 fby x_cur whenot c);
y = x_cur when c
tel
node use_current (c : bool; x : int) returns (b : bool on c; y : int on c)
var x_cur, y2 :int;
let
x_cur = current(c,x);
y = x_cur when c;
y2 = internal_current(c,x);
b = y = y2;
tel
node prod() returns (y:int;b:bool)
var x,y':int;c,b':bool;
let
x = 0 fby x + 1;
c = (x % 10) = 0;
(b',y') = use_current(c,x when c);
y = current(c,y');
b = merge c b' (true fby b whenot c);
tel
(* CHECK check *)
node check() returns (b:bool)
var y:int;
let
(y,b) = prod()
tel
node main() returns (y:int;b:bool)
let
(y,b) = prod()
tel