Add some test cases for overflow detection on +- ops

This commit is contained in:
jmc 2001-05-05 19:21:40 +00:00
parent 18c5f91b0b
commit 1f64ac01a4

View File

@ -11,6 +11,13 @@ function test_expr {
# These will get eval'd so escape any meta characters # These will get eval'd so escape any meta characters
# Test overflow cases
test_expr '4611686018427387904 + 4611686018427387903' '9223372036854775807'
test_expr '4611686018427387904 + 4611686018427387904' "expr: integer overflow or underflow occurred for operation '4611686018427387904 + 4611686018427387904'"
test_expr '4611686018427387904 - -4611686018427387904' "expr: integer overflow or underflow occurred for operation '4611686018427387904 - -4611686018427387904'"
test_expr '-4611686018427387904 - 4611686018427387903' '-9223372036854775807'
test_expr '-4611686018427387904 - 4611686018427387905' "expr: integer overflow or underflow occurred for operation '-4611686018427387904 - 4611686018427387905'"
# Test from gtk-- configure that cause problems on old expr # Test from gtk-- configure that cause problems on old expr
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 5' '1' test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 5' '1'
test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 6' '0' test_expr '3 \> 3 \| 3 = 3 \& 4 \> 4 \| 3 = 3 \& 4 = 4 \& 5 \>= 6' '0'