Make tests/when_merge.node clearer by using reals

This commit is contained in:
Benjamin Loison 2023-01-10 00:07:49 +01:00
parent a5f8c720f4
commit 1297835bda

View File

@ -1,14 +1,13 @@
node test (i: int) returns (o: int);
var x, y: int;
node test (i: real) returns (o: real);
var x, y: real;
let
x = (1 / i) when (i <> 0);
y = 0 when (not (i <> 0));
o = merge (i <> 0) x y;
x = (1.0 / i) when (i <> 0.0);
y = 0.0 when (not (i <> 0.0));
o = merge (i <> 0.0) x y;
tel
node main (i: int) returns (o: int);
var garbage: int;
node main (i: real) returns (o: real);
let
garbage = test(0);
o = test(1);
-- The idea is to pass `0.0` as the input to acknowledge that the division by zero isn't computed.
o = test(i);
tel