From 787f6220773d9174a9675dedd3bbfc8f070511a6 Mon Sep 17 00:00:00 2001 From: Bob Manson Date: Wed, 29 Jan 1997 09:40:31 +0000 Subject: Major revision to testsuites for cross-testing and DOS testing support. --- gdb/testsuite/gdb.base/exprs.exp | 2192 ++------------------------------------ 1 file changed, 117 insertions(+), 2075 deletions(-) (limited to 'gdb/testsuite/gdb.base/exprs.exp') diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp index fcf7c2a..b49e6d6 100644 --- a/gdb/testsuite/gdb.base/exprs.exp +++ b/gdb/testsuite/gdb.base/exprs.exp @@ -4,12 +4,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -19,9 +19,9 @@ # This file was written by Rob Savoye. (rob@cygnus.com) -if $tracelevel then { - strace $tracelevel - } +if $tracelevel { + strace $tracelevel +} # # test running programs @@ -30,17 +30,15 @@ set prms_id 0 set bug_id 0 set testfile "exprs" -set srcfile ${srcdir}/$subdir/${testfile}.c +set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [compile "${srcfile} -g -o ${binfile}"] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { perror "Couldn't compile ${srcfile}" return -1 } -execute_anywhere "rm -f ${binfile}.ci" -if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } { - perror "Couldn't make ${testfile}.ci file" - return -1 +if [get_compiler_info ${binfile}] { + return -1; } gdb_exit @@ -48,8 +46,6 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -source ${binfile}.ci - # # set it up at a breakpoint so we can play with the variable values # @@ -59,2118 +55,164 @@ if ![runto_main] then { continue } -# -# test expressions with "char" types -# -send "set variable v_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_char == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_char == 127\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print char ==" } - -re "$prompt $" { fail "print char ==" } - timeout { fail "(timeout) print char ==" } - } - } - -re "$prompt $" { fail "print char ==" } - timeout { fail "(timeout) print char ==" } - } +proc test_expr { args } { + if { [llength $args] % 2 } { + warning "an even # of arguments should be passed to test_expr" } - -re "$prompt $" { fail "print char ==" } - timeout { fail "(timeout) print char ==" } -} - - -send "set variable v_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_char != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_char != 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print char !=" } - -re "$prompt $" { fail "print char !=" } - timeout { fail "(timeout) print char !=" } - } - } - -re "$prompt $" { fail "print char !=" } - timeout { fail "(timeout) print char !=" } - } + set last_ent [expr [llength $args] - 1]; + set testname [lindex $args $last_ent]; + if [gdb_test [lindex $args 0] "" "$testname (setup)"] { + return 1; } - -re "$prompt $" { fail "print char !=" } - timeout { fail "(timeout) print char !=" } -} - - -send "set variable v_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_char < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_char < 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print char <" } - -re "$prompt $" { fail "print char <" } - timeout { fail "(timeout) print char <" } - } - } - -re "$prompt $" { fail "print char <" } - timeout { fail "(timeout) print char <" } - } - } - -re "$prompt $" { fail "print char <" } - timeout { fail "(timeout) print char <" } -} - - -send "set variable v_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_char > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_char > 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print char >" } - -re "$prompt $" { fail "print char >" } - timeout { fail "(timeout) print char >" } - } - } - -re "$prompt $" { fail "print char >" } - timeout { fail "(timeout) print char >" } + for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} { + if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] $testname] { + return 1; } } - -re "$prompt $" { fail "print char >" } - timeout { fail "(timeout) print char >" } } - - +# +# test expressions with "char" types +# +test_expr "set variable v_char=127" "print v_char == 0" "\\$\[0-9\]* = 0" "print v_char == 127" "\\$\[0-9\]* = 1" "print char ==" +test_expr "set variable v_char=127" "print v_char != 0" "\\$\[0-9\]* = 1" "print v_char != 127" "\\$\[0-9\]* = 0" "print char !=" +test_expr "set variable v_char=127" "print v_char < 0" "\\$\[0-9\]* = 0" "print v_char < 127" "\\$\[0-9\]* = 0" "print char <" +test_expr "set variable v_char=127" "print v_char > 0" "\\$\[0-9\]* = 1" "print v_char > 127" "\\$\[0-9\]* = 0" "print char >" # # test expressions with "signed char" types # -send "set variable v_signed_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_char == 127\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed char ==" } - -re "$prompt $" { fail "print signed char ==" } - timeout { fail "(timeout) print signed char ==" } - } - } - -re "$prompt $" { fail "print signed char ==" } - timeout { fail "(timeout) print signed char ==" } - } - } - -re "$prompt $" { fail "print signed char ==" } - timeout { fail "(timeout) print signed char ==" } -} - - -send "set variable v_signed_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_char != 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char !=" } - -re "$prompt $" { fail "print signed char !=" } - timeout { fail "(timeout) print signed char !=" } - } - } - -re "$prompt $" { fail "print signed char !=" } - timeout { fail "(timeout) print signed char !=" } - } - } - -re "$prompt $" { fail "print signed char !=" } - timeout { fail "(timeout) print signed char !=" } -} - - -send "set variable v_signed_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_char < 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char <" } - -re "$prompt $" { fail "print signed char <" } - timeout { fail "(timeout) print signed char <" } - } - } - -re "$prompt $" { fail "print signed char <" } - timeout { fail "(timeout) print signed char <" } - } - } - -re "$prompt $" { fail "print signed char <" } - timeout { fail "(timeout) print signed char <" } -} - - -send "set variable v_signed_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_char > 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char >" } - -re "$prompt $" { fail "print signed char >" } - timeout { fail "(timeout) print signed char >" } - } - } - -re "$prompt $" { fail "print signed char >" } - timeout { fail "(timeout) print signed char >" } - } - } - -re "$prompt $" { fail "print signed char >" } - timeout { fail "(timeout) print signed char >" } -} - - +test_expr "set variable v_signed_char=127" "print v_signed_char == 0" "\\$\[0-9\]* = 0" "print v_signed_char == 127" "\\$\[0-9\]* = 1" "print signed char ==" +test_expr "set variable v_signed_char=127" "print v_signed_char != 0" "\\$\[0-9\]* = 1" "print v_signed_char != 127" "\\$\[0-9\]* = 0" "print signed char !=" +test_expr "set variable v_signed_char=127" "print v_signed_char < 0" "\\$\[0-9\]* = 0" "print v_signed_char < 127" "\\$\[0-9\]* = 0" "print signed char <" +test_expr "set variable v_signed_char=127" "print v_signed_char > 0" "\\$\[0-9\]* = 1" "print v_signed_char > 127" "\\$\[0-9\]* = 0" "print signed char >" # make char a minus -if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" } -send "set variable v_signed_char=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_char == -1\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed char == (minus)" } - -re "$prompt $" { fail "print signed char == (minus)" } - timeout { fail "(timeout) print signed char == (minus)" } - } - } - -re "$prompt $" { fail "print signed char == (minus)" } - timeout { fail "(timeout) print signed char == (minus)" } - } - } - -re "$prompt $" { fail "print signed char == (minus)" } - timeout { fail "(timeout) print signed char == (minus)" } -} - - -if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" } -send "set variable v_signed_char=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_char != -1\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char != (minus)" } - -re "$prompt $" { fail "print signed char != (minus)" } - timeout { fail "(timeout) print signed char != (minus)" } - } - } - -re "$prompt $" { fail "print signed char != (minus)" } - timeout { fail "(timeout) print signed char != (minus)" } - } - } - -re "$prompt $" { fail "print signed char != (minus)" } - timeout { fail "(timeout) print signed char != (minus)" } -} - - -if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" } -send "set variable v_signed_char=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char < 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_char < 127\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed char < (minus)" } - -re "$prompt $" { fail "print signed char < (minus)" } - timeout { fail "(timeout) print signed char < (minus)" } - } - } - -re "$prompt $" { fail "print signed char < (minus)" } - timeout { fail "(timeout) print signed char < (minus)" } - } - } - -re "$prompt $" { fail "print signed char < (minus)" } - timeout { fail "(timeout) print signed char < (minus)" } -} - -if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" } -send "set variable v_signed_char=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_char > 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_char > 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char > (minus)" } - -re "$prompt $" { fail "print signed char > (minus)" } - timeout { fail "(timeout) print signed char > (minus)" } - } - } - -re "$prompt $" { fail "print signed char > (minus)" } - timeout { fail "(timeout) print signed char > (minus)" } - } - } - -re "$prompt $" { fail "print signed char > (minus)" } - timeout { fail "(timeout) print signed char > (minus)" } -} - - +test_expr "set variable v_signed_char=-1" "print v_signed_char == 0" "\\$\[0-9\]* = 0" "print v_signed_char == -1" "\\$\[0-9\]* = 1" "print signed char == (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char != 0" "\\$\[0-9\]* = 1" "print v_signed_char != -1" "\\$\[0-9\]* = 0" "print signed char != (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char < 0" "\\$\[0-9\]* = 1" "print v_signed_char < 127" "\\$\[0-9\]* = 1" "print signed char < (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char > 0" "\\$\[0-9\]* = 0" "print v_signed_char > 127" "\\$\[0-9\]* = 0" "print signed char > (minus)" # # test expressions with "unsigned char" types # -send "set variable v_unsigned_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_char == 127\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned char ==" } - -re "$prompt $" { fail "print unsigned char ==" } - timeout { fail "(timeout) print unsigned char ==" } - } - } - -re "$prompt $" { fail "print unsigned char ==" } - timeout { fail "(timeout) print unsigned char ==" } - } - } - -re "$prompt $" { fail "print unsigned char ==" } - timeout { fail "(timeout) print unsigned char ==" } -} - - -send "set variable v_unsigned_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_char != 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char !=" } - -re "$prompt $" { fail "print unsigned char !=" } - timeout { fail "(timeout) print unsigned char !=" } - } - } - -re "$prompt $" { fail "print unsigned char !=" } - timeout { fail "(timeout) print unsigned char !=" } - } - } - -re "$prompt $" { fail "print unsigned char !=" } - timeout { fail "(timeout) print unsigned char !=" } -} - - -send "set variable v_unsigned_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_char < 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char <" } - -re "$prompt $" { fail "print unsigned char <" } - timeout { fail "(timeout) print unsigned char <" } - } - } - -re "$prompt $" { fail "print unsigned char <" } - timeout { fail "(timeout) print unsigned char <" } - } - } - -re "$prompt $" { fail "print unsigned char <" } - timeout { fail "(timeout) print unsigned char <" } -} - - -send "set variable v_unsigned_char=127\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_char > 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char >" } - -re "$prompt $" { fail "print unsigned char >" } - timeout { fail "(timeout) print unsigned char >" } - } - } - -re "$prompt $" { fail "print unsigned char >" } - timeout { fail "(timeout) print unsigned char >" } - } - } - -re "$prompt $" { fail "print unsigned char >" } - timeout { fail "(timeout) print unsigned char >" } -} - - +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0" "print v_unsigned_char == 127" "\\$\[0-9\]* = 1" "print unsigned char ==" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1" "print v_unsigned_char != 127" "\\$\[0-9\]* = 0" "print unsigned char !=" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0" "print v_unsigned_char < 127" "\\$\[0-9\]* = 0" "print unsigned char <" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1" "print v_unsigned_char > 127" "\\$\[0-9\]* = 0" "print unsigned char >" # make char a minus # FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've # set up an expected failure for this case. -send "set variable v_unsigned_char=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_char == ~0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - setup_xfail "i960-*-*" 1821 - send "print v_unsigned_char == (unsigned char)~0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned char == (~0)" } - -re "$prompt $" { fail "print unsigned char == (~0)" } - timeout { fail "(timeout) print unsigned char == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char == (~0)" } - timeout { fail "(timeout) print unsigned char == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char == (~0)" } - timeout { fail "(timeout) print unsigned char == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char == (~0)" } - timeout { fail "(timeout) print unsigned char == (~0)" } -} - - +setup_xfail "i960-*-*" 1821 +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0" "print v_unsigned_char == ~0" "\\$\[0-9\]* = 0" "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = 1" "print unsigned char == (~0)" # FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've # set up an expected failure for this case. -send "set variable v_unsigned_char=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - setup_xfail "i960-*-*" 1821 - send "print v_unsigned_char != (unsigned char)~0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char != (~0)" } - -re "$prompt $" { fail "print unsigned char != (~0)" } - timeout { fail "(timeout) print unsigned char != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char != (~0)" } - timeout { fail "(timeout) print unsigned char != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char != (~0)" } - timeout { fail "(timeout) print unsigned char != (~0)" } -} - - -send "set variable v_unsigned_char=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_char < 127\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char < (~0)" } - -re "$prompt $" { fail "print unsigned char < (~0)" } - timeout { fail "(timeout) print unsigned char < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char < (~0)" } - timeout { fail "(timeout) print unsigned char < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char < (~0)" } - timeout { fail "(timeout) print unsigned char < (~0)" } -} - - -send "set variable v_unsigned_char=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_char > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_char > 127\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned char > (~0)" } - -re "$prompt $" { fail "print unsigned char > (~0)" } - timeout { fail "(timeout) print unsigned char > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char > (~0)" } - timeout { fail "(timeout) print unsigned char > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned char > (~0)" } - timeout { fail "(timeout) print unsigned char > (~0)" } -} - - +setup_xfail "i960-*-*" 1821 +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1" "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = 0" "print unsigned char != (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0" "print v_unsigned_char < 127" "\\$\[0-9\]* = 0" "print unsigned char < (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1" "print v_unsigned_char > 127" "\\$\[0-9\]* = 1" "print unsigned char > (~0)" # # test expressions with "short" types # -send "set variable v_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_short == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_short == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed short ==" } - -re "$prompt $" { fail "print signed short ==" } - timeout { fail "(timeout) print signed short ==" } - } - } - -re "$prompt $" { fail "print signed short ==" } - timeout { fail "(timeout) print signed short ==" } - } - } - -re "$prompt $" { fail "print signed short ==" } - timeout { fail "(timeout) print signed short ==" } -} - - -send "set variable v_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_short != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_short != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short !=" } - -re "$prompt $" { fail "print signed short !=" } - timeout { fail "(timeout) print signed short !=" } - } - } - -re "$prompt $" { fail "print signed short !=" } - timeout { fail "(timeout) print signed short !=" } - } - } - -re "$prompt $" { fail "print signed short !=" } - timeout { fail "(timeout) print signed short !=" } -} - - -send "set variable v_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_short < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_short < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short <" } - -re "$prompt $" { fail "print signed short <" } - timeout { fail "(timeout) print signed short <" } - } - } - -re "$prompt $" { fail "print signed short <" } - timeout { fail "(timeout) print signed short <" } - } - } - -re "$prompt $" { fail "print signed short <" } - timeout { fail "(timeout) print signed short <" } -} - - -send "set variable v_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_short > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_short > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short >" } - -re "$prompt $" { fail "print signed short >" } - timeout { fail "(timeout) print signed short >" } - } - } - -re "$prompt $" { fail "print signed short >" } - timeout { fail "(timeout) print signed short >" } - } - } - -re "$prompt $" { fail "print signed short >" } - timeout { fail "(timeout) print signed short >" } -} - - +test_expr "set variable v_short=0x7FFF" "print v_short == 0" "\\$\[0-9\]* = 0" "print v_short == 0x7FFF" "\\$\[0-9\]* = 1" "print signed short ==" +test_expr "set variable v_short=0x7FFF" "print v_short != 0" "\\$\[0-9\]* = 1" "print v_short != 0x7FFF" "\\$\[0-9\]* = 0" "print signed short !=" +test_expr "set variable v_short=0x7FFF" "print v_short < 0" "\\$\[0-9\]* = 0" "print v_short < 0x7FFF" "\\$\[0-9\]* = 0" "print signed short <" +test_expr "set variable v_short=0x7FFF" "print v_short > 0" "\\$\[0-9\]* = 1" "print v_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed short >" # make short a minus -send "set variable v_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_short == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_short == -1\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed short == (minus)" } - -re "$prompt $" { fail "print signed short == (minus)" } - timeout { fail "(timeout) print signed short == (minus)" } - } - } - -re "$prompt $" { fail "print signed short == (minus)" } - timeout { fail "(timeout) print signed short == (minus)" } - } - } - -re "$prompt $" { fail "print signed short == (minus)" } - timeout { fail "(timeout) print signed short == (minus)" } -} - - -send "set variable v_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_short != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_short != -1\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short != (minus)" } - -re "$prompt $" { fail "print signed short != (minus)" } - timeout { fail "(timeout) print signed short != (minus)" } - } - } - -re "$prompt $" { fail "print signed short != (minus)" } - timeout { fail "(timeout) print signed short != (minus)" } - } - } - -re "$prompt $" { fail "print signed short != (minus)" } - timeout { fail "(timeout) print signed short != (minus)" } -} - - -send "set variable v_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_short < 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_short < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed short < (minus)" } - -re "$prompt $" { fail "print signed short < (minus)" } - timeout { fail "(timeout) print signed short < (minus)" } - } - } - -re "$prompt $" { fail "print signed short < (minus)" } - timeout { fail "(timeout) print signed short < (minus)" } - } - } - -re "$prompt $" { fail "print signed short < (minus)" } - timeout { fail "(timeout) print signed short < (minus)" } -} - - -send "set variable v_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_short > 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_short > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short > (minus)" } - -re "$prompt $" { fail "print signed short > (minus)" } - timeout { fail "(timeout) print signed short > (minus)" } - } - } - -re "$prompt $" { fail "print signed short > (minus)" } - timeout { fail "(timeout) print signed short > (minus)" } - } - } - -re "$prompt $" { fail "print signed short > (minus)" } - timeout { fail "(timeout) print signed short > (minus)" } -} - - +test_expr "set variable v_short=-1" "print v_short == 0" "\\$\[0-9\]* = 0" "print v_short == -1" "\\$\[0-9\]* = 1" "print signed short == (minus)" +test_expr "set variable v_short=-1" "print v_short != 0" "\\$\[0-9\]* = 1" "print v_short != -1" "\\$\[0-9\]* = 0" "print signed short != (minus)" +test_expr "set variable v_short=-1" "print v_short < 0" "\\$\[0-9\]* = 1" "print v_short < 0x7FFF" "\\$\[0-9\]* = 1" "print signed short < (minus)" +test_expr "set variable v_short=-1" "print v_short > 0" "\\$\[0-9\]* = 0" "print v_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed short > (minus)" # # test expressions with "signed short" types # -send "set variable v_signed_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_short == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed short ==" } - -re "$prompt $" { fail "print signed signed short ==" } - timeout { fail "(timeout) print signed signed short ==" } - } - } - -re "$prompt $" { fail "print signed signed short ==" } - timeout { fail "(timeout) print signed signed short ==" } - } - } - -re "$prompt $" { fail "print signed signed short ==" } - timeout { fail "(timeout) print signed signed short ==" } -} - - -send "set variable v_signed_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_short != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short !=" } - -re "$prompt $" { fail "print signed signed short !=" } - timeout { fail "(timeout) print signed signed short !=" } - } - } - -re "$prompt $" { fail "print signed signed short !=" } - timeout { fail "(timeout) print signed signed short !=" } - } - } - -re "$prompt $" { fail "print signed signed short !=" } - timeout { fail "(timeout) print signed signed short !=" } -} - - -send "set variable v_signed_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_short < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short <" } - -re "$prompt $" { fail "print signed signed short <" } - timeout { fail "(timeout) print signed signed short <" } - } - } - -re "$prompt $" { fail "print signed signed short <" } - timeout { fail "(timeout) print signed signed short <" } - } - } - -re "$prompt $" { fail "print signed signed short <" } - timeout { fail "(timeout) print signed signed short <" } -} - - -send "set variable v_signed_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_short > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short >" } - -re "$prompt $" { fail "print signed signed short >" } - timeout { fail "(timeout) print signed signed short >" } - } - } - -re "$prompt $" { fail "print signed signed short >" } - timeout { fail "(timeout) print signed signed short >" } - } - } - -re "$prompt $" { fail "print signed signed short >" } - timeout { fail "(timeout) print signed signed short >" } -} - - +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short == 0" "\\$\[0-9\]* = 0" "print v_signed_short == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed short ==" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short != 0" "\\$\[0-9\]* = 1" "print v_signed_short != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short !=" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short < 0" "\\$\[0-9\]* = 0" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short <" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short > 0" "\\$\[0-9\]* = 1" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short >" # make short a minus -send "set variable v_signed_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_short == -1\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed short == (minus)" } - -re "$prompt $" { fail "print signed signed short == (minus)" } - timeout { fail "(timeout) print signed signed short == (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short == (minus)" } - timeout { fail "(timeout) print signed signed short == (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short == (minus)" } - timeout { fail "(timeout) print signed signed short == (minus)" } -} - - -send "set variable v_signed_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_short != -1\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short != (minus)" } - -re "$prompt $" { fail "print signed signed short != (minus)" } - timeout { fail "(timeout) print signed signed short != (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short != (minus)" } - timeout { fail "(timeout) print signed signed short != (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short != (minus)" } - timeout { fail "(timeout) print signed signed short != (minus)" } -} - - -send "set variable v_signed_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short < 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_short < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed short < (minus)" } - -re "$prompt $" { fail "print signed signed short < (minus)" } - timeout { fail "(timeout) print signed signed short < (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short < (minus)" } - timeout { fail "(timeout) print signed signed short < (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short < (minus)" } - timeout { fail "(timeout) print signed signed short < (minus)" } -} - - -send "set variable v_signed_short=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_short > 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_short > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short > (minus)" } - -re "$prompt $" { fail "print signed signed short > (minus)" } - timeout { fail "(timeout) print signed signed short > (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short > (minus)" } - timeout { fail "(timeout) print signed signed short > (minus)" } - } - } - -re "$prompt $" { fail "print signed signed short > (minus)" } - timeout { fail "(timeout) print signed signed short > (minus)" } -} - - +test_expr "set variable v_signed_short=-1" "print v_signed_short == 0" "\\$\[0-9\]* = 0" "print v_signed_short == -1" "\\$\[0-9\]* = 1" "print signed signed short == (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short != 0" "\\$\[0-9\]* = 1" "print v_signed_short != -1" "\\$\[0-9\]* = 0" "print signed signed short != (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short < 0" "\\$\[0-9\]* = 1" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed short < (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short > 0" "\\$\[0-9\]* = 0" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short > (minus)" # # test expressions with "unsigned short" types # -send "set variable v_unsigned_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_short == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned short ==" } - -re "$prompt $" { fail "print unsigned short ==" } - timeout { fail "(timeout) print unsigned short ==" } - } - } - -re "$prompt $" { fail "print unsigned short ==" } - timeout { fail "(timeout) print unsigned short ==" } - } - } - -re "$prompt $" { fail "print unsigned short ==" } - timeout { fail "(timeout) print unsigned short ==" } -} - - -send "set variable v_unsigned_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_short != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short !=" } - -re "$prompt $" { fail "print unsigned short !=" } - timeout { fail "(timeout) print unsigned short !=" } - } - } - -re "$prompt $" { fail "print unsigned short !=" } - timeout { fail "(timeout) print unsigned short !=" } - } - } - -re "$prompt $" { fail "print unsigned short !=" } - timeout { fail "(timeout) print unsigned short !=" } -} - - -send "set variable v_unsigned_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_short < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short <" } - -re "$prompt $" { fail "print unsigned short <" } - timeout { fail "(timeout) print unsigned short <" } - } - } - -re "$prompt $" { fail "print unsigned short <" } - timeout { fail "(timeout) print unsigned short <" } - } - } - -re "$prompt $" { fail "print unsigned short <" } - timeout { fail "(timeout) print unsigned short <" } -} - - -send "set variable v_unsigned_short=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_short > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short >" } - -re "$prompt $" { fail "print unsigned short >" } - timeout { fail "(timeout) print unsigned short >" } - } - } - -re "$prompt $" { fail "print unsigned short >" } - timeout { fail "(timeout) print unsigned short >" } - } - } - -re "$prompt $" { fail "print unsigned short >" } - timeout { fail "(timeout) print unsigned short >" } -} - - +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short == 0" "\\$\[0-9\]* = 0" "print v_unsigned_short == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned short ==" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1" "print v_unsigned_short != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short !=" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short <" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short >" # make short a minus -send "set variable v_unsigned_short=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_short == ~0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_short == (unsigned short)~0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned short == (~0)" } - -re "$prompt $" { fail "print unsigned short == (~0)" } - timeout { fail "(timeout) print unsigned short == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short == (~0)" } - timeout { fail "(timeout) print unsigned short == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short == (~0)" } - timeout { fail "(timeout) print unsigned short == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short == (~0)" } - timeout { fail "(timeout) print unsigned short == (~0)" } -} - - -send "set variable v_unsigned_short=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_short != (unsigned short)~0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short != (~0)" } - -re "$prompt $" { fail "print unsigned short != (~0)" } - timeout { fail "(timeout) print unsigned short != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short != (~0)" } - timeout { fail "(timeout) print unsigned short != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short != (~0)" } - timeout { fail "(timeout) print unsigned short != (~0)" } -} - - -send "set variable v_unsigned_short=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_short < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short < (~0)" } - -re "$prompt $" { fail "print unsigned short < (~0)" } - timeout { fail "(timeout) print unsigned short < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short < (~0)" } - timeout { fail "(timeout) print unsigned short < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short < (~0)" } - timeout { fail "(timeout) print unsigned short < (~0)" } -} - - -send "set variable v_unsigned_short=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_short > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_short > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned short > (~0)" } - -re "$prompt $" { fail "print unsigned short > (~0)" } - timeout { fail "(timeout) print unsigned short > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short > (~0)" } - timeout { fail "(timeout) print unsigned short > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned short > (~0)" } - timeout { fail "(timeout) print unsigned short > (~0)" } -} - - +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short == 0" "\\$\[0-9\]* = 0" "print v_unsigned_short == ~0" "\\$\[0-9\]* = 0" "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = 1" "print unsigned short == (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1" "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = 0" "print unsigned short != (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short < (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned short > (~0)" # # test expressions with "int" types # -send "set variable v_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_int == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_int == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed int ==" } - -re "$prompt $" { fail "print signed int ==" } - timeout { fail "(timeout) print signed int ==" } - } - } - -re "$prompt $" { fail "print signed int ==" } - timeout { fail "(timeout) print signed int ==" } - } - } - -re "$prompt $" { fail "print signed int ==" } - timeout { fail "(timeout) print signed int ==" } -} - - -send "set variable v_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_int != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_int != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int !=" } - -re "$prompt $" { fail "print signed int !=" } - timeout { fail "(timeout) print signed int !=" } - } - } - -re "$prompt $" { fail "print signed int !=" } - timeout { fail "(timeout) print signed int !=" } - } - } - -re "$prompt $" { fail "print signed int !=" } - timeout { fail "(timeout) print signed int !=" } -} - - -send "set variable v_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_int < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_int < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int <" } - -re "$prompt $" { fail "print signed int <" } - timeout { fail "(timeout) print signed int <" } - } - } - -re "$prompt $" { fail "print signed int <" } - timeout { fail "(timeout) print signed int <" } - } - } - -re "$prompt $" { fail "print signed int <" } - timeout { fail "(timeout) print signed int <" } -} - - -send "set variable v_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_int > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_int > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int >" } - -re "$prompt $" { fail "print signed int >" } - timeout { fail "(timeout) print signed int >" } - } - } - -re "$prompt $" { fail "print signed int >" } - timeout { fail "(timeout) print signed int >" } - } - } - -re "$prompt $" { fail "print signed int >" } - timeout { fail "(timeout) print signed int >" } -} - - +test_expr "set variable v_int=0x7FFF" "print v_int == 0" "\\$\[0-9\]* = 0" "print v_int == 0x7FFF" "\\$\[0-9\]* = 1" "print signed int ==" +test_expr "set variable v_int=0x7FFF" "print v_int != 0" "\\$\[0-9\]* = 1" "print v_int != 0x7FFF" "\\$\[0-9\]* = 0" "print signed int !=" +test_expr "set variable v_int=0x7FFF" "print v_int < 0" "\\$\[0-9\]* = 0" "print v_int < 0x7FFF" "\\$\[0-9\]* = 0" "print signed int <" +test_expr "set variable v_int=0x7FFF" "print v_int > 0" "\\$\[0-9\]* = 1" "print v_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed int >" # make int a minus -send "set variable v_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_int == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_int == -1\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed int == (minus)" } - -re "$prompt $" { fail "print signed int == (minus)" } - timeout { fail "(timeout) print signed int == (minus)" } - } - } - -re "$prompt $" { fail "print signed int == (minus)" } - timeout { fail "(timeout) print signed int == (minus)" } - } - } - -re "$prompt $" { fail "print signed int == (minus)" } - timeout { fail "(timeout) print signed int == (minus)" } -} - - -send "set variable v_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_int != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_int != -1\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int != (minus)" } - -re "$prompt $" { fail "print signed int != (minus)" } - timeout { fail "(timeout) print signed int != (minus)" } - } - } - -re "$prompt $" { fail "print signed int != (minus)" } - timeout { fail "(timeout) print signed int != (minus)" } - } - } - -re "$prompt $" { fail "print signed int != (minus)" } - timeout { fail "(timeout) print signed int != (minus)" } -} - - -send "set variable v_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_int < 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_int < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed int < (minus)" } - -re "$prompt $" { fail "print signed int < (minus)" } - timeout { fail "(timeout) print signed int < (minus)" } - } - } - -re "$prompt $" { fail "print signed int < (minus)" } - timeout { fail "(timeout) print signed int < (minus)" } - } - } - -re "$prompt $" { fail "print signed int < (minus)" } - timeout { fail "(timeout) print signed int < (minus)" } -} - - -send "set variable v_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_int > 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_int > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int > (minus)" } - -re "$prompt $" { fail "print signed int > (minus)" } - timeout { fail "(timeout) print signed int > (minus)" } - } - } - -re "$prompt $" { fail "print signed int > (minus)" } - timeout { fail "(timeout) print signed int > (minus)" } - } - } - -re "$prompt $" { fail "print signed int > (minus)" } - timeout { fail "(timeout) print signed int > (minus)" } -} - - +test_expr "set variable v_int=-1" "print v_int == 0" "\\$\[0-9\]* = 0" "print v_int == -1" "\\$\[0-9\]* = 1" "print signed int == (minus)" +test_expr "set variable v_int=-1" "print v_int != 0" "\\$\[0-9\]* = 1" "print v_int != -1" "\\$\[0-9\]* = 0" "print signed int != (minus)" +test_expr "set variable v_int=-1" "print v_int < 0" "\\$\[0-9\]* = 1" "print v_int < 0x7FFF" "\\$\[0-9\]* = 1" "print signed int < (minus)" +test_expr "set variable v_int=-1" "print v_int > 0" "\\$\[0-9\]* = 0" "print v_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed int > (minus)" # # test expressions with "signed int" types # -send "set variable v_signed_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_int == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed int ==" } - -re "$prompt $" { fail "print signed signed int ==" } - timeout { fail "(timeout) print signed signed int ==" } - } - } - -re "$prompt $" { fail "print signed signed int ==" } - timeout { fail "(timeout) print signed signed int ==" } - } - } - -re "$prompt $" { fail "print signed signed int ==" } - timeout { fail "(timeout) print signed signed int ==" } -} - - -send "set variable v_signed_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_int != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int !=" } - -re "$prompt $" { fail "print signed signed int !=" } - timeout { fail "(timeout) print signed signed int !=" } - } - } - -re "$prompt $" { fail "print signed signed int !=" } - timeout { fail "(timeout) print signed signed int !=" } - } - } - -re "$prompt $" { fail "print signed signed int !=" } - timeout { fail "(timeout) print signed signed int !=" } -} - - -send "set variable v_signed_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_int < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int <" } - -re "$prompt $" { fail "print signed signed int <" } - timeout { fail "(timeout) print signed signed int <" } - } - } - -re "$prompt $" { fail "print signed signed int <" } - timeout { fail "(timeout) print signed signed int <" } - } - } - -re "$prompt $" { fail "print signed signed int <" } - timeout { fail "(timeout) print signed signed int <" } -} - - -send "set variable v_signed_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_int > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int >" } - -re "$prompt $" { fail "print signed signed int >" } - timeout { fail "(timeout) print signed signed int >" } - } - } - -re "$prompt $" { fail "print signed signed int >" } - timeout { fail "(timeout) print signed signed int >" } - } - } - -re "$prompt $" { fail "print signed signed int >" } - timeout { fail "(timeout) print signed signed int >" } -} - - +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int == 0" "\\$\[0-9\]* = 0" "print v_signed_int == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed int ==" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int != 0" "\\$\[0-9\]* = 1" "print v_signed_int != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int !=" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int < 0" "\\$\[0-9\]* = 0" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int <" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int > 0" "\\$\[0-9\]* = 1" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int >" # make int a minus -send "set variable v_signed_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_int == -1\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed int == (minus)" } - -re "$prompt $" { fail "print signed signed int == (minus)" } - timeout { fail "(timeout) print signed signed int == (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int == (minus)" } - timeout { fail "(timeout) print signed signed int == (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int == (minus)" } - timeout { fail "(timeout) print signed signed int == (minus)" } -} - - -send "set variable v_signed_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_int != -1\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int != (minus)" } - -re "$prompt $" { fail "print signed signed int != (minus)" } - timeout { fail "(timeout) print signed signed int != (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int != (minus)" } - timeout { fail "(timeout) print signed signed int != (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int != (minus)" } - timeout { fail "(timeout) print signed signed int != (minus)" } -} - - -send "set variable v_signed_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int < 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_int < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed int < (minus)" } - -re "$prompt $" { fail "print signed signed int < (minus)" } - timeout { fail "(timeout) print signed signed int < (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int < (minus)" } - timeout { fail "(timeout) print signed signed int < (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int < (minus)" } - timeout { fail "(timeout) print signed signed int < (minus)" } -} - - -send "set variable v_signed_int=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_int > 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_int > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int > (minus)" } - -re "$prompt $" { fail "print signed signed int > (minus)" } - timeout { fail "(timeout) print signed signed int > (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int > (minus)" } - timeout { fail "(timeout) print signed signed int > (minus)" } - } - } - -re "$prompt $" { fail "print signed signed int > (minus)" } - timeout { fail "(timeout) print signed signed int > (minus)" } -} - - +test_expr "set variable v_signed_int=-1" "print v_signed_int == 0" "\\$\[0-9\]* = 0" "print v_signed_int == -1" "\\$\[0-9\]* = 1" "print signed signed int == (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int != 0" "\\$\[0-9\]* = 1" "print v_signed_int != -1" "\\$\[0-9\]* = 0" "print signed signed int != (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int < 0" "\\$\[0-9\]* = 1" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed int < (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int > 0" "\\$\[0-9\]* = 0" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int > (minus)" # # test expressions with "unsigned int" types # -send "set variable v_unsigned_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_int == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int ==" } - -re "$prompt $" { fail "print unsigned int ==" } - timeout { fail "(timeout) print unsigned int ==" } - } - } - -re "$prompt $" { fail "print unsigned int ==" } - timeout { fail "(timeout) print unsigned int ==" } - } - } - -re "$prompt $" { fail "print unsigned int ==" } - timeout { fail "(timeout) print unsigned int ==" } -} - - -send "set variable v_unsigned_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_int != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int !=" } - -re "$prompt $" { fail "print unsigned int !=" } - timeout { fail "(timeout) print unsigned int !=" } - } - } - -re "$prompt $" { fail "print unsigned int !=" } - timeout { fail "(timeout) print unsigned int !=" } - } - } - -re "$prompt $" { fail "print unsigned int !=" } - timeout { fail "(timeout) print unsigned int !=" } -} - - -send "set variable v_unsigned_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_int < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int <" } - -re "$prompt $" { fail "print unsigned int <" } - timeout { fail "(timeout) print unsigned int <" } - } - } - -re "$prompt $" { fail "print unsigned int <" } - timeout { fail "(timeout) print unsigned int <" } - } - } - -re "$prompt $" { fail "print unsigned int <" } - timeout { fail "(timeout) print unsigned int <" } -} - - -send "set variable v_unsigned_int=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_int > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int >" } - -re "$prompt $" { fail "print unsigned int >" } - timeout { fail "(timeout) print unsigned int >" } - } - } - -re "$prompt $" { fail "print unsigned int >" } - timeout { fail "(timeout) print unsigned int >" } - } - } - -re "$prompt $" { fail "print unsigned int >" } - timeout { fail "(timeout) print unsigned int >" } -} - - +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0" "print v_unsigned_int == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned int ==" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1" "print v_unsigned_int != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int !=" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int <" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int >" # make int a minus -send "set variable v_unsigned_int=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_int == ~0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_int == (unsigned int)~0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int == (~0)" } - -re "$prompt $" { fail "print unsigned int == (~0)" } - timeout { fail "(timeout) print unsigned int == (~0)" } - } - } - -re "print.*.\[0-9\]* = 0.*$prompt $" { - fail "print unsigned int == (~0)" - send "print v_unsigned_int == (unsigned int)~0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int == (~0)" } - -re "$prompt $" { fail "print unsigned int == (~0)" } - timeout { fail "(timeout) print unsigned int == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int == (~0)" } - timeout { fail "(timeout) print unsigned int == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int == (~0)" } - timeout { fail "(timeout) print unsigned int == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int == (~0)" } - timeout { fail "(timeout) print unsigned int == (~0)" } -} - - -send "set variable v_unsigned_int=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_int != (unsigned int)~0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int != (~0)" } - -re "$prompt $" { fail "print unsigned int != (~0)" } - timeout { fail "(timeout) print unsigned int != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int != (~0)" } - timeout { fail "(timeout) print unsigned int != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int != (~0)" } - timeout { fail "(timeout) print unsigned int != (~0)" } -} - - -send "set variable v_unsigned_int=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_int < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int < (~0)" } - -re "$prompt $" { fail "print unsigned int < (~0)" } - timeout { fail "(timeout) print unsigned int < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int < (~0)" } - timeout { fail "(timeout) print unsigned int < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int < (~0)" } - timeout { fail "(timeout) print unsigned int < (~0)" } -} - - -send "set variable v_unsigned_int=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_int > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_int > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int > (~0)" } - -re "$prompt $" { fail "print unsigned int > (~0)" } - timeout { fail "(timeout) print unsigned int > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int > (~0)" } - timeout { fail "(timeout) print unsigned int > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned int > (~0)" } - timeout { fail "(timeout) print unsigned int > (~0)" } -} - - +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0" "print v_unsigned_int == ~0" "\\$\[0-9\]* = 1" "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = 1" "print unsigned int == (~0)" +test_expr "\\$\[0-9\]* = 0" "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = 1" "print unsigned int == (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1" "print v_unsigned_int != (unsigned int)~0" "\\$\[0-9\]* = 0" "print unsigned int != (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int < (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned int > (~0)" # # test expressions with "long" types # -send "set variable v_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_long == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_long == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed long ==" } - -re "$prompt $" { fail "print signed long ==" } - timeout { fail "(timeout) print signed long ==" } - } - } - -re "$prompt $" { fail "print signed long ==" } - timeout { fail "(timeout) print signed long ==" } - } - } - -re "$prompt $" { fail "print signed long ==" } - timeout { fail "(timeout) print signed long ==" } -} - - -send "set variable v_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_long != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_long != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long !=" } - -re "$prompt $" { fail "print signed long !=" } - timeout { fail "(timeout) print signed long !=" } - } - } - -re "$prompt $" { fail "print signed long !=" } - timeout { fail "(timeout) print signed long !=" } - } - } - -re "$prompt $" { fail "print signed long !=" } - timeout { fail "(timeout) print signed long !=" } -} - - -send "set variable v_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_long < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_long < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long <" } - -re "$prompt $" { fail "print signed long <" } - timeout { fail "(timeout) print signed long <" } - } - } - -re "$prompt $" { fail "print signed long <" } - timeout { fail "(timeout) print signed long <" } - } - } - -re "$prompt $" { fail "print signed long <" } - timeout { fail "(timeout) print signed long <" } -} - - -send "set variable v_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_long > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_long > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long >" } - -re "$prompt $" { fail "print signed long >" } - timeout { fail "(timeout) print signed long >" } - } - } - -re "$prompt $" { fail "print signed long >" } - timeout { fail "(timeout) print signed long >" } - } - } - -re "$prompt $" { fail "print signed long >" } - timeout { fail "(timeout) print signed long >" } -} - - +test_expr "set variable v_long=0x7FFF" "print v_long == 0" "\\$\[0-9\]* = 0" "print v_long == 0x7FFF" "\\$\[0-9\]* = 1" "print signed long ==" +test_expr "set variable v_long=0x7FFF" "print v_long != 0" "\\$\[0-9\]* = 1" "print v_long != 0x7FFF" "\\$\[0-9\]* = 0" "print signed long !=" +test_expr "set variable v_long=0x7FFF" "print v_long < 0" "\\$\[0-9\]* = 0" "print v_long < 0x7FFF" "\\$\[0-9\]* = 0" "print signed long <" +test_expr "set variable v_long=0x7FFF" "print v_long > 0" "\\$\[0-9\]* = 1" "print v_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed long >" # make long a minus -send "set variable v_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_long == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_long == -1\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed long == (minus)" } - -re "$prompt $" { fail "print signed long == (minus)" } - timeout { fail "(timeout) print signed long == (minus)" } - } - } - -re "$prompt $" { fail "print signed long == (minus)" } - timeout { fail "(timeout) print signed long == (minus)" } - } - } - -re "$prompt $" { fail "print signed long == (minus)" } - timeout { fail "(timeout) print signed long == (minus)" } -} - - -send "set variable v_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_long != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_long != -1\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long != (minus)" } - -re "$prompt $" { fail "print signed long != (minus)" } - timeout { fail "(timeout) print signed long != (minus)" } - } - } - -re "$prompt $" { fail "print signed long != (minus)" } - timeout { fail "(timeout) print signed long != (minus)" } - } - } - -re "$prompt $" { fail "print signed long != (minus)" } - timeout { fail "(timeout) print signed long != (minus)" } -} - - -send "set variable v_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_long < 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_long < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed long < (minus)" } - -re "$prompt $" { fail "print signed long < (minus)" } - timeout { fail "(timeout) print signed long < (minus)" } - } - } - -re "$prompt $" { fail "print signed long < (minus)" } - timeout { fail "(timeout) print signed long < (minus)" } - } - } - -re "$prompt $" { fail "print signed long < (minus)" } - timeout { fail "(timeout) print signed long < (minus)" } -} - - -send "set variable v_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_long > 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_long > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long > (minus)" } - -re "$prompt $" { fail "print signed long > (minus)" } - timeout { fail "(timeout) print signed long > (minus)" } - } - } - -re "$prompt $" { fail "print signed long > (minus)" } - timeout { fail "(timeout) print signed long > (minus)" } - } - } - -re "$prompt $" { fail "print signed long > (minus)" } - timeout { fail "(timeout) print signed long > (minus)" } -} - - +test_expr "set variable v_long=-1" "print v_long == 0" "\\$\[0-9\]* = 0" "print v_long == -1" "\\$\[0-9\]* = 1" "print signed long == (minus)" +test_expr "set variable v_long=-1" "print v_long != 0" "\\$\[0-9\]* = 1" "print v_long != -1" "\\$\[0-9\]* = 0" "print signed long != (minus)" +test_expr "set variable v_long=-1" "print v_long < 0" "\\$\[0-9\]* = 1" "print v_long < 0x7FFF" "\\$\[0-9\]* = 1" "print signed long < (minus)" +test_expr "set variable v_long=-1" "print v_long > 0" "\\$\[0-9\]* = 0" "print v_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed long > (minus)" # # test expressions with "signed long" types # -send "set variable v_signed_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_long == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed long ==" } - -re "$prompt $" { fail "print signed signed long ==" } - timeout { fail "(timeout) print signed signed long ==" } - } - } - -re "$prompt $" { fail "print signed signed long ==" } - timeout { fail "(timeout) print signed signed long ==" } - } - } - -re "$prompt $" { fail "print signed signed long ==" } - timeout { fail "(timeout) print signed signed long ==" } -} - - -send "set variable v_signed_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_long != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long !=" } - -re "$prompt $" { fail "print signed signed long !=" } - timeout { fail "(timeout) print signed signed long !=" } - } - } - -re "$prompt $" { fail "print signed signed long !=" } - timeout { fail "(timeout) print signed signed long !=" } - } - } - -re "$prompt $" { fail "print signed signed long !=" } - timeout { fail "(timeout) print signed signed long !=" } -} - - -send "set variable v_signed_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_long < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long <" } - -re "$prompt $" { fail "print signed signed long <" } - timeout { fail "(timeout) print signed signed long <" } - } - } - -re "$prompt $" { fail "print signed signed long <" } - timeout { fail "(timeout) print signed signed long <" } - } - } - -re "$prompt $" { fail "print signed signed long <" } - timeout { fail "(timeout) print signed signed long <" } -} - - -send "set variable v_signed_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_long > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long >" } - -re "$prompt $" { fail "print signed signed long >" } - timeout { fail "(timeout) print signed signed long >" } - } - } - -re "$prompt $" { fail "print signed signed long >" } - timeout { fail "(timeout) print signed signed long >" } - } - } - -re "$prompt $" { fail "print signed signed long >" } - timeout { fail "(timeout) print signed signed long >" } -} - - +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long == 0" "\\$\[0-9\]* = 0" "print v_signed_long == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed long ==" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long != 0" "\\$\[0-9\]* = 1" "print v_signed_long != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long !=" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long < 0" "\\$\[0-9\]* = 0" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long <" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long > 0" "\\$\[0-9\]* = 1" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long >" # make long a minus -send "set variable v_signed_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_long == -1\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed long == (minus)" } - -re "$prompt $" { fail "print signed signed long == (minus)" } - timeout { fail "(timeout) print signed signed long == (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long == (minus)" } - timeout { fail "(timeout) print signed signed long == (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long == (minus)" } - timeout { fail "(timeout) print signed signed long == (minus)" } -} - - -send "set variable v_signed_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_long != -1\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long != (minus)" } - -re "$prompt $" { fail "print signed signed long != (minus)" } - timeout { fail "(timeout) print signed signed long != (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long != (minus)" } - timeout { fail "(timeout) print signed signed long != (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long != (minus)" } - timeout { fail "(timeout) print signed signed long != (minus)" } -} - - -send "set variable v_signed_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long < 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_signed_long < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed long < (minus)" } - -re "$prompt $" { fail "print signed signed long < (minus)" } - timeout { fail "(timeout) print signed signed long < (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long < (minus)" } - timeout { fail "(timeout) print signed signed long < (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long < (minus)" } - timeout { fail "(timeout) print signed signed long < (minus)" } -} - - -send "set variable v_signed_long=-1\n" -expect { - -re "set.*$prompt $" { - send "print v_signed_long > 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_signed_long > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long > (minus)" } - -re "$prompt $" { fail "print signed signed long > (minus)" } - timeout { fail "(timeout) print signed signed long > (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long > (minus)" } - timeout { fail "(timeout) print signed signed long > (minus)" } - } - } - -re "$prompt $" { fail "print signed signed long > (minus)" } - timeout { fail "(timeout) print signed signed long > (minus)" } -} - - +test_expr "set variable v_signed_long=-1" "print v_signed_long == 0" "\\$\[0-9\]* = 0" "print v_signed_long == -1" "\\$\[0-9\]* = 1" "print signed signed long == (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long != 0" "\\$\[0-9\]* = 1" "print v_signed_long != -1" "\\$\[0-9\]* = 0" "print signed signed long != (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long < 0" "\\$\[0-9\]* = 1" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed long < (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long > 0" "\\$\[0-9\]* = 0" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long > (minus)" # # test expressions with "unsigned long" types # -send "set variable v_unsigned_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_long == 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned long ==" } - -re "$prompt $" { fail "print unsigned long ==" } - timeout { fail "(timeout) print unsigned long ==" } - } - } - -re "$prompt $" { fail "print unsigned long ==" } - timeout { fail "(timeout) print unsigned long ==" } - } - } - -re "$prompt $" { fail "print unsigned long ==" } - timeout { fail "(timeout) print unsigned long ==" } -} - - -send "set variable v_unsigned_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_long != 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long !=" } - -re "$prompt $" { fail "print unsigned long !=" } - timeout { fail "(timeout) print unsigned long !=" } - } - } - -re "$prompt $" { fail "print unsigned long !=" } - timeout { fail "(timeout) print unsigned long !=" } - } - } - -re "$prompt $" { fail "print unsigned long !=" } - timeout { fail "(timeout) print unsigned long !=" } -} - - -send "set variable v_unsigned_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_long < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long <" } - -re "$prompt $" { fail "print unsigned long <" } - timeout { fail "(timeout) print unsigned long <" } - } - } - -re "$prompt $" { fail "print unsigned long <" } - timeout { fail "(timeout) print unsigned long <" } - } - } - -re "$prompt $" { fail "print unsigned long <" } - timeout { fail "(timeout) print unsigned long <" } -} - - -send "set variable v_unsigned_long=0x7FFF\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_long > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long >" } - -re "$prompt $" { fail "print unsigned long >" } - timeout { fail "(timeout) print unsigned long >" } - } - } - -re "$prompt $" { fail "print unsigned long >" } - timeout { fail "(timeout) print unsigned long >" } - } - } - -re "$prompt $" { fail "print unsigned long >" } - timeout { fail "(timeout) print unsigned long >" } -} - - +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0" "print v_unsigned_long == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned long ==" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1" "print v_unsigned_long != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long !=" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long <" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long >" # make long a minus -send "set variable v_unsigned_long=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long == 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_long == ~0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_long == (unsigned long)~0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned long == (~0)" } - -re "$prompt $" { fail "print unsigned long == (~0)" } - timeout { fail "(timeout) print unsigned long == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long == (~0)" } - timeout { fail "(timeout) print unsigned long == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long == (~0)" } - timeout { fail "(timeout) print unsigned long == (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long == (~0)" } - timeout { fail "(timeout) print unsigned long == (~0)" } -} - - -send "set variable v_unsigned_long=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long != 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_long != (unsigned long)~0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long != (~0)" } - -re "$prompt $" { fail "print unsigned long != (~0)" } - timeout { fail "(timeout) print unsigned long != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long != (~0)" } - timeout { fail "(timeout) print unsigned long != (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long != (~0)" } - timeout { fail "(timeout) print unsigned long != (~0)" } -} - - -send "set variable v_unsigned_long=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long < 0\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { - send "print v_unsigned_long < 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long < (~0)" } - -re "$prompt $" { fail "print unsigned long < (~0)" } - timeout { fail "(timeout) print unsigned long < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long < (~0)" } - timeout { fail "(timeout) print unsigned long < (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long < (~0)" } - timeout { fail "(timeout) print unsigned long < (~0)" } -} - - -send "set variable v_unsigned_long=~0\n" -expect { - -re "set.*$prompt $" { - send "print v_unsigned_long > 0\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { - send "print v_unsigned_long > 0x7FFF\n" - expect { - -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned long > (~0)" } - -re "$prompt $" { fail "print unsigned long > (~0)" } - timeout { fail "(timeout) print unsigned long > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long > (~0)" } - timeout { fail "(timeout) print unsigned long > (~0)" } - } - } - -re "$prompt $" { fail "print unsigned long > (~0)" } - timeout { fail "(timeout) print unsigned long > (~0)" } -} +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0" "print v_unsigned_long == ~0" "\\$\[0-9\]* = 1" "print v_unsigned_long == (unsigned long)~0" "\\$\[0-9\]* = 1" "print unsigned long == (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1" "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = 0" "print unsigned long != (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long < (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned long > (~0)" -- cgit v1.1