some more tests

This commit is contained in:
Léonard Gérard 2011-05-23 14:04:11 +02:00
parent fd00f099f5
commit 1d6feeef54
31 changed files with 115 additions and 89 deletions

View file

@ -27,4 +27,4 @@ let
nf = normalized_movie<<100>>(f);
r = mean<<100>>(nf)
tel

View file

@ -13,7 +13,7 @@ let
cpt = size fby (if big_step then size else cpt - 1);
y = merge big_step
(true -> 0 -> (pre (lent(size))))
(false -> 0 fby y when false(big_step));
(false -> 0 fby y when false(big_step));
z = do_stuff(1) - y;
tel

View file

@ -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

View file

@ -9,4 +9,4 @@ let
t = async 0 fby async counter(false,true);
b = counter(false,true) -1 = !t;
tel

View file

@ -9,4 +9,4 @@ let
done;
z = t2
tel

View file

@ -8,7 +8,7 @@ node h(x,z,m:int) returns (o:int)
automaton
state S1
var r:int;
do
do
k = m + 2;
r = k + 3;
w = 1 + 2;

View file

@ -5,9 +5,9 @@ let
automaton
state A
do y = 2
until y = 2 then B
until y = 2 then B
state B
do y = 3
until y = 3 then C
do y = 3
until y = 3 then C
end
tel

View file

@ -7,11 +7,11 @@ let
state B do y = x until y = 2 then A
end;
automaton
state C
do z = y
state C
do z = y
until z = 3 then D
state D
do z = x
state D
do z = x
until z = 4 then A
end
tel

View file

@ -1,20 +1,20 @@
node f(x:int) returns (y,z:int)
let
automaton
state A
state A
do y = x;
z = 4;
z = 4;
until y = 2 then B
state B
state B
do y = x;
automaton
state C
do z = y
until z = 3 then D
state D
do z = x
until z = 4 then A
end
automaton
state C
do z = y
until z = 3 then D
state D
do z = x
until z = 4 then A
end
until y = 2 then A
end;
tel

View file

@ -8,4 +8,4 @@ type t = A | B
node fusion(x1:int on B(c); x2:int; c:t) returns (y :int)
let
y = merge c (A -> x1) (B -> x2)
tel
tel

View file

@ -8,12 +8,12 @@ tel
node sumdup (a, acc_in:int) returns (o:int; acc_out:int)
let
acc_out = acc_in + a;
o = acc_out;
acc_out = acc_in + a;
o = acc_out;
tel
node p(a:int^n) returns (o:int^n)
var acc:int;
let
(o, acc) = mapfold<<n>> sumdup (a, 0);
(o, acc) = mapfold<<n>> sumdup (a, 0);
tel

View file

@ -1,7 +1,7 @@
const n : int = 33
node stopbb(shiftenable : bool) returns (dataout : bool^n)
var last dataint : bool^n; f : bool;
var last dataint : bool^n; f : bool;
let
f = false;
dataout = (f^n) fby dataint;

View file

@ -19,7 +19,7 @@ let
state B
do
until count() = 3 then A
end
end
until count() = 5 then Two
state Two
do c = x;

View file

@ -15,7 +15,7 @@ let
state B
do c = not(x);
until true then A
end
end
until true then Two
state Two
do c = x;

View file

@ -14,4 +14,4 @@ let
done;
z = t;
tel

View file

@ -6,15 +6,15 @@ tel
node f<<n : int>>(i : bool^n) returns (o, b : bool; nat : int)
let
b = fold<<n>> (or) (i, false);
automaton
state Idle
do o = false; nat = 0;
unless b then Emit
state Emit
do o = true;
nat = nat();
until nat > 3 then Idle
unless b then Emit
automaton
state Idle
do o = false; nat = 0;
unless b then Emit
state Emit
do o = true;
nat = nat();
until nat > 3 then Idle
unless b then Emit
end
tel

View file

@ -7,7 +7,7 @@ node main() returns (c : int)
let
automaton
state One
do c = count ()
do c = count ()
until count() = 5 then Two
state Two
do c = count ()

View file

