|
|
|
@ -60,58 +60,58 @@ proc test_integer_literals_accepted {} {
|
|
|
|
|
|
|
|
|
|
# Test various decimal values.
|
|
|
|
|
|
|
|
|
|
test_print_accept "p 123" "123"
|
|
|
|
|
test_print_accept "p -123" "-123"
|
|
|
|
|
test_print_accept "p D'123" "123"
|
|
|
|
|
test_print_accept "p d'123" "123"
|
|
|
|
|
test_print_accept "p -D'123" "-123"
|
|
|
|
|
test_print_accept "p -d'123" "-123"
|
|
|
|
|
test_print_accept "p 123_456" "123456"
|
|
|
|
|
test_print_accept "p __1_2_3__" "123"
|
|
|
|
|
test_print_accept "p/d 123" "D'123"
|
|
|
|
|
gdb_test "p 123" " = 123"
|
|
|
|
|
gdb_test "p -123" " = -123"
|
|
|
|
|
gdb_test "p D'123" " = 123"
|
|
|
|
|
gdb_test "p d'123" " = 123"
|
|
|
|
|
gdb_test "p -D'123" " = -123"
|
|
|
|
|
gdb_test "p -d'123" " = -123"
|
|
|
|
|
gdb_test "p 123_456" " = 123456"
|
|
|
|
|
gdb_test "p __1_2_3__" " = 123"
|
|
|
|
|
gdb_test "p/d 123" " = D'123"
|
|
|
|
|
|
|
|
|
|
# Test various binary values.
|
|
|
|
|
|
|
|
|
|
test_print_accept "p B'111" "7"
|
|
|
|
|
test_print_accept "p b'111" "7"
|
|
|
|
|
test_print_accept "p -B'111" "-7"
|
|
|
|
|
test_print_accept "p B'0111" "7"
|
|
|
|
|
test_print_accept "p b'0111" "7"
|
|
|
|
|
test_print_accept "p -b'0111" "-7"
|
|
|
|
|
test_print_accept "p B'_0_1_1_1_" "7"
|
|
|
|
|
test_print_accept "p b'_0_1_1_1_" "7"
|
|
|
|
|
test_print_accept "p -b'_0_1_1_1_" "-7"
|
|
|
|
|
test_print_accept "p/t B'111" "B'111"
|
|
|
|
|
gdb_test "p B'111" " = 7"
|
|
|
|
|
gdb_test "p b'111" " = 7"
|
|
|
|
|
gdb_test "p -B'111" " = -7"
|
|
|
|
|
gdb_test "p B'0111" " = 7"
|
|
|
|
|
gdb_test "p b'0111" " = 7"
|
|
|
|
|
gdb_test "p -b'0111" " = -7"
|
|
|
|
|
gdb_test "p B'_0_1_1_1_" " = 7"
|
|
|
|
|
gdb_test "p b'_0_1_1_1_" " = 7"
|
|
|
|
|
gdb_test "p -b'_0_1_1_1_" " = -7"
|
|
|
|
|
gdb_test "p/t B'111" " = B'111"
|
|
|
|
|
|
|
|
|
|
# Test various octal values.
|
|
|
|
|
|
|
|
|
|
test_print_accept "p O'123" "83"
|
|
|
|
|
test_print_accept "p o'123" "83"
|
|
|
|
|
test_print_accept "p -o'0123" "-83"
|
|
|
|
|
test_print_accept "p O'0123" "83"
|
|
|
|
|
test_print_accept "p o'0123" "83"
|
|
|
|
|
test_print_accept "p -o'123" "-83"
|
|
|
|
|
test_print_accept "p O'_1_2_3_" "83"
|
|
|
|
|
test_print_accept "p o'_1_2_3_" "83"
|
|
|
|
|
test_print_accept "p -o'_1_2_3_" "-83"
|
|
|
|
|
test_print_accept "p/o O'123" "O'123"
|
|
|
|
|
gdb_test "p O'123" " = 83"
|
|
|
|
|
gdb_test "p o'123" " = 83"
|
|
|
|
|
gdb_test "p -o'0123" " = -83"
|
|
|
|
|
gdb_test "p O'0123" " = 83"
|
|
|
|
|
gdb_test "p o'0123" " = 83"
|
|
|
|
|
gdb_test "p -o'123" " = -83"
|
|
|
|
|
gdb_test "p O'_1_2_3_" " = 83"
|
|
|
|
|
gdb_test "p o'_1_2_3_" " = 83"
|
|
|
|
|
gdb_test "p -o'_1_2_3_" " = -83"
|
|
|
|
|
gdb_test "p/o O'123" " = O'123"
|
|
|
|
|
|
|
|
|
|
# Test various hexadecimal values.
|
|
|
|
|
|
|
|
|
|
test_print_accept "p H'123" "291"
|
|
|
|
|
test_print_accept "p h'123" "291"
|
|
|
|
|
test_print_accept "p -h'123" "-291"
|
|
|
|
|
test_print_accept "p H'0123" "291"
|
|
|
|
|
test_print_accept "p h'0123" "291"
|
|
|
|
|
test_print_accept "p -h'0123" "-291"
|
|
|
|
|
test_print_accept "p H'_1_2_3_" "291"
|
|
|
|
|
test_print_accept "p h'_1_2_3_" "291"
|
|
|
|
|
test_print_accept "p -h'_1_2_3_" "-291"
|
|
|
|
|
test_print_accept "p H'ABCDEF" "11259375"
|
|
|
|
|
test_print_accept "p H'abcdef" "11259375"
|
|
|
|
|
test_print_accept "p H'AbCdEf" "11259375"
|
|
|
|
|
test_print_accept "p H'_A_b_C_d_E_f_" "11259375"
|
|
|
|
|
test_print_accept "p/x H'123" "H'123"
|
|
|
|
|
gdb_test "p H'123" " = 291"
|
|
|
|
|
gdb_test "p h'123" " = 291"
|
|
|
|
|
gdb_test "p -h'123" " = -291"
|
|
|
|
|
gdb_test "p H'0123" " = 291"
|
|
|
|
|
gdb_test "p h'0123" " = 291"
|
|
|
|
|
gdb_test "p -h'0123" " = -291"
|
|
|
|
|
gdb_test "p H'_1_2_3_" " = 291"
|
|
|
|
|
gdb_test "p h'_1_2_3_" " = 291"
|
|
|
|
|
gdb_test "p -h'_1_2_3_" " = -291"
|
|
|
|
|
gdb_test "p H'ABCDEF" " = 11259375"
|
|
|
|
|
gdb_test "p H'abcdef" " = 11259375"
|
|
|
|
|
gdb_test "p H'AbCdEf" " = 11259375"
|
|
|
|
|
gdb_test "p H'_A_b_C_d_E_f_" " = 11259375"
|
|
|
|
|
gdb_test "p/x H'123" " = H'123"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc test_character_literals_accepted {} {
|
|
|
|
@ -119,16 +119,16 @@ proc test_character_literals_accepted {} {
|
|
|
|
|
|
|
|
|
|
# Test various decimal values.
|
|
|
|
|
|
|
|
|
|
test_print_accept "p 'a'" "'a'"
|
|
|
|
|
test_print_accept "p/x 'a'" "H'61"
|
|
|
|
|
test_print_accept "p/d 'a'" "D'97"
|
|
|
|
|
test_print_accept "p/t 'a'" "B'1100001"
|
|
|
|
|
# test_print_accept "p '^(97)'" "'a'" (not in GNU Chill)
|
|
|
|
|
test_print_accept "p C'61'" "'a'"
|
|
|
|
|
test_print_accept "p c'61'" "'a'"
|
|
|
|
|
test_print_accept "p/x C'FF'" "H'ff"
|
|
|
|
|
# test_print_accept "p/x '^(H'FF)'" "H'ff" (not in GNU Chill)
|
|
|
|
|
# test_print_accept "p/x '^(D'255)'" "H'ff" (not in GNU Chill)
|
|
|
|
|
gdb_test "p 'a'" " = 'a'"
|
|
|
|
|
gdb_test "p/x 'a'" " = H'61"
|
|
|
|
|
gdb_test "p/d 'a'" " = D'97"
|
|
|
|
|
gdb_test "p/t 'a'" " = B'1100001"
|
|
|
|
|
# gdb_test "p '^(97)'" " = 'a'" (not in GNU Chill)
|
|
|
|
|
gdb_test "p C'61'" " = 'a'"
|
|
|
|
|
gdb_test "p c'61'" " = 'a'"
|
|
|
|
|
gdb_test "p/x C'FF'" " = H'ff"
|
|
|
|
|
# gdb_test "p/x '^(H'FF)'" " = H'ff" (not in GNU Chill)
|
|
|
|
|
# gdb_test "p/x '^(D'255)'" " = H'ff" (not in GNU Chill)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc test_integer_literals_rejected {} {
|
|
|
|
@ -181,8 +181,8 @@ proc test_boolean_literals_accepted {} {
|
|
|
|
|
|
|
|
|
|
# Test the only possible values for a boolean, TRUE and FALSE.
|
|
|
|
|
|
|
|
|
|
test_print_accept "p TRUE" "TRUE"
|
|
|
|
|
test_print_accept "p FALSE" "FALSE"
|
|
|
|
|
gdb_test "p TRUE" " = TRUE"
|
|
|
|
|
gdb_test "p FALSE" " = FALSE"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc test_float_literals_accepted {} {
|
|
|
|
@ -190,59 +190,59 @@ proc test_float_literals_accepted {} {
|
|
|
|
|
|
|
|
|
|
# Test various floating point formats
|
|
|
|
|
|
|
|
|
|
test_print_accept "p .44 < .45" "1"
|
|
|
|
|
test_print_accept "p .44 > .45" "0"
|
|
|
|
|
test_print_accept "p 0.44 < 0.45" "1"
|
|
|
|
|
test_print_accept "p 0.44 > 0.45" "0"
|
|
|
|
|
test_print_accept "p 44. < 45." "1"
|
|
|
|
|
test_print_accept "p 44. > 45." "0"
|
|
|
|
|
test_print_accept "p 44.0 < 45.0" "1"
|
|
|
|
|
test_print_accept "p 44.0 > 45.0" "0"
|
|
|
|
|
test_print_accept "p 10D20 < 10D21" "1"
|
|
|
|
|
test_print_accept "p 10D20 > 10D21" "0"
|
|
|
|
|
test_print_accept "p 10d20 < 10d21" "1"
|
|
|
|
|
test_print_accept "p 10d20 > 10d21" "0"
|
|
|
|
|
test_print_accept "p 10E20 < 10E21" "1"
|
|
|
|
|
test_print_accept "p 10E20 > 10E21" "0"
|
|
|
|
|
test_print_accept "p 10e20 < 10e21" "1"
|
|
|
|
|
test_print_accept "p 10e20 > 10e21" "0"
|
|
|
|
|
test_print_accept "p 10.D20 < 10.D21" "1"
|
|
|
|
|
test_print_accept "p 10.D20 > 10.D21" "0"
|
|
|
|
|
test_print_accept "p 10.d20 < 10.d21" "1"
|
|
|
|
|
test_print_accept "p 10.d20 > 10.d21" "0"
|
|
|
|
|
test_print_accept "p 10.E20 < 10.E21" "1"
|
|
|
|
|
test_print_accept "p 10.E20 > 10.E21" "0"
|
|
|
|
|
test_print_accept "p 10.e20 < 10.e21" "1"
|
|
|
|
|
test_print_accept "p 10.e20 > 10.e21" "0"
|
|
|
|
|
test_print_accept "p 10.0D20 < 10.0D21" "1"
|
|
|
|
|
test_print_accept "p 10.0D20 > 10.0D21" "0"
|
|
|
|
|
test_print_accept "p 10.0d20 < 10.0d21" "1"
|
|
|
|
|
test_print_accept "p 10.0d20 > 10.0d21" "0"
|
|
|
|
|
test_print_accept "p 10.0E20 < 10.0E21" "1"
|
|
|
|
|
test_print_accept "p 10.0E20 > 10.0E21" "0"
|
|
|
|
|
test_print_accept "p 10.0e20 < 10.0e21" "1"
|
|
|
|
|
test_print_accept "p 10.0e20 > 10.0e21" "0"
|
|
|
|
|
test_print_accept "p 10.0D+20 < 10.0D+21" "1"
|
|
|
|
|
test_print_accept "p 10.0D+20 > 10.0D+21" "0"
|
|
|
|
|
test_print_accept "p 10.0d+20 < 10.0d+21" "1"
|
|
|
|
|
test_print_accept "p 10.0d+20 > 10.0d+21" "0"
|
|
|
|
|
test_print_accept "p 10.0E+20 < 10.0E+21" "1"
|
|
|
|
|
test_print_accept "p 10.0E+20 > 10.0E+21" "0"
|
|
|
|
|
test_print_accept "p 10.0e+20 < 10.0e+21" "1"
|
|
|
|
|
test_print_accept "p 10.0e+20 > 10.0e+21" "0"
|
|
|
|
|
test_print_accept "p 10.0D-11 < 10.0D-10" "1"
|
|
|
|
|
test_print_accept "p 10.0D-11 > 10.0D-10" "0"
|
|
|
|
|
test_print_accept "p 10.0d-11 < 10.0d-10" "1"
|
|
|
|
|
test_print_accept "p 10.0d-11 > 10.0d-10" "0"
|
|
|
|
|
test_print_accept "p 10.0E-11 < 10.0E-10" "1"
|
|
|
|
|
test_print_accept "p 10.0E-11 > 10.0E-10" "0"
|
|
|
|
|
test_print_accept "p 10.0e-11 < 10.0e-10" "1"
|
|
|
|
|
test_print_accept "p 10.0e-11 > 10.0e-10" "0"
|
|
|
|
|
gdb_test "p .44 < .45" " = 1"
|
|
|
|
|
gdb_test "p .44 > .45" " = 0"
|
|
|
|
|
gdb_test "p 0.44 < 0.45" " = 1"
|
|
|
|
|
gdb_test "p 0.44 > 0.45" " = 0"
|
|
|
|
|
gdb_test "p 44. < 45." " = 1"
|
|
|
|
|
gdb_test "p 44. > 45." " = 0"
|
|
|
|
|
gdb_test "p 44.0 < 45.0" " = 1"
|
|
|
|
|
gdb_test "p 44.0 > 45.0" " = 0"
|
|
|
|
|
gdb_test "p 10D20 < 10D21" " = 1"
|
|
|
|
|
gdb_test "p 10D20 > 10D21" " = 0"
|
|
|
|
|
gdb_test "p 10d20 < 10d21" " = 1"
|
|
|
|
|
gdb_test "p 10d20 > 10d21" " = 0"
|
|
|
|
|
gdb_test "p 10E20 < 10E21" " = 1"
|
|
|
|
|
gdb_test "p 10E20 > 10E21" " = 0"
|
|
|
|
|
gdb_test "p 10e20 < 10e21" " = 1"
|
|
|
|
|
gdb_test "p 10e20 > 10e21" " = 0"
|
|
|
|
|
gdb_test "p 10.D20 < 10.D21" " = 1"
|
|
|
|
|
gdb_test "p 10.D20 > 10.D21" " = 0"
|
|
|
|
|
gdb_test "p 10.d20 < 10.d21" " = 1"
|
|
|
|
|
gdb_test "p 10.d20 > 10.d21" " = 0"
|
|
|
|
|
gdb_test "p 10.E20 < 10.E21" " = 1"
|
|
|
|
|
gdb_test "p 10.E20 > 10.E21" " = 0"
|
|
|
|
|
gdb_test "p 10.e20 < 10.e21" " = 1"
|
|
|
|
|
gdb_test "p 10.e20 > 10.e21" " = 0"
|
|
|
|
|
gdb_test "p 10.0D20 < 10.0D21" " = 1"
|
|
|
|
|
gdb_test "p 10.0D20 > 10.0D21" " = 0"
|
|
|
|
|
gdb_test "p 10.0d20 < 10.0d21" " = 1"
|
|
|
|
|
gdb_test "p 10.0d20 > 10.0d21" " = 0"
|
|
|
|
|
gdb_test "p 10.0E20 < 10.0E21" " = 1"
|
|
|
|
|
gdb_test "p 10.0E20 > 10.0E21" " = 0"
|
|
|
|
|
gdb_test "p 10.0e20 < 10.0e21" " = 1"
|
|
|
|
|
gdb_test "p 10.0e20 > 10.0e21" " = 0"
|
|
|
|
|
gdb_test "p 10.0D+20 < 10.0D+21" " = 1"
|
|
|
|
|
gdb_test "p 10.0D+20 > 10.0D+21" " = 0"
|
|
|
|
|
gdb_test "p 10.0d+20 < 10.0d+21" " = 1"
|
|
|
|
|
gdb_test "p 10.0d+20 > 10.0d+21" " = 0"
|
|
|
|
|
gdb_test "p 10.0E+20 < 10.0E+21" " = 1"
|
|
|
|
|
gdb_test "p 10.0E+20 > 10.0E+21" " = 0"
|
|
|
|
|
gdb_test "p 10.0e+20 < 10.0e+21" " = 1"
|
|
|
|
|
gdb_test "p 10.0e+20 > 10.0e+21" " = 0"
|
|
|
|
|
gdb_test "p 10.0D-11 < 10.0D-10" " = 1"
|
|
|
|
|
gdb_test "p 10.0D-11 > 10.0D-10" " = 0"
|
|
|
|
|
gdb_test "p 10.0d-11 < 10.0d-10" " = 1"
|
|
|
|
|
gdb_test "p 10.0d-11 > 10.0d-10" " = 0"
|
|
|
|
|
gdb_test "p 10.0E-11 < 10.0E-10" " = 1"
|
|
|
|
|
gdb_test "p 10.0E-11 > 10.0E-10" " = 0"
|
|
|
|
|
gdb_test "p 10.0e-11 < 10.0e-10" " = 1"
|
|
|
|
|
gdb_test "p 10.0e-11 > 10.0e-10" " = 0"
|
|
|
|
|
# looks funny, but apparently legal
|
|
|
|
|
test_print_accept "p _.1e+10 < _.1e+11" "1"
|
|
|
|
|
test_print_accept "p _.1e+10 > _.1e+11" "0"
|
|
|
|
|
test_print_accept "p __.1e-12 < __.1e-11" "1"
|
|
|
|
|
test_print_accept "p __.1e-12 > __.1e-11" "0"
|
|
|
|
|
gdb_test "p _.1e+10 < _.1e+11" " = 1"
|
|
|
|
|
gdb_test "p _.1e+10 > _.1e+11" " = 0"
|
|
|
|
|
gdb_test "p __.1e-12 < __.1e-11" " = 1"
|
|
|
|
|
gdb_test "p __.1e-12 > __.1e-11" " = 0"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
proc test_convenience_variables {} {
|
|
|
|
@ -329,63 +329,63 @@ proc test_arithmetic_expressions {} {
|
|
|
|
|
|
|
|
|
|
# Test unary minus with various operands
|
|
|
|
|
|
|
|
|
|
# test_print_accept "p -(TRUE)" "-1" "unary minus applied to bool"
|
|
|
|
|
# test_print_accept "p -('a')" "xxx" "unary minus applied to char"
|
|
|
|
|
test_print_accept "p -(1)" "-1" "unary minus applied to int"
|
|
|
|
|
test_print_accept "p -(1.0)" "-1" "unary minus applied to real"
|
|
|
|
|
# gdb_test "p -(TRUE)" " = -1" "unary minus applied to bool"
|
|
|
|
|
# gdb_test "p -('a')" " = xxx" "unary minus applied to char"
|
|
|
|
|
gdb_test "p -(1)" " = -1" "unary minus applied to int"
|
|
|
|
|
gdb_test "p -(1.0)" " = -1" "unary minus applied to real"
|
|
|
|
|
|
|
|
|
|
# Test addition with various operands
|
|
|
|
|
|
|
|
|
|
test_print_accept "p TRUE + 1" "2" "bool plus int"
|
|
|
|
|
test_print_accept "p 'a' + 1" "98" "char plus int"
|
|
|
|
|
test_print_accept "p 1 + 1" "2" "int plus int"
|
|
|
|
|
test_print_accept "p 1.0 + 1" "2" "real plus int"
|
|
|
|
|
test_print_accept "p 1.0 + 2.0" "3" "real plus real"
|
|
|
|
|
gdb_test "p TRUE + 1" " = 2" "bool plus int"
|
|
|
|
|
gdb_test "p 'a' + 1" " = 98" "char plus int"
|
|
|
|
|
gdb_test "p 1 + 1" " = 2" "int plus int"
|
|
|
|
|
gdb_test "p 1.0 + 1" " = 2" "real plus int"
|
|
|
|
|
gdb_test "p 1.0 + 2.0" " = 3" "real plus real"
|
|
|
|
|
|
|
|
|
|
# Test subtraction with various operands
|
|
|
|
|
|
|
|
|
|
test_print_accept "p TRUE - 1" "0" "bool minus int"
|
|
|
|
|
test_print_accept "p 'b' - 1" "97" "char minus int"
|
|
|
|
|
test_print_accept "p 3 - 1" "2" "int minus int"
|
|
|
|
|
test_print_accept "p 3.0 - 1" "2" "real minus int"
|
|
|
|
|
test_print_accept "p 5.0 - 2.0" "3" "real minus real"
|
|
|
|
|
gdb_test "p TRUE - 1" " = 0" "bool minus int"
|
|
|
|
|
gdb_test "p 'b' - 1" " = 97" "char minus int"
|
|
|
|
|
gdb_test "p 3 - 1" " = 2" "int minus int"
|
|
|
|
|
gdb_test "p 3.0 - 1" " = 2" "real minus int"
|
|
|
|
|
gdb_test "p 5.0 - 2.0" " = 3" "real minus real"
|
|
|
|
|
|
|
|
|
|
# Test multiplication with various operands
|
|
|
|
|
|
|
|
|
|
test_print_accept "p TRUE * 1" "1" "bool times int"
|
|
|
|
|
test_print_accept "p 'a' * 2" "194" "char times int"
|
|
|
|
|
test_print_accept "p 2 * 3" "6" "int times int"
|
|
|
|
|
test_print_accept "p 2.0 * 3" "6" "real times int"
|
|
|
|
|
test_print_accept "p 2.0 * 3.0" "6" "real times real"
|
|
|
|
|
gdb_test "p TRUE * 1" " = 1" "bool times int"
|
|
|
|
|
gdb_test "p 'a' * 2" " = 194" "char times int"
|
|
|
|
|
gdb_test "p 2 * 3" " = 6" "int times int"
|
|
|
|
|
gdb_test "p 2.0 * 3" " = 6" "real times int"
|
|
|
|
|
gdb_test "p 2.0 * 3.0" " = 6" "real times real"
|
|
|
|
|
|
|
|
|
|
# Test division with various operands
|
|
|
|
|
|
|
|
|
|
test_print_accept "p TRUE / 1" "1" "bool divided by int"
|
|
|
|
|
test_print_accept "p 'a' / 2" "48" "char divided by int"
|
|
|
|
|
test_print_accept "p 6 / 3" "2" "int divided by int"
|
|
|
|
|
test_print_accept "p 6.0 / 3" "2" "real divided by int"
|
|
|
|
|
test_print_accept "p 6.0 / 3.0" "2" "real divided by real"
|
|
|
|
|
gdb_test "p TRUE / 1" " = 1" "bool divided by int"
|
|
|
|
|
gdb_test "p 'a' / 2" " = 48" "char divided by int"
|
|
|
|
|
gdb_test "p 6 / 3" " = 2" "int divided by int"
|
|
|
|
|
gdb_test "p 6.0 / 3" " = 2" "real divided by int"
|
|
|
|
|
gdb_test "p 6.0 / 3.0" " = 2" "real divided by real"
|
|
|
|
|
|
|
|
|
|
# Test modulo with various operands
|
|
|
|
|
|
|
|
|
|
test_print_accept "p TRUE MOD 1" "0" "bool modulo int"
|
|
|
|
|
test_print_accept "p 'a' MOD 2" "1" "char modulo int"
|
|
|
|
|
test_print_accept "p -5 MOD 3" "1" "negative int modulo int"
|
|
|
|
|
test_print_accept "p 5 MOD 1" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p 5 MOD 2" "1" "int modulo int"
|
|
|
|
|
test_print_accept "p 5 MOD 3" "2" "int modulo int"
|
|
|
|
|
test_print_accept "p 5 MOD 4" "1" "int modulo int"
|
|
|
|
|
test_print_accept "p 5 MOD 5" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p 0 MOD 1" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p 0 MOD 2" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p 0 MOD 3" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p 0 MOD 4" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p -5 MOD 1" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p -5 MOD 2" "1" "int modulo int"
|
|
|
|
|
test_print_accept "p -5 MOD 3" "1" "int modulo int"
|
|
|
|
|
test_print_accept "p -5 MOD 4" "3" "int modulo int"
|
|
|
|
|
test_print_accept "p -5 MOD 5" "0" "int modulo int"
|
|
|
|
|
test_print_accept "p -5 MOD 5" "0" "int modulo int"
|
|
|
|
|
gdb_test "p TRUE MOD 1" " = 0" "bool modulo int"
|
|
|
|
|
gdb_test "p 'a' MOD 2" " = 1" "char modulo int"
|
|
|
|
|
gdb_test "p -5 MOD 3" " = 1" "negative int modulo int"
|
|
|
|
|
gdb_test "p 5 MOD 1" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p 5 MOD 2" " = 1" "int modulo int"
|
|
|
|
|
gdb_test "p 5 MOD 3" " = 2" "int modulo int"
|
|
|
|
|
gdb_test "p 5 MOD 4" " = 1" "int modulo int"
|
|
|
|
|
gdb_test "p 5 MOD 5" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p 0 MOD 1" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p 0 MOD 2" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p 0 MOD 3" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p 0 MOD 4" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p -5 MOD 1" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p -5 MOD 2" " = 1" "int modulo int"
|
|
|
|
|
gdb_test "p -5 MOD 3" " = 1" "int modulo int"
|
|
|
|
|
gdb_test "p -5 MOD 4" " = 3" "int modulo int"
|
|
|
|
|
gdb_test "p -5 MOD 5" " = 0" "int modulo int"
|
|
|
|
|
gdb_test "p -5 MOD 5" " = 0" "int modulo int"
|
|
|
|
|
test_print_reject "p 6.0 MOD 3" \
|
|
|
|
|
"Integer-only operation on floating point number.*"
|
|
|
|
|
test_print_reject "p 6.0 MOD 3.0" \
|
|
|
|
@ -397,29 +397,29 @@ proc test_arithmetic_expressions {} {
|
|
|
|
|
|
|
|
|
|
# Test remainder with various operands
|
|
|
|
|
|
|
|
|
|
test_print_accept "p TRUE REM 1" "0" "bool remainder int"
|
|
|
|
|
test_print_accept "p 'a' REM 2" "1" "char remainder int"
|
|
|
|
|
test_print_accept "p 5 REM 5" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM 4" "1" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM 3" "2" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM 2" "1" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM 1" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM -1" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM -2" "1" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM -3" "2" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM -4" "1" "int remainder int"
|
|
|
|
|
test_print_accept "p 5 REM -5" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM 5" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM 4" "-1" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM 3" "-2" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM 2" "-1" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM 1" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM -1" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM -2" "-1" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM -3" "-2" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM -4" "-1" "int remainder int"
|
|
|
|
|
test_print_accept "p -5 REM -5" "0" "int remainder int"
|
|
|
|
|
test_print_accept "p 6 REM 3" "0" "int remainder int"
|
|
|
|
|
gdb_test "p TRUE REM 1" " = 0" "bool remainder int"
|
|
|
|
|
gdb_test "p 'a' REM 2" " = 1" "char remainder int"
|
|
|
|
|
gdb_test "p 5 REM 5" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM 4" " = 1" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM 3" " = 2" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM 2" " = 1" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM 1" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM -1" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM -2" " = 1" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM -3" " = 2" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM -4" " = 1" "int remainder int"
|
|
|
|
|
gdb_test "p 5 REM -5" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM 5" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM 4" " = -1" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM 3" " = -2" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM 2" " = -1" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM 1" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM -1" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM -2" " = -1" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM -3" " = -2" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM -4" " = -1" "int remainder int"
|
|
|
|
|
gdb_test "p -5 REM -5" " = 0" "int remainder int"
|
|
|
|
|
gdb_test "p 6 REM 3" " = 0" "int remainder int"
|
|
|
|
|
test_print_reject "p 6.0 REM 3" \
|
|
|
|
|
"Integer-only operation on floating point number.*"
|
|
|
|
|
test_print_reject "p 6.0 REM 3.0" \
|
|
|
|
|