Added main to several tests

Added main to tests
Added dependency statics -> statics2 in scripts
master
Gwenal Delaval 12 years ago
parent 891b1f3ffd
commit 87f359a6fd

@ -69,8 +69,8 @@ ADD_TEST(compile_only_reinit "scripts/compile_only" "good/reinit.ept")
ADD_TEST(compile_only_sampling_stateful_output2 "scripts/compile_only" "good/sampling_stateful_output2.ept")
ADD_TEST(compile_only_sampling_stateful_output "scripts/compile_only" "good/sampling_stateful_output.ept")
ADD_TEST(compile_only_side_effet "scripts/compile_only" "good/side_effet.ept")
ADD_TEST(compile_only_statics2 "scripts/compile_only" "good/statics2.ept")
ADD_TEST(compile_only_statics "scripts/compile_only" "good/statics.ept")
ADD_TEST(compile_only_statics2 "scripts/compile_only" "good/statics2.ept")
ADD_TEST(compile_only_t10 "scripts/compile_only" "good/t10.ept")
ADD_TEST(compile_only_t11 "scripts/compile_only" "good/t11.ept")
ADD_TEST(compile_only_t12 "scripts/compile_only" "good/t12.ept")
@ -140,8 +140,8 @@ ADD_TEST(compile_gcc_run_reinit "scripts/compile_gcc_run" "good/reinit.ept")
ADD_TEST(compile_gcc_run_sampling_stateful_output2 "scripts/compile_gcc_run" "good/sampling_stateful_output2.ept")
ADD_TEST(compile_gcc_run_sampling_stateful_output "scripts/compile_gcc_run" "good/sampling_stateful_output.ept")
ADD_TEST(compile_gcc_run_side_effet "scripts/compile_gcc_run" "good/side_effet.ept")
ADD_TEST(compile_gcc_run_statics2 "scripts/compile_gcc_run" "good/statics2.ept")
ADD_TEST(compile_gcc_run_statics "scripts/compile_gcc_run" "good/statics.ept")
ADD_TEST(compile_gcc_run_statics2 "scripts/compile_gcc_run" "good/statics2.ept")
ADD_TEST(compile_gcc_run_t10 "scripts/compile_gcc_run" "good/t10.ept")
ADD_TEST(compile_gcc_run_t11 "scripts/compile_gcc_run" "good/t11.ept")
ADD_TEST(compile_gcc_run_t12 "scripts/compile_gcc_run" "good/t12.ept")

@ -2,3 +2,10 @@ node counter(res: bool; tick: bool) returns (o: int)
let
o = if res then 0 else if tick then 1 -> pre o + 1 else 0 -> pre o;
tel
node main() returns (y:int)
var half:bool;
let
y = counter(false fby (y > 35), half);
half = true fby not half
tel

@ -19,3 +19,25 @@ let
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

@ -3,4 +3,9 @@ var x:bool;
let
o = x;
x = true fby false fby x;
tel
tel
node main() returns (o:bool)
let
o = f();
tel

@ -2,10 +2,23 @@ const n:int=42
fun f(a:bool; i:int; acc_in : bool) returns (acc_out : bool)
let
acc_out = if i = 0 then false else (a & acc_in);
acc_out = if i = 0 then true else (a & acc_in);
tel
fun for(a:bool; i:int; acc_in : bool) returns (acc_out : bool)
let
acc_out = if i = 0 then false else (a or acc_in);
tel
fun g(a: bool^n) returns (o:bool)
let
o = foldi<<n>> f (a, true);
tel
node main() returns (o1,o2:bool)
var t:bool^n;
let
t = (true^n) fby (false^n) fby ([ true^n with [5]=false ]) fby ([ false^n with [12]=true ]) fby t;
o1 = g(t);
o2 = foldi<<n>> for (t, true);
tel

@ -38,6 +38,24 @@ let
state State4
var l2: bool;
do o1 = false; o2 = false; o3 = l2; o4 = false; l2 = true;
until i4 then State4
until i4 then State1
end
tel
(* clock (0^(n-1)1) *)
node counter <<n:int>>() returns (b:bool)
var c:int;
let
c = 1 fby if b then 1 else c + 1;
b = (c = n);
tel
node main() returns (o1: bool; o2: bool; o3: bool; o4: bool)
var i1: bool; i2: bool; i3: bool; i4: bool;
let
i1 = counter<<7>>();
i2 = counter<<9>>();
i3 = counter<<13>>();
i4 = counter<<17>>();
(o1,o2,o3,o4) = ssm(i1,i2,i3,i4)
tel

@ -18,4 +18,12 @@ tel
fun f3(a,b:int^n) returns (o:int^n)
let
o = map<<n>> (+) (b, map<<n>> inc (a));
tel
tel
node main() returns (o:int^n)
var t1,t2:int^n;
let
t1 = f1 (1^n);
t2 = f2(t1, 2^n);
o = f3(t1,t2);
tel

