diff options
Diffstat (limited to 'tests/expr.test')
-rw-r--r-- | tests/expr.test | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/expr.test b/tests/expr.test index 1928a84..6fa2129 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.8 2005/08/29 17:56:22 kennykb Exp $ +# RCS: @(#) $Id: expr.test,v 1.17.2.9 2005/10/28 03:26:32 mdejong Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -899,6 +899,37 @@ test expr-46.12 {round() boundary case - -1/2 + 1 ulp} { expr {round($x)} } 0 +test expr-46.13 {round() boundary case - largest int} { + set imax [expr {((1<<31) + 1) * -1}] + expr {round($imax - 0.51)} +} 2147483646 + +test expr-46.14 {round() boundary case - largest int} { + set imax [expr {((1<<31) + 1) * -1}] + expr {round($imax - 0.50)} +} 2147483647 + +test expr-46.15 {round() boundary case - becomes wide int} { + set imax [expr {((1<<31) + 1) * -1}] + expr {round($imax + 0.50)} +} 2147483648 + +test expr-46.16 {round() boundary case - smallest int} { + set imin [expr {1<<31}] + expr {round($imin + 0.51)} +} -2147483647 + +test expr-46.17 {round() boundary case - smallest int} { + set imin [expr {1<<31}] + expr {round($imin + 0.50)} +} -2147483648 + +test expr-46.18 {round() boundary case - becomes wide int} { + set imin [expr {1<<31}] + expr {round($imin - 0.50)} +} -2147483649 + + # cleanup if {[info exists a]} { unset a |