Improve and correct IO UI and add tests
This commit is contained in:
4
tests/arrow.node
Normal file
4
tests/arrow.node
Normal file
@@ -0,0 +1,4 @@
|
||||
node main (i: int) returns (o: int);
|
||||
let
|
||||
o = 1 -> 2 -> 3;
|
||||
tel
|
16
tests/counting.node
Normal file
16
tests/counting.node
Normal file
@@ -0,0 +1,16 @@
|
||||
-- count the number of top between two tick
|
||||
node counting (tick:bool; top:bool)
|
||||
returns (o: int);
|
||||
var v, o1: int;
|
||||
let o = if tick then v else 0 -> (pre o) + v;
|
||||
v = if top then 1 else 0
|
||||
tel;
|
||||
|
||||
node main (i: int)
|
||||
returns (o: int);
|
||||
let
|
||||
-- 0 means no `tick` and no `top`
|
||||
-- 1 means `tick`
|
||||
-- 2 means `top`
|
||||
o = counting(i = 1, i = 2)
|
||||
tel;
|
@@ -1,4 +1,4 @@
|
||||
node n2 (i: int) returns (o: bool);
|
||||
node main (i: int) returns (o: bool);
|
||||
let
|
||||
o = pre (true and pre( i = pre(pre(i))));
|
||||
tel
|
15
tests/reset.node
Normal file
15
tests/reset.node
Normal file
@@ -0,0 +1,15 @@
|
||||
-- counter of `top`s until `reset` condition holds
|
||||
node counting (tick: bool) returns (o: int);
|
||||
var v: int;
|
||||
let
|
||||
o = v -> (pre o) + v;
|
||||
v = if tick then 1 else 0
|
||||
tel
|
||||
|
||||
node main (i: int) returns (o: int);
|
||||
let
|
||||
-- 0 means no `top` and no `reset`
|
||||
-- 1 means `top`
|
||||
-- 2 means `reset`
|
||||
o = reset counting(i = 1) every (i = 2);
|
||||
tel
|
14
tests/when_merge.node
Normal file
14
tests/when_merge.node
Normal file
@@ -0,0 +1,14 @@
|
||||
node test (i: int) returns (o: int);
|
||||
var x, y: int;
|
||||
let
|
||||
x = (1 / i) when (i <> 0);
|
||||
y = 0 when (not (i <> 0));
|
||||
o = merge (i <> 0) x y;
|
||||
tel
|
||||
|
||||
node main (i: int) returns (o: int);
|
||||
var garbage: int;
|
||||
let
|
||||
garbage = test(0);
|
||||
o = test(1);
|
||||
tel
|
Reference in New Issue
Block a user