@ -22,14 +22,37 @@ let
u = a.[i] default 0.0;
v = a.[j] default 0.0;
a1 = [ a with [i] = v ];
o = [ a1 with [j] = v];
o = [ a1 with [j] = u ];
tel
fun plus (a:float;b:float) returns (c:float;d:float)
let
c = a +. b;
d = c;
tel
node shuffle(i_arr, j_arr:int^m; q:int)
returns (v : float)
var t,t_next:float^n at r;
var t,t_next:float^n at r;last t_init:float^n;last d:float;
let
automaton
state Init
do (t_init,d) = mapfold<<n>> plus (1.0^n, 1.0)
until true then Noupdate
state Noupdate
do
end;
t_next = fold<<m>> (swap<<n>>)(i_arr, j_arr, t);
init<<r>> t = (0.0^n) fby t_next;
init<<r>> t = t_init fby t_next;
v = t_next.[q] default 0.0;
tel
tel
node main() returns (v:float)
var c,q:int;i,j:int^m;
let
c = 0 fby if c = n-6 then 0 else c + 1;
i = [c,c+1,c+2];
j = [c+3,c+4,c+5];
v = shuffle(i,j,q);
q = 0 fby if q = n-1 then 0 else q + 1;
tel

@ -2,12 +2,12 @@ const n:int = 100
fun f(a:int^n at r) returns (o:int^n at r)
let
o = [ a with [0] = 0 ]
o = [ a with [0] = 3 ]
tel
fun g(a:int^n at r) returns (o:int^n at r)
let
o = [ a with [n-1] = 0 ]
o = [ a with [n-1] = 10 ]
tel
node autom(a:int^n at r) returns (o:int^n at r; u:int)
@ -15,18 +15,18 @@ let
automaton
state S1
do
o = f(a)
o = g(a)
until true then S2
state S2
do
o = g(a)
o = f(a)
until false then S1
end;
u = a[0]
tel
node autom_last() returns (u:int)
node autom_last() returns (u1,u2:int)
var last o : int^n at r = 0^n;
let
automaton
@ -35,9 +35,16 @@ let
until true then S2
state S2
var u:int;
do
o = g(last o)
(o,u) = autom(last o)
until false then S1
end;
u = o[0]
u1 = o[0];
u2 = o[n-1];
tel
node main() returns (u1,u2:int)
let
(u1,u2) = autom_last()
tel

@ -20,4 +20,10 @@ let
(init<<r>> u, z) = map<<n>> pp(0.0^n);
v = [u with [n-1] = 0.0];
o = v[28]
tel
tel
node main() returns (o1,o2:float)
let
o1 = f();
o2 = g();
tel

@ -8,4 +8,12 @@ let
(u, v) = split c (a);
x = [ u with [0] = 0 ];
o = merge c (On -> x) (Off -> v)
tel
tel
node main() returns (o:int^4)
var c:st;a:int^n at r;
let
o = (f(a,c))[0..3];
c = Off fby Off fby On fby c;
init<<r>> a = 1^n;
tel

@ -22,4 +22,15 @@ var x:int^n at r;
let
init<<r>> x = 1^n;
o = fold<<3>> f2(a, f(f(x)));
tel
tel
fun plus(a,b:int) returns (c:int)
let c = a + b tel
node main() returns (o:int^n)
var o1,o2:int^n;
let
o1 = g();
o2 = lin_fold([13,17,23]);
o = map<<n>> plus(o1,o2);
tel

@ -3,4 +3,11 @@ var last t:int^100 = 1^100;
let
t = merge c ((last t) when c) ([((last t) whenot c) with [0] = 0]);
o = t[0];
tel
tel
node main() returns (o:int)
var c:bool;
let
c = true fby true fby false fby c;
o = f(c);
tel

@ -11,4 +11,9 @@ let
v = [ a.tab with [0] = 0 ];
u = [ v with [10] = 99 ];
o = { a with .tab = u }
tel
tel
node main() returns (o:array)
let
o = f(g({ tab = 1^100; size = 3 }));
tel

@ -7,7 +7,7 @@ let
u = a.[i] default 0.0;
v = a.[j] default 0.0;
a1 = [ a with [i] = v ];
o = [ a1 with [j] = v];
o = [ a1 with [j] = u ];
tel
node shuffle(i_arr, j_arr:int^m; q:int)
@ -41,3 +41,14 @@ let
a1 = (0.0^n) fby [ a1 with [i when true(x)] = 0.0 ];
a2 = (0.0^n) fby [ a2 with [j when false(x)] = 0.0 ];
tel
node main() returns (o1,o2:float^n)
var x:bool;i,j:int;
let
o1 = clocked(x,i,j,1.0^n);
o2 = clocked_reg(x,i,j,1.0^n);
x = true fby true fby false fby x;
i = 0 fby if i >= n then 0 else i + 2;
j = 0 fby if j >= n then 0 else i + 1;
tel

@ -10,3 +10,8 @@ node m0() returns (o: int)
let
o = if true then if true then 1 else 2 else 3;
tel
node main() returns (o:int)
let
o = m0();
tel

