diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-09-18 19:17:10 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-09-18 19:17:10 (GMT) |
commit | a3ec92940dc1dda1f91d654e08b7bba36bc2300d (patch) | |
tree | 34583eaed6324aad39f4233f0f144285bab5bf82 /tests/expr.test | |
parent | 2994c047afba0aed2193c6cc688808335ae956ce (diff) | |
download | tcl-a3ec92940dc1dda1f91d654e08b7bba36bc2300d.zip tcl-a3ec92940dc1dda1f91d654e08b7bba36bc2300d.tar.gz tcl-a3ec92940dc1dda1f91d654e08b7bba36bc2300d.tar.bz2 |
Make sure large shifts shift for real. [Bug 868467]
Diffstat (limited to 'tests/expr.test')
-rw-r--r-- | tests/expr.test | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/expr.test b/tests/expr.test index 6ef1c41..b4b6917 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr.test,v 1.17.2.1 2003/03/27 13:49:22 dkf Exp $ +# RCS: @(#) $Id: expr.test,v 1.17.2.2 2004/09/18 19:17:13 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -806,6 +806,17 @@ test expr-22.8 {non-numeric floats} nonPortable { list [catch {expr {1 / Inf}} msg] $msg } {1 {can't use infinite floating-point value as operand of "/"}} +# Some compilers get this wrong; ensure that we work around it correctly +test expr-24.1 {expr edge cases; shifting} {expr int(5)>>31} 0 +test expr-24.2 {expr edge cases; shifting} {expr int(5)>>63} 0 +test expr-24.3 {expr edge cases; shifting} {expr wide(5)>>31} 0 +test expr-24.4 {expr edge cases; shifting} {expr wide(5)>>63} 0 +test expr-24.5 {expr edge cases; shifting} nonPortable {expr int(5)<<31} 0 +test expr-24.6 {expr edge cases; shifting} {expr int(5)<<63} 0 +test expr-24.7 {expr edge cases; shifting} {expr wide(5)<<31} 10737418240 +test expr-24.8 {expr edge cases; shifting} nonPortable {expr wide(5)<<63} -9223372036854775808 +test expr-24.9 {expr edge cases; shifting} {expr 5>>32} 0 + # cleanup if {[info exists a]} { unset a |