summaryrefslogtreecommitdiffstats
path: root/tests/expr.test
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2006-12-06 16:36:58 (GMT)
committerKevin B Kenny <kennykb@acm.org>2006-12-06 16:36:58 (GMT)
commit50620f98af568bb61c29bf2f7350cf455367813a (patch)
treeb05e2b8cc226e970b240d2530e10d1ca232c76a0 /tests/expr.test
parentffae5fc3c686e2961f5a60e7e97d5bed11fde3c7 (diff)
downloadtcl-50620f98af568bb61c29bf2f7350cf455367813a.zip
tcl-50620f98af568bb61c29bf2f7350cf455367813a.tar.gz
tcl-50620f98af568bb61c29bf2f7350cf455367813a.tar.bz2
Improved error reporting in test expr-47.12
Diffstat (limited to 'tests/expr.test')
-rw-r--r--tests/expr.test26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/expr.test b/tests/expr.test
index 51b66bd..daab2f4 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.66 2006/12/01 20:00:00 kennykb Exp $
+# RCS: @(#) $Id: expr.test,v 1.67 2006/12/06 16:37:00 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -6631,18 +6631,28 @@ test expr-47.11 {isqrt of zero} {
} 0
test expr-47.12 {isqrt of various sizes of integer} {
- for {set i 0} {$i < 3000} {incr i} {
+ set faults 0
+ for {set i 0} {$faults < 10 && $i <= 1024} {incr i} {
set root [expr {1 << $i}]
set rm1 [expr {$root - 1}]
set arg [expr {1 << (2 * $i)}]
- if {isqrt($arg-1) != $rm1} {
- append trouble "i = " $i ": isqrt( " $arg "-1) != " $rm1 "\n"
+ set tval [expr {isqrt($arg-1)}]
+ if {$tval != $rm1} {
+ append trouble "i = " $i ": isqrt(" $arg "-1) == " $tval \
+ " != " $rm1 "\n"
+ incr faults
}
- if {isqrt($arg) != $root} {
- append trouble "i = " $i ": isqrt( " $arg ") != " $root "\n"
+ set tval [expr {isqrt($arg)}]
+ if {$tval != $root} {
+ append trouble "i = " $i ": isqrt(" $arg ") == " $tval \
+ " != " $root "\n"
+ incr faults
}
- if {isqrt($arg+1) != $root} {
- append trouble "i = " $i ": isqrt( " $arg "+1) != " $root "\n"
+ set tval [expr {isqrt($arg+1)}]
+ if {$tval != $root} {
+ append trouble "i = " $i ": isqrt(" $arg "+1) == " $tval \
+ " != " $root "\n"
+ incr faults
}
}
set trouble