diff options
Diffstat (limited to 'tests/source/Overflows.scade')
-rw-r--r-- | tests/source/Overflows.scade | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/source/Overflows.scade b/tests/source/Overflows.scade new file mode 100644 index 0000000..e9c3107 --- /dev/null +++ b/tests/source/Overflows.scade @@ -0,0 +1,43 @@ +-- Root node: Top + +node BasicCount(reset : bool) returns (n : real) + n = CountToMax(reset, 3.0); + +node CountToMax(Reset : bool; Max : 'T) returns (N : 'T) where 'T numeric +var _L5 : 'T; +let + _L5 = fby (N; 8; (0: 'T)); + N = if Reset or Max < _L5 then (0: 'T) else (1: 'T) + _L5; +tel + +node CountToMaxNoReset(Max : 'T) returns (N : 'T) where 'T numeric +var _L5 : 'T; +let + _L5 = (0: 'T) -> pre N; + N = if Max < _L5 then (0: 'T) else (1: 'T) + _L5; +tel + +node Top(Input1 : int; Input2 : real; Input3 : bool) + returns (Output1 : int; + Output2 : real; + int_count, int_count1 : int; + real_count, real_count1 : real) +let + automaton SM1 + initial state State2 + unless + if Input3 restart State2; + var next : int; + let + next = if 100 < int_count1 then 0 else int_count1 + 1; + int_count1 = 0 -> pre next; + tel + + returns int_count1; + + real_count1 = (restart CountToMaxNoReset every Input3)(1000.); + int_count = CountToMax(Input3, 1000); + real_count = CountToMax(Input3, 1000.0); + Output2 = Input2 * 1.0e100; + Output1 = Input1 * 10000; +tel |