Skip to content
Snippets Groups Projects
Commit 20efdcce authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Some more test cases.

parent b81cda3c
No related branches found
No related tags found
No related merge requests found
Showing
with 389 additions and 426 deletions
......@@ -1710,7 +1710,7 @@ functions.
\kwd{package} pack
\kwd{uses} pack1, pack2;
\kwd{provides}
\kwd{type} pi,e:real;
\kwd{const} pi,e:real;
\kwd{type} t1,t2;
\kwd{function} cos(x:real) returns (y:real);
\kwd{node} rising\_edge(x:bool) returns (re:bool);
......
......@@ -62,18 +62,27 @@ SOURCES = \
./main.ml
endif
# Be sure to build those files before doing something else
# since they are needed by $(RESULT)
PRE_TARGETS=./version.ml
MLONLY_SOURCES=$(filter %.ml %.mll %.mly, $(SOURCES))
all:
make bc
##############################################################################"
# searching for untested code
test/ocamlprof.dump: pbc test
test/ocamlprof.dump: pbc
prof: test/ocamlprof.dump
make test || true
mkdir prof || rm prof/*
for d in ${SOURCES}; do \
ocamlprof -F "ocamlprof: " -f test/ocamlprof.dump $$d > prof/$$d ;\
done
grep:
# Upsate the test coverage rate
coverage:
rm test/ocamlprof.dump || true
make clean
make prof
......@@ -83,14 +92,13 @@ grep:
ALL_HITS=`wc -l all.grep | cut -f 1 -d " "`;\
SOL=`echo "scale=2 ; $$DEAD_HITS * 100 / $$ALL_HITS " | bc ` ;\
echo "$$DEAD_HITS / $$ALL_HITS = $$SOL %" > untested_line_counter
make clean
cat untested_line_counter
##############################################################################"
all: version.ml
make bc
# for using the debugger
debug: version.ml
debug:
mkdir -p mli
mv *.mli mli/
make MLONLY=yes SOURCES="$(MLONLY_SOURCES)" dc || true
......
*** questions externes
======================
* quid de la syntaxe des horloges enumérées ? la syntaxe de Marc a un
pb : quand j'ecris "type bla = enum {Titi,Toto}" puis "c when
Toto(x)", il rale car il ne connait pas le noeud Toto...
-> faire comme dans lic : ne pas accepter toutes les expressions
apres un when.
* dans le generateur de lic, comment imprimer le nom des packages ?
- Pack::toto -> pas du vieux lustre (donc pas reentrant)
......@@ -14,13 +9,51 @@
- _Pack__toto -> pas beau, rend lus2lic pas idempotent
* instanciation de package <<locaux>> à d'autre package interdite
pour l'instant, alors que ca marchait chez Youssef.
* Les noeuds en parametres de noeuds, ca n'a pas l'air de marcher terrible,
terrible...
* apropos d'intanciation, j'autorise "is" et "="
* instanciation de modele
*** pour etre coherent, on devrait plutot ecrire
mypack = mymodel<<mytype, mynode, myconst>>
*** instanciation de modele <<locaux>> à d'autre package interdite
pour l'instant, alors que ca marchait chez Youssef. Ce serait pratique
tout de meme.
Car si je veux utiliser definir un package parametré par un noeud n,
je suis obligé de définir n dans un package à part.
*** par ailleur j'autorise "is" et "="
package Pint = m1( int );
mais j'ai bien envie de virer "is".
*** quand on a defini un model iter, qui exporte un noeud map2,
en necessissant un type, une constant, et un noued, ce serait bien
de pouvoir ecrire directement un truc du genre
t12 = iter<<3, int, +>>::map2(t1, t2);
voire même
t12 = iter::map2<<3, int, +>>(t1, t2);
au lieu de :
package p = iter(3, int, +);
t12 = p::map2(t1, t2);
Autre solution : utiliser un passage par nom des parametres de models
Remarque : a t'on vraiment besoin du mot clef "model" ?
un package avec un champ needs fait office naturellement de
package paramétré.
En fait, je trouve le terme de "model" tres surchargé.
«
* j'ai defini ">" et consort comme étant polymorphes (et pas
seulement surchargées), parce que c'est facile en caml (via
Pervasive.compare). Mais est-ce une bonne idée ?
......@@ -86,6 +119,10 @@ J'ai associ
moment où on accepte les noeuds multi-horloges. De même, la " -> "
devrait être multi-horloge également. Et peut-etre d'autres encore...
* soc = synchronous object component, c'est pas mieux comme nom ?
* Avec Marc, on pourrait aussi se synchroniser au niveau du lic.
Mais du coup de travail de JB part à la poubelle...
*********************************************************************
*********************************************************************
......@@ -135,6 +172,10 @@ n'est pas le cas pour l'instant... cf [solve_ident]
*********************************************************************
*** a faire
* Ne pas générer de "current", "->", "pre" (i.e., les traduire en
termes de "merge" et "fby").
*** facile
----------
......
This diff is collapsed.
......@@ -57,6 +57,7 @@ open ParserUtils
%token <Lxm.t> TK_LET
%token <Lxm.t> TK_LT
%token <Lxm.t> TK_LTE
%token <Lxm.t> TK_MERGE
%token <Lxm.t> TK_MINUS
%token <Lxm.t> TK_MOD
%token <Lxm.t> TK_NEQ
......
type trival = enum { Pile, Face, Tranche }; ---
node merge_node(clk: trival; ---
i1 when Pile(clk); i2 when Face(clk);
i3 when Tranche(clk))
returns (y: int); ---
let
y = merge clk
(Pile: i1)
(Face: i2)
(Tranche: i3);
tel
\ No newline at end of file
-- A node parametrized by a node
node toto_n<<node f(a, b: int) returns (x: int);const n : int>>(a: int)
returns (x: int^n);
var v : int;
let
v = f(a, 1);
x = v ^ n;
tel
node toto_3 = toto_n<<Lustre::iplus, 3>>;
\ No newline at end of file
node consensus<<const n : int>>(T: bool^n)
returns (a: bool);
let
a = with (n = 1)
then T[0]
else T[0] and consensus << n-1 >> (T[1 .. n-1]);
tel
node main = consensus<<8>>;
\ No newline at end of file
type complex = struct {
re : real = 0.;
im : real = 0.
}; ---
node plus (a, b : complex) returns (c : complex);
let
c = complex { re = a.re+b.re ; im = a.im+b.im };
tel
type Toto = struct {
x : int = 1;
y : int = 2
};
};
node bibi (dummy : int) returns (z : Toto);
let
......
package complex -- uses trigo, math, ... ;
provides
type t; -- Encapsulation
const i:t;
function re(c: t) returns (r:real); ---
body
type t = struct { re : real ; im : real };
const i:t = t { re = 0. ; im = 1. };
function re(c: t) returns (re:real);
let re = c.re; tel;
end
\ No newline at end of file
model iter
needs
const size: t;
type t;
node n(x,y:t) returns (z:t);
provides
node map2(x, y: t^size) returns (z:t^size);
body
node map2(x, y: t^size) returns (z:t^size);
let
z = map<<n, size>>(x, y);
tel
end
package p = iter(3, int, +);
package p = iter(3, int, Lustre::iplus);
package main uses p;
provides
node main (t1, t2: int^3) returns (t12: int^3);
body
node main (t1, t2: int^3) returns (t12: int^3);
let
t12 = p::map2(t1, t2);
tel
end
-- Ce serait de pouvoir crire directement :
-- iter<<3, int, +>>::map2(t1, t2);
--
-- voire
--
-- iter::map2<<3, int, +>>(t1, t2);
\ No newline at end of file
model modSimple
needs type t;
provides
node fby1(init, fb: t) returns (next: t);
body
node fby1(init, fb: t) returns (next: t);
let next = init -> pre fb; tel
end
package pint is modSimple(int);
......@@ -4,16 +4,14 @@
-- * fournit : un noeud
----------------------------
model modSimple
needs
type t;
needs type t;
provides
node fby1(init, fb: t) returns (next: t);
body
node fby1(init, fb: t) returns (next: t);
let
next = init -> pre fb;
tel
node fby1(init, fb: t) returns (next: t);
let
next = init -> pre fb;
tel
end
-----------------------
......
model iter
needs
const size: t;
type t;
node n(x,y:t) returns (z:t);
provides
node map2(x, y: t^size) returns (z:t^size);
body
node map2(x, y: t^size) returns (z:t^size);
let
z = map<<n, size>>(x, y);
tel
end
-- generates a type 'o' ! Raler ?
-- Dois-je refuser les packages polymorphes ?
package p = iter(3, int, +);
\ No newline at end of file
......@@ -3062,6 +3062,13 @@ tel
-- end of node long_et_stupide_nom_de_noeud::long_et_stupide_nom_de_noeud
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/merge.lus
Opening file should_work/NONREG/merge.lus
*** Error in file "should_work/NONREG/merge.lus", line 3, col 7 to 10, token 'when':
*** syntax error
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/minmax1.lus
Opening file should_work/NONREG/minmax1.lus
......@@ -7208,6 +7215,13 @@ tel
-- end of node cst::cst
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/param_node.lus
Opening file should_work/NONREG/param_node.lus
*** Error in file "should_work/NONREG/param_node.lus", line 8, col 7 to 7, token 'f':
*** unknown node (f)
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/patrick.lus
Opening file should_work/NONREG/patrick.lus
......@@ -7820,6 +7834,130 @@ type A_bool_6 = bool^6;
type A_bool_10 = bool^10;
type A_bool_3 = bool^3;
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/Pascal/consensus2.lus
Opening file should_work/Pascal/consensus2.lus
node consensus2::consensus_1(T:A_bool_1) returns (a:bool);
var
_v1:bool;
let
a = T[0];
_v1 = T[0];
tel
-- end of node consensus2::consensus_1
node consensus2::consensus_2(T:A_bool_2) returns (a:bool);
var
_v1:bool;
_v2:A_bool_1;
_v3:bool;
_v4:bool;
let
a = T[0] and consensus2::consensus_1(T[1 .. 1]);
_v1 = T[0];
_v2 = T[1 .. 1];
_v3 = consensus2::consensus_1(_v2);
_v4 = _v1 and _v3;
tel
-- end of node consensus2::consensus_2
node consensus2::consensus_3(T:A_bool_3) returns (a:bool);
var
_v1:bool;
_v2:A_bool_2;
_v3:bool;
_v4:bool;
let
a = T[0] and consensus2::consensus_2(T[1 .. 2]);
_v1 = T[0];
_v2 = T[1 .. 2];
_v3 = consensus2::consensus_2(_v2);
_v4 = _v1 and _v3;
tel
-- end of node consensus2::consensus_3
node consensus2::consensus_4(T:A_bool_4) returns (a:bool);
var
_v1:bool;
_v2:A_bool_3;
_v3:bool;
_v4:bool;
let
a = T[0] and consensus2::consensus_3(T[1 .. 3]);
_v1 = T[0];
_v2 = T[1 .. 3];
_v3 = consensus2::consensus_3(_v2);
_v4 = _v1 and _v3;
tel
-- end of node consensus2::consensus_4
node consensus2::consensus_5(T:A_bool_5) returns (a:bool);
var
_v1:bool;
_v2:A_bool_4;
_v3:bool;
_v4:bool;
let
a = T[0] and consensus2::consensus_4(T[1 .. 4]);
_v1 = T[0];
_v2 = T[1 .. 4];
_v3 = consensus2::consensus_4(_v2);
_v4 = _v1 and _v3;
tel
-- end of node consensus2::consensus_5
node consensus2::consensus_6(T:A_bool_6) returns (a:bool);
var
_v1:bool;
_v2:A_bool_5;
_v3:bool;
_v4:bool;
let
a = T[0] and consensus2::consensus_5(T[1 .. 5]);
_v1 = T[0];
_v2 = T[1 .. 5];
_v3 = consensus2::consensus_5(_v2);
_v4 = _v1 and _v3;
tel
-- end of node consensus2::consensus_6
node consensus2::consensus_7(T:A_bool_7) returns (a:bool);
var
_v1:bool;
_v2:A_bool_6;
_v3:bool;
_v4:bool;
let
a = T[0] and consensus2::consensus_6(T[1 .. 6]);
_v1 = T[0];
_v2 = T[1 .. 6];
_v3 = consensus2::consensus_6(_v2);
_v4 = _v1 and _v3;
tel
-- end of node consensus2::consensus_7
node consensus2::consensus_8(T:A_bool_8) returns (a:bool);
var
_v1:bool;
_v2:A_bool_7;
_v3:bool;
_v4:bool;
let
a = T[0] and consensus2::consensus_7(T[1 .. 7]);
_v1 = T[0];
_v2 = T[1 .. 7];
_v3 = consensus2::consensus_7(_v2);
_v4 = _v1 and _v3;
tel
-- end of node consensus2::consensus_8
node consensus2::main(T:A_bool_8) returns (a:bool);
let
a = consensus2::consensus_8(T);
tel
-- end of node consensus2::main
-- automatically defined aliases:
type A_bool_7 = bool^7;
type A_bool_4 = bool^4;
type A_bool_8 = bool^8;
type A_bool_1 = bool^1;
type A_bool_5 = bool^5;
type A_bool_2 = bool^2;
type A_bool_6 = bool^6;
type A_bool_3 = bool^3;
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/Pascal/fby.lus
Opening file should_work/Pascal/fby.lus
......@@ -9445,6 +9583,22 @@ Opening file should_work/Pascal/pfs.lus
*** syntax error
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/Pascal/struct.lus
Opening file should_work/Pascal/struct.lus
type _struct::complex = struct {re : real = 0.000000; im : real = 0.000000};
node struct::plus(
a:_struct::complex;
b:_struct::complex)
returns (
c:_struct::complex);
let
c = _struct::complex{re=a.re + b.re;im=a.im + b.im};
tel
-- end of node struct::plus
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/Pascal/struct0.lus
Opening file should_work/Pascal/struct0.lus
......@@ -17599,6 +17753,14 @@ tel
-- end of node Main::Condact
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/complex.lus
Opening file should_work/packEnvTest/complex.lus
type _complex::t = struct {re : real; im : real};
*** oops: an internal error occurred in file licDump.ml, line 534, column 26
*** when compiling lustre program should_work/packEnvTest/complex.lus
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus
Opening file should_work/packEnvTest/contractForElementSelectionInArray/contractForElementSelectionInArray.lus
......@@ -18134,6 +18296,27 @@ tel
-- automatically defined aliases:
type A_int_10 = int^10;
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/iter.lus
Opening file should_work/packEnvTest/iter.lus
*** Error in file "should_work/packEnvTest/iter.lus", line 16, col 9 to 9, token 'p':
*** package already declared in line:15, col:9 to 9
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/model.lus
Opening file should_work/packEnvTest/model.lus
type _pint::t = int;
node pint::fby1(init:int; fb:int) returns (next:int);
var
_v1:int;
let
next = init -> _v1;
_v1 = pre fb;
tel
-- end of node pint::fby1
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/modelInst.lus
Opening file should_work/packEnvTest/modelInst.lus
......@@ -18322,6 +18505,24 @@ tel
-- end of node main::foo
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/packEnvTest/polymorphic_pack.lus
Opening file should_work/packEnvTest/polymorphic_pack.lus
type _p::t = int;
const p::size = 3;
node p::n(i1:o; i2:o) returns (o:o);
let
o = Lustre::plus(i1, i2);
tel
-- end of node p::n
node p::map2(x:A_int_3; y:A_int_3) returns (z:A_int_3);
let
z = map<<p::n, 3>>(x, y);
tel
-- end of node p::map2
-- automatically defined aliases:
type A_int_3 = int^3;
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/to_sort_out/asservi.lus
Opening file should_work/to_sort_out/asservi.lus
......
402 / 1584 = 25.37 %
389 / 1584 = 24.55 %
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment