-# Copyright 1992-2013 Free Software Foundation, Inc.
+# Copyright 1992-2022 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
standard_testfile .cc
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
if { [llength $args] % 2 } {
warning "an even # of arguments should be passed to test_expr"
}
- set last_ent [expr [llength $args] - 1];
- set testname [lindex $args $last_ent];
- if [gdb_test_no_output [lindex $args 0] "$testname (setup)"] {
- gdb_suppress_tests;
- }
+ set last_ent [expr [llength $args] - 1]
+ set testname [lindex $args $last_ent]
+ gdb_test_no_output [lindex $args 0] "$testname (setup)"
+
for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
- if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname ([lindex $args $x])"] {
- gdb_suppress_tests;
- }
+ gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname ([lindex $args $x])"
}
- gdb_stop_suppressing_tests;
}
proc do_tests {} {
"set a bool array elem"
# bool constants
-gdb_test "print true" "\\$\[0-9\]* = true" "print true"
-gdb_test "print false" "\\$\[0-9\]* = false" "print false"
+gdb_test "print true" "\\$\[0-9\]* = true"
+gdb_test "print false" "\\$\[0-9\]* = false"
# arithmetic conversions
gdb_test "print 1 + true" "\\$\[0-9\]* = 2" "1 + true"
gdb_test "print 'misc.cc'::v_bool" " = true" \
"expression using block qualifier"
+
+# pointer arithmetic
+gdb_test "print *(v_bool_array + number_ref)" "\\$\[0-9\]* = false" \
+ "pointer addition with integer reference"
+gdb_test "print *(number_ref + v_bool_array)" "\\$\[0-9\]* = false" \
+ "integer reference addition with pointer"
+gdb_test "print *(v_bool_array - number_ref)" "\\$\[0-9\]* = false" \
+ "pointer subtraction with integer reference"