Some more main in tests

This commit is contained in:
Gwenal Delaval 2012-07-18 16:54:44 +02:00
parent 87f359a6fd
commit 8b7ad28d6b
25 changed files with 170 additions and 9 deletions

View file

@ -15,3 +15,8 @@ node h(x1,x2:int) returns (y:int)
let
y = f(x1) + g(x2)
tel
node main() returns (y:int)
let
y = h(5,7);
tel

View file

@ -10,3 +10,7 @@ let
(z,t) = f(a,b);
tel
node main() returns (z:int;t:bool)
let
(z,t) = g(false fby true, 0 fby 2 fby -3);
tel

View file

@ -17,3 +17,8 @@ let
y = if m > 50 then 1 + m else 42;
res = if true then r else y;
tel
node main() returns (out:int)
let
out = bar()
tel

View file

@ -4,3 +4,8 @@ node foo() returns (res:int)
let
res = if true then 1 else 1;
tel
node main() returns (res:int)
let
res = foo()
tel

View file

@ -7,3 +7,8 @@ node foo() returns (tmt1:int)
tmt2 = 0 fby v_1;
v_1 = tmt1;
tel
node main() returns (t:int)
let
t = foo()
tel

View file

@ -5,3 +5,8 @@ node h(z: bool; x, y: int) returns (o2: int)
o = 0 -> pre o + 2
tel
node main() returns (o:int)
let
o = h(false -> true, 0, 0)
tel

View file

@ -9,3 +9,8 @@ node j(x, v_33: bool) returns (o: int)
until v_33 then I
end
tel
node main() returns (o:int)
let
o = j(true,true)
tel

View file

@ -8,3 +8,22 @@ fun mean<<n: int>> (i: int) returns (m: int)
let
m = substr<<n>> (i^n^n)
tel
fun mean2<<n: int>> (j: int) returns (m: int)
let
m = substr<<n>> (j^n^n)
tel
node main() returns (m1,m2:int)
let
m1 = mean<<5>>(3);
m2 = mean2<<5>>(3)
tel
(* CHECK compare *)
node compare() returns (ok:bool)
var x,y:int;
let
(x,y) = main();
ok = (x = y);
tel

View file

@ -57,10 +57,20 @@ node hh(x,z,m:int) returns (o:int)
do
k = 2;
until (1 = 0) then S2
end;(*
end;
present
| (x = 0) do o = pre o + 2
| (x = 2) do o = 4
default do o = 2
end *) o = 1
| (x = 0) do o = k -> pre o + 2
| (x = 2) do o = z
default do o = 2
end
tel
node main() returns (o1,o2:int)
let
() = h(0);
() = jj();
o1 = if (g(false fby true)) then 1 else 2;
() = hhh();
o2 = hh(0 fby 1 fby 2, 3, o1-2);
tel

View file

@ -33,7 +33,13 @@ node h(x,z,m:int) returns (o:int)
present
| (x = 0) do o = 2 -> pre o + 2
| (x = 2) do o = 4
default do o = 2
default do o = 2
end
tel
node main() returns (o1,o2:int)
let
o1 = if (g(false fby true)) then 1 else 2;
o2 = h(0 fby 1 fby 2, 3, o1-2);
tel

View file

@ -21,3 +21,8 @@ node f(x,z:int) returns (o:int)
end
tel
node main() returns (o:int)
let
o = f(0,0);
tel

View file

@ -22,3 +22,8 @@ node g(x: int) returns (o: int)
end
tel
node main() returns (o1,o2:int)
let
o1 = f();
o2 = g(o1 / 10);
tel

View file

@ -11,3 +11,10 @@ node f(x,z:int) returns (o1:int)
end;
o1 = o;
tel
node main() returns (o:int)
var x:int;
let
o = f(x,x);
x = 2 fby 1 fby 0;
tel

View file

@ -14,3 +14,10 @@ node f(x,z:int) returns (o1,o2:int)
end;
tel
node main() returns (o1,o2:int)
var x,z:int;
let
x = 0 fby 1 fby 2 fby x;
z = 1 fby 2 fby z;
(o1,o2) = f(x,z);
tel

View file

@ -12,3 +12,7 @@ node f(x,z1:int) returns (o:int)
m = r + 2
tel
node main() returns (o:int)
let
o = f(0,0);
tel

View file

@ -22,3 +22,8 @@ node f(x: t1; z1:t2) returns (o:t2)
r = (m.z).x;
tel
node main() returns (o1:t1;o2:t2)
let
o1 = h({ x = 1; y = 2 });
o2 = f(o1, { z = o1; u = 3 });
tel

View file

@ -9,3 +9,11 @@ node f(x,z:int) returns (o1,o2:int)
| false do (o2, o1) = (3, 3);
end
tel
node main() returns (o1,o2:int)
var x,z:int;
let
x = 0 fby 1 fby 2 fby x;
z = 1 fby 2 fby z;
(o1,o2) = f(x,z);
tel

View file

@ -20,3 +20,9 @@ node main() returns (y:int)
let
y = updown2();
tel
(* CHECK lessthan12 *)
node lessthan12() returns (ok:bool)
let
ok = main() < 12
tel

View file

@ -28,3 +28,10 @@ let
until (x = 5) then A
end
tel
node main() returns (y:int)
var x:int;
let
x = 0 fby if x = 7 then 0 else x + 1;
y = f(x);
tel

View file

@ -11,6 +11,11 @@ let
end
tel
node main() returns (o:bool)
let
o = f(true, true)
tel
(*
node clock_on<<pref, per : int>>(w1, w2 : bool) returns (o : bool)

View file

@ -4,3 +4,10 @@ let
o = merge c (true -> (0 fby x) when c) (false -> 0 fby (o whenot c));
every true
tel
node main() returns (o:int)
var half:bool;
let
half = false fby not half;
o = f(half,5);
tel

View file

@ -7,4 +7,9 @@ tel
fun h(a,b:int) returns (u,v:int)
let
(u,v) = f(f(a,b));
tel
tel
node main() returns (u,v:int)
let
(u,v) = h((1,2))
tel

View file

@ -19,4 +19,9 @@ var x : matrice;
let
x = a;
o = map<<n>> g (x);
tel
tel
node main() returns (o:matrice)
let
o = h(3^n^n)
tel

View file

@ -6,4 +6,11 @@ let
state Up
do o = true until on_off then Down
end;
tel
tel
node main() returns (o:bool)
var half:bool;
let
o = updown(half);
half = true fby not half
tel

View file

@ -24,3 +24,12 @@ node fusion(x1:int; x2:int; c:t) returns (y :int)
let
y = merge c (A -> x1) (B -> x2)
tel
node main() returns (y,c':int)
var c:t;x:int;
let
x = 1 fby if x > 10 then 1 else x + 2;
c = A fby B fby c;
y = fusion(filter(x,c),-4,c);
c' = bool2int(t2bool(c));
tel