summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--tests/expr.test54
2 files changed, 47 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f7ead3..f3d0f84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-29 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/expr.test: Fix problems in new round()
+ tests that lead to correct result only on 32
+ bit long systems. [Bug 1341368]
+
2005-10-29 Miguel Sofer <msofer@users.sf.net>
* generic/tclCmdMZ.c (TraceVarProc): [Bug 1337229], partial
@@ -8,6 +14,18 @@
* tests/trace.test (test-18.3-4): added tests for bugs #1337229
and 1338280.
+2005-10-27 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * generic/tclExecute.c (ExprRoundFunc):
+ Fix typo where number before rounding is
+ compared with smallest integer instead of
+ number after rounding. This fix does not
+ change the results of any tests.
+ * tests/expr.test: Add round() tests
+ for cases near the min and max int values.
+ * tests/util.test: Remove pointless
+ warning code about testobj command.
+
2005-10-23 Miguel Sofer <msofer@users.sf.net>
* generic/tclBasic.c:
diff --git a/tests/expr.test b/tests/expr.test
index 6fa2129..ff4bc0f 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.9 2005/10/28 03:26:32 mdejong Exp $
+# RCS: @(#) $Id: expr.test,v 1.17.2.10 2005/10/29 19:58:04 mdejong Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -899,35 +899,39 @@ 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
+if {int(0x80000000) < 0} {
+ # 32 bit long
+ set min_long -2147483648
+ set max_long 2147483647
+} else {
+ # 64 bit long
+ set min_long -9223372036854775808
+ set max_long 9223372036854775807
+}
-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.13 {round() boundary case - round down} {
+ expr {round($max_long - 0.51)}
+} [expr {$max_long - 1}]
-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.14 {round() boundary case - round up} {
+ expr {round($max_long - 0.50)}
+} $max_long
+
+test expr-46.15 {round() boundary case - round up to wide} {
+ expr {round($max_long + 0.50)}
+} [expr {wide($max_long) + 1}]
-test expr-46.16 {round() boundary case - smallest int} {
- set imin [expr {1<<31}]
- expr {round($imin + 0.51)}
-} -2147483647
+test expr-46.16 {round() boundary case - round up} {
+ expr {round($min_long + 0.51)}
+} [expr {$min_long + 1}]
-test expr-46.17 {round() boundary case - smallest int} {
- set imin [expr {1<<31}]
- expr {round($imin + 0.50)}
-} -2147483648
+test expr-46.17 {round() boundary case - round down} {
+ expr {round($min_long + 0.50)}
+} $min_long
-test expr-46.18 {round() boundary case - becomes wide int} {
- set imin [expr {1<<31}]
- expr {round($imin - 0.50)}
-} -2147483649
+test expr-46.18 {round() boundary case - round down to wide} {
+ expr {round($min_long - 0.50)}
+} [expr {wide($min_long) - 1}]
# cleanup