@ -15,7 +15,7 @@ tel
node h(a:int^n; b:int^z) returns (o,m:int)
let
o = g<<n>>(a);
m = g<<z>>(b);
m = g<<z>>(b) + f(b);
tel
node l<<m:int>>(a:int^m) returns (o:int^m)
@ -28,3 +28,8 @@ let
o = map<<n>> (l<<n>>)(a);
tel
node main() returns(o,m,v:int)
let
(o,m) = h(1^n, 2^z);
v = (p(3^n^n))[11][11]
tel

@ -26,10 +26,17 @@ let
o = a + x;
tel
node main() returns (x,y,z:int)
let
x = f(1 fby if x > 1000 then 1 else x, true);
y = h(1 fby if y > 1000 then 1 else y, true fby false);
z = p(1 fby if z > 1000 then 1 else z, true);
tel
(*
(v1, v2, ...) fby (e1, e2, ...)
---->
(v1 fby e1, v2 fby e2, ...)
*)
*)

@ -6,4 +6,12 @@ var a1, a2:int^n at r;
let
(a1, a2) = split c (a);
o = merge c (true -> reinit (a1, t_0)) (false -> [ a2 with [0] = 0 ])
tel
tel
node main() returns (o:int^n)
var c:bool;a:int^n at r;
let
init<<r>> a = 1^n;
c = true fby false fby c;
o = f(a, c)
tel

@ -17,4 +17,13 @@ node g(c :bool) returns (y,y2 :int)
let
y = nn(1) when c;
y2 = ff(1) when c
tel
tel
node main() returns (y,y2:int)
var y',y'2:int;c:bool;
let
c = false fby false fby true fby c;
(y',y'2) = g(c);
(y,y2) = merge c (y',y'2) (0,0)
tel

@ -17,4 +17,14 @@ var z :int; y:int;
let
z = 3;
y = (0 fby z) when c;
tel
tel
node main() returns (x,y:int)
var c:bool;
let
x = f(0);
c = false fby false fby true fby c;
y = merge c (ff(0,c)) 0;
() = fff(0,c);
tel

@ -1,10 +1,15 @@
node hello() returns (b:bool)
var tmp : bool;
unsafe node hello() returns (b:bool)
let
tmp = (*printf("hello")*) true;
() = Iostream.printf("hello\n");
automaton
state A var ttmp :bool; do
state A do
b = true;
ttmp = (*printf("hello")*) true;
() = Iostream.printf("hello\n");
end;
tel
unsafe node main() returns ()
var b:bool;
let
b = hello();
tel

@ -29,3 +29,7 @@ let
y = c + g<<c>>() + i<<k>>();
tel
node main() returns (y:int)
let
y = h()
tel

@ -30,3 +30,7 @@ let
y2 = c2 + Statics.g<<k2>>() + Statics.i<<k2>>();
tel
node main() returns (y,y2:int)
let
(y,y2) = h()
tel

@ -34,10 +34,10 @@ node m(x: int) returns (o: int)
let
automaton
state I
do o2 = 1
do o2 = 2
unless (last o2 = 2) then J
state J
do o2 = 3
do o2 = 1
unless (last o2 = 1) then I
end;
o = o2;
@ -46,7 +46,7 @@ node m(x: int) returns (o: int)
node h(z: int; x, y: int) returns (o2: int)
var o1, o: int;
let
(o1, o2) = if z<0 then (1, 2) else (3, 4);
(o1, o2) = if z<0 then (1, o) else (o, 4);
o = 0 -> pre o + 2
tel
@ -91,7 +91,7 @@ node (++)(up, down: int) returns (o: int)
until (down = 1) then Down
| (down = 0) then Up
state Down
do cpt = (last cpt) + 1
do cpt = (last cpt) - 1
until (up = 1) then Up
end;
tel
@ -103,6 +103,21 @@ node f(x: bool) returns (y: bool)
z = true -> if y then not (pre z) else pre z;
tel
node main() returns (o1,o2,o3,o4,o5,o6,o7,o8,o9:int)
var x:int;
let
x = -10 fby if x = 10 then -10 else x + 1;
o1 = m0();
o2 = mm(x);
o3 = mmm(0);
o4 = m(0);
o5 = h(x,0,0);
o6 = i(0,x);
o7 = j(0,0);
o8 = (++)((0 fby 1),(0 fby o9));
o9 = if (f(false fby true)) then 13 else 17;
tel
(*
let increasing(x) returns (o)
do true -> x >= pre(x) + 1 done

@ -36,6 +36,19 @@ if [[ ($heptroot == "t2") || ($heptroot == "t2open") ]]; then
LD="$LD ../t1_c/[^_]*.o"
fi
# Special case: statics2 needs statics
if [[ ($heptroot == "statics") ]]; then
coption="$coption -c"
fi
if [[ ($heptroot == "statics2") ]]; then
CC="$CC -I ../statics_c"
LD="$LD ../statics_c/[^_]*.o"
fi
echo $HEPTC $coption $heptprog
if $HEPTC $coption $heptprog; then
pushd ${heptroot}_c > /dev/null

Loading…
Cancel
Save