@ -65,14 +65,14 @@ node i(x, y: int) returns (o: int)
node j(x, y: int) returns (o: int)
let
automaton
state I
state I
var z: int;
do o = 1; z = 2
until (o = 2) then J
state J
do o = 2
until (o = 1) then I
end
end
tel
node (++)(up, down: int) returns (o: int)
@ -83,13 +83,13 @@ node (++)(up, down: int) returns (o: int)
state Init
var k : int;
do k = 0 -> pre k + 2;
cpt = 0
until
cpt = 0
until
(up = 1) then Up
state Up
do cpt = last cpt + 1
until (down = 1) then Down
| (down = 0) then Up
| (down = 0) then Up
state Down
do cpt = (last cpt) + 1
until (up = 1) then Up
@ -98,7 +98,7 @@ node (++)(up, down: int) returns (o: int)
node f(x: bool) returns (y: bool)
var z: bool;
let
let
y = x or x & x;
z = true -> if y then not (pre z) else pre z;
tel
@ -117,7 +117,7 @@ modes(v0) =
end
val gain : int >
modes last o : int when up: int -> int when down: int -> int
modes last o : int when up: int -> int when down: int -> int
end with { up # down }
let node gain(v0)(up, down) returns (o)

View file

@ -1,6 +1,6 @@
(* Crashes the pass removing intermediate equations. *)
node foo() returns (res:int)
let
let
res = if true then 1 else 1;
tel

View file

@ -2,7 +2,7 @@
node foo() returns (tmt1:int)
var v_1:int; tmt2:int;
let
let
tmt1 = (1 + tmt2);
tmt2 = 0 fby v_1;
v_1 = tmt1;

View file

@ -49,7 +49,7 @@ node hh(x,z,m:int) returns (o:int)
automaton
state S1
var r:int;
do
do
k = m + 2;
r = k + 3;
w = 1 + 2;
@ -59,7 +59,7 @@ node hh(x,z,m:int) returns (o:int)
state S2
do
k = 2;
until (1 = 0) then S2
until (1 = 0) then S2
end;(*
present
| (x = 0) do o = pre o + 2

View file

@ -18,7 +18,7 @@ node h(x,z,m:int) returns (o:int)
automaton
state S1
var r:int;
do
do
k = m + 2;
r = k + 3;
w = 1 + 2;

View file

@ -6,9 +6,9 @@ node f(x,z:int) returns (o:int)
let
r = false;
automaton
state Init
do o = 1 + 2
until (o = 0) then Two
state Init
do o = 1 + 2
until (o = 0) then Two
state Two do o = 2 + 3 until (o = 1) then Two
end;
automaton

View file

@ -5,12 +5,12 @@ node f(x,z:int) returns (o1,o2:int)
switch (x = z)
| true do
o1 = 0 -> pre o1 + 2;
o2 = o4 + 1;
o4 = 3
o2 = o4 + 1;
o4 = 3
| false do
o1 = 4;
o2 = 5;
o4 = 5
o2 = 5;
o4 = 5
end;
tel

View file

@ -1,15 +1,28 @@
node g() returns (o :int)
node f(x:bool;c:bool) returns (o:bool)
let
o = 0 fby 1
automaton
state A
var l:bool; do
l = x when c;
o = merge c (true -> l) (false -> false)
until true then B
state B
do o = false
end
tel
node f (i:int) returns (o1,o2,o3:int)
(*
node clock_on<<pref, per : int>>(w1, w2 : bool) returns (o : bool)
let
reset
o1 = o2 + g();
every true;
o2 = if true then g() else 0;
o3 = o2 + 4;
automaton
state FirstPeriod
var w2' : bool; do
w2' = w1 when w2;
o = false;
until true then Cruise
state Cruise do
o = true;
end
tel
*)

7
test/good/ttt.ept Normal file
View file

@ -0,0 +1,7 @@
node f(x:int) returns (y:int on ck; ck,ck2:bool)
let
ck = true;
ck2 = true;
y = (x :: ck2)
tel

6
test/good/tttt.ept Normal file
View file

@ -0,0 +1,6 @@
node f(c:bool;x:int) returns (o:int)
let
reset
o = merge c (true -> (0 fby x) when c) (false -> 0 fby (o whenot c));
every true
tel

View file

@ -23,4 +23,4 @@ node filter(x:int; c:t) returns (y:int on A(c))
node fusion(x1:int; x2:int; c:t) returns (y :int)
let
y = merge c (A -> x1) (B -> x2)
tel
tel

View file

@ -1,8 +1,8 @@
(* Deal with matrix of size n*m, apply coeff :
kt
kl k kr
kb
centered on [>i<][>j<]. *)
kt
kl k kr
kb
centered on [>i<][>j<]. *)
fun kernel_1 << n,m,k,kl,kt,kr,kb :int>> (t :int^n^m; i,x,j :int) returns (r :int)
let
r = k*t[>i<][>j<] + kl*t[>i<][>j-1<] + kt*t[>i-1<][>j<] + kr*t[>i<][>j+1<] + kb*t[>i+1<][>j<]
@ -20,19 +20,19 @@ tel
(* Deal with matrix of size n*m, apply coeff :
ktt
klt kt ktr
kll kl k kr krr
kbl kb krb
kbb
centered on [>i<][>j<]. *)
ktt
klt kt ktr
kll kl k kr krr
kbl kb krb
kbb
centered on [>i<][>j<]. *)
fun kernel_2 <<n,m,ktt,klt,kt,ktr,kll,kl,k,kr,krr,kbl,kb,krb,kbb :int>> (t :int^n^m; i,x,j :int) returns (r :int)
let
r = ktt*t[>i-2<][>j<]+
klt*t[>i-1<][>j-1<]+ kt*t[>i-1<][>j<]+ ktr*t[>i-1<][>j+1<]+
kll*t[>i<][>j-2<]+ kl*t[>i<][>j-1<]+ k*t[>i<][>j<]+ kr*t[>i<][>j+1<]+ krr*t[>i<][>j+2<]+
kbl*t[>i+1<][>j-1<]+ kb*t[>i+1<][>j<]+ krb*t[>i+1<][>j+1<]+
kbb*t[>i+2<][>j<];
r = ktt*t[>i-2<][>j<]+
klt*t[>i-1<][>j-1<]+ kt*t[>i-1<][>j<]+ ktr*t[>i-1<][>j+1<]+
kll*t[>i<][>j-2<]+ kl*t[>i<][>j-1<]+ k*t[>i<][>j<]+ kr*t[>i<][>j+1<]+ krr*t[>i<][>j+2<]+
kbl*t[>i+1<][>j-1<]+ kb*t[>i+1<][>j<]+ krb*t[>i+1<][>j+1<]+
kbb*t[>i+2<][>j<];
tel
fun convol_2_h<<n,m,ktt,klt,kt,ktr,kll,kl,k,kr,krr,kbl,kb,krb,kbb :int>> (t:int^n^m; line : int^m; i :int) returns (r :int^m)

View file

@ -7,7 +7,7 @@ fun pip<<n1,m1,n2,m2,x,y :int>> (t1 :int^n1^m1; t2 :int^n2^m2) returns (r :int^n
var t12 :int^m1^n2;
let
t12 = map<<n2>> (pip_line<<m1,m2,y>>) (t1[x..x+n2-1], t2);
r = t1[0 .. x-1] @ t12 @ t1[x+n2 .. n1-1];
r = t1[0 .. x-1] @ t12 @ t1[x+n2 .. n1-1];
tel
node main() returns (r :int^10^10)

View file

@ -1,2 +1,2 @@
#!/bin/sh
find . \! -path "*_build*" -and \( -iname "*.ml" -or -iname "*.mli" -or -iname "*.mly" -or -iname "*.mll" \) -exec perl -pi -e 's/( |\t)+$//gi; s/\t/ /g' {} \;
find . \! -path "*_build*" -and \( -iname "*.ml" -or -iname "*.mli" -or -iname "*.mly" -or -iname "*.mll" -or -iname "*.ept" \) -exec perl -pi -e 's/( |\t)+$//gi; s/\t/ /g' {} \;