summaryrefslogblamecommitdiff
path: root/tests/source/half.scade
blob: 7e0df6086a3f11502eae102a4355167716bb4bd1 (plain) (tree)
1
                                                                      

























                                         
                                                           
   
node test(i: int) returns (probe a, probe b, probe c: int; exit: bool)
var
  la, lb: int;
  half: bool;
let
  exit = i >= 20;

  half = true -> not pre half;

  la = 0 -> pre a;
  lb = 0 -> pre b;
  activate
    if half then
      let
        a = la + 1;
        b = lb;
      tel
    else
      let
        a = la;
        b = lb + 1;
      tel
  returns a, b;

  c = a - b;

  guarantee c_bounded: c >= 0 and c <= 1;
  guarantee link_c_half: if half then (c = 1) else (c = 0);
tel