diff options
author | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-12 10:42:43 +0200 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-12 10:42:43 +0200 |
commit | cfe9934537d0ddf1a98b32237c06ddf81aed45b1 (patch) | |
tree | ff0e6571702efa335b17f4171b5af3572bea529d /tests/limiter.scade | |
parent | c8e565c22e149e70ae45cbe5b9afda5dd5685f43 (diff) | |
download | scade-analyzer-cfe9934537d0ddf1a98b32237c06ddf81aed45b1.tar.gz scade-analyzer-cfe9934537d0ddf1a98b32237c06ddf81aed45b1.zip |
Add some tests
Diffstat (limited to 'tests/limiter.scade')
-rw-r--r-- | tests/limiter.scade | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/limiter.scade b/tests/limiter.scade new file mode 100644 index 0000000..a611d98 --- /dev/null +++ b/tests/limiter.scade @@ -0,0 +1,21 @@ +const bound: int = 128; + +node limiter(x: int; d: int) returns (probe y: int) + var s, r: int; + let + assume in_bounded: x >= -bound and x <= bound; + guarantee out_bounded: y >= -bound and y <= bound; + s = 0 -> pre y; + r = x - s; + y = if r <= -d then s - d + else if r >= d then s + d + else x; + tel + +node test(i: int) returns(a, b, c: int; exit: bool) + let + exit = i >= 30; + a = (i * 21 + 122) mod (2 * bound) - bound; -- not really random + b = 16; + c = limiter(a, b); + tel |