summaryrefslogtreecommitdiffstats
path: root/tests/expr-old.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/expr-old.test')
-rw-r--r--tests/expr-old.test108
1 files changed, 54 insertions, 54 deletions
diff --git a/tests/expr-old.test b/tests/expr-old.test
index 971ea05..e6edcde 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -13,7 +13,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-old.test,v 1.30 2005/11/01 16:41:20 dgp Exp $
+# RCS: @(#) $Id: expr-old.test,v 1.31 2005/11/09 20:24:10 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -784,9 +784,9 @@ test expr-old-32.24 {math functions in expressions} {
format %.6g [expr abs(66)]
} {66}
-test expr-old-32.25a {math functions in expressions} knownBug {
- list [catch {expr abs(0x8000000000000000)} msg] $msg
-} {1 {integer value too large to represent}}
+test expr-old-32.25a {math functions in expressions} {
+ expr abs(0x8000000000000000)
+} [expr 1<<63]
test expr-old-32.25b {math functions in expressions} {
expr abs(0x80000000)
@@ -813,12 +813,12 @@ test expr-old-32.31 {math functions in expressions} {
test expr-old-32.32 {math functions in expressions} {
expr int(-1.6)
} {-1}
-test expr-old-32.33 {math functions in expressions} knownBug {
- list [catch {expr int(1e60)} msg] $msg
-} {1 {integer value too large to represent}}
-test expr-old-32.34 {math functions in expressions} knownBug {
- list [catch {expr int(-1e60)} msg] $msg
-} {1 {integer value too large to represent}}
+test expr-old-32.33 {math functions in expressions} {
+ expr int(1e60)
+} 0
+test expr-old-32.34 {math functions in expressions} {
+ expr int(-1e60)
+} 0
test expr-old-32.35 {math functions in expressions} {
expr round(1.49)
} {1}
@@ -831,12 +831,12 @@ test expr-old-32.37 {math functions in expressions} {
test expr-old-32.38 {math functions in expressions} {
expr round(-1.51)
} {-2}
-test expr-old-32.39 {math functions in expressions} knownBug {
- list [catch {expr round(1e60)} msg] $msg
-} {1 {integer value too large to represent}}
-test expr-old-32.40 {math functions in expressions} knownBug {
- list [catch {expr round(-1e60)} msg] $msg
-} {1 {integer value too large to represent}}
+test expr-old-32.39 {math functions in expressions} {
+ expr round(1e60)
+} 999999999999999949387135297074018866963645011013410073083904
+test expr-old-32.40 {math functions in expressions} {
+ expr round(-1e60)
+} -999999999999999949387135297074018866963645011013410073083904
test expr-old-32.41 {math functions in expressions} {
list [catch {expr pow(1.0 + 3.0 - 2, .8 * 5)} msg] $msg
} {0 16.0}
@@ -858,12 +858,12 @@ test expr-old-32.46 {math functions in expressions} -body {
test expr-old-32.47 {math functions in expressions} -body {
list [catch {expr srand()} msg] $msg
} -match glob -result {1 {too few arguments for math function*}}
-test expr-old-32.48 {math functions in expressions} knownBug {
- list [catch {expr srand(3.79)} msg] $msg
-} {1 {can't use floating-point value as argument to srand}}
-test expr-old-32.49 {math functions in expressions} knownBug {
- list [catch {expr srand("")} msg] $msg
-} {1 {argument to math function didn't have numeric value}}
+test expr-old-32.48 {math functions in expressions} -body {
+ expr srand(3.79)
+} -returnCodes error -match glob -result *
+test expr-old-32.49 {math functions in expressions} -body {
+ expr srand("")
+} -returnCodes error -match glob -result *
test expr-old-32.50 {math functions in expressions} {
set result [expr round(srand(12345) * 1000)]
for {set i 0} {$i < 10} {incr i} {
@@ -871,9 +871,9 @@ test expr-old-32.50 {math functions in expressions} {
}
set result
} {97 834 948 36 12 51 766 585 914 784 333}
-test expr-old-32.51 {math functions in expressions} knownBug {
- list [catch {expr {srand([lindex "6ty" 0])}} msg] $msg
-} {1 {argument to math function didn't have numeric value}}
+test expr-old-32.51 {math functions in expressions} -body {
+ expr {srand([lindex "6ty" 0])}
+} -returnCodes error -match glob -result *
test expr-old-32.52 {math functions in expressions} {
expr {srand(int(1<<37)) < 1}
} {1}
@@ -936,24 +936,24 @@ test expr-old-34.12a {errors in math functions} !ieeeFloatingPoint {
test expr-old-34.12b {errors in math functions} ieeeFloatingPoint {
list [catch {expr -14.0*exp(100000)} msg] $msg
} {0 -Inf}
-test expr-old-34.13 {errors in math functions} knownBug {
- list [catch {expr int(1.0e30)} msg] $msg $errorCode
-} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
-test expr-old-34.14 {errors in math functions} knownBug {
- list [catch {expr int(-1.0e30)} msg] $msg $errorCode
-} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
-test expr-old-34.15 {errors in math functions} knownBug {
- list [catch {expr round(1.0e30)} msg] $msg $errorCode
-} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
-test expr-old-34.16 {errors in math functions} knownBug {
- list [catch {expr round(-1.0e30)} msg] $msg $errorCode
-} {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}}
+test expr-old-34.13 {errors in math functions} {
+ expr wide(1.0e30)
+} 5076964154930102272
+test expr-old-34.14 {errors in math functions} {
+ expr wide(-1.0e30)
+} -5076964154930102272
+test expr-old-34.15 {errors in math functions} {
+ expr round(1.0e30)
+} 1000000000000000019884624838656
+test expr-old-34.16 {errors in math functions} {
+ expr round(-1.0e30)
+} -1000000000000000019884624838656
test expr-old-34.17 {errors in math functions} -constraints testmathfunctions \
-body {
list [catch {expr T1(4)} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
-test expr-old-36.1 {ExprLooksLikeInt procedure} -constraints knownBug -body {
+test expr-old-36.1 {ExprLooksLikeInt procedure} -body {
expr 0289
} -returnCodes error -match glob -result {*invalid octal number*}
test expr-old-36.2 {ExprLooksLikeInt procedure} {
@@ -989,11 +989,11 @@ test expr-old-36.10 {ExprLooksLikeInt procedure} -body {
} -returnCodes error -match glob -result {syntax error in expression "78e"*}
# test for [Bug #542588]
-test expr-old-36.11 {ExprLooksLikeInt procedure} knownBug {
+test expr-old-36.11 {ExprLooksLikeInt procedure} {
# define a "too large integer"; this one works also for 64bit arith
set x 665802003400000000000000
- list [catch {expr {$x+1}} msg] $msg
-} {1 {can't use integer value too large to represent as operand of "+"}}
+ expr {$x+1}
+} 665802003400000000000001
# tests for [Bug #587140]
test expr-old-36.12 {ExprLooksLikeInt procedure} {
@@ -1004,18 +1004,18 @@ test expr-old-36.13 {ExprLooksLikeInt procedure} {
set x " +"
list [catch {expr {$x+1}} msg] $msg
} {1 {can't use non-numeric string as operand of "+"}}
-test expr-old-36.14 {ExprLooksLikeInt procedure} knownBug {
+test expr-old-36.14 {ExprLooksLikeInt procedure} {
set x "123456789012345678901234567890 "
- list [catch {expr {$x+1}} msg] $msg
-} {1 {can't use integer value too large to represent as operand of "+"}}
+ expr {$x+1}
+} 123456789012345678901234567891
test expr-old-36.15 {ExprLooksLikeInt procedure} {
set x "099 "
list [catch {expr {$x+1}} msg] $msg
} {1 {can't use invalid octal number as operand of "+"}}
-test expr-old-36.16 {ExprLooksLikeInt procedure} knownBug {
+test expr-old-36.16 {ExprLooksLikeInt procedure} {
set x " 0xffffffffffffffffffffffffffffffffffffff "
- list [catch {expr {$x+1}} msg] $msg
-} {1 {can't use integer value too large to represent as operand of "+"}}
+ expr {$x+1}
+} [expr 0x100000000000000000000000000000000000000]
testConstraint testexprlong [llength [info commands testexprlong]]
testConstraint testexprdouble [llength [info commands testexprdouble]]
@@ -1118,7 +1118,7 @@ test expr-old-37.24 {Tcl_ExprDouble handles overflows that look like int} \
testexprdouble 17976931348623165[string repeat 0 292]
} {This is a result: Inf}
test expr-old-37.25 {Tcl_ExprDouble and NaN} \
- {ieeeFloatingPoint testexprdouble knownBug} {
+ {ieeeFloatingPoint testexprdouble} {
list [catch {testexprdouble 0.0/0.0} result] $result
} {1 {floating point value is Not a Number}}
@@ -1165,9 +1165,9 @@ test expr-old-40.3 {min math function} -body {
test expr-old-40.4 {min math function} -body {
expr {min(wide(-1) << 30, 4.5, -10)}
} -result [expr {wide(-1) << 30}]
-test expr-old-40.5 {min math function} -constraints knownBug -body {
- list [catch {expr {min("a", 0)}} msg] $msg
-} -result {1 {argument to math function didn't have numeric value}}
+test expr-old-40.5 {min math function} -body {
+ expr {min("a", 0)}
+} -returnCodes error -match glob -result *
test expr-old-40.6 {min math function} -body {
expr {min(300, "0xFF")}
} -result 255
@@ -1184,9 +1184,9 @@ test expr-old-41.3 {max math function} -body {
test expr-old-41.4 {max math function} -body {
expr {max(wide(1) << 30, 4.5, -10)}
} -result [expr {wide(1) << 30}]
-test expr-old-41.5 {max math function} -constraints knownBug -body {
- list [catch {expr {max("a", 0)}} msg] $msg
-} -result {1 {argument to math function didn't have numeric value}}
+test expr-old-41.5 {max math function} -body {
+ expr {max("a", 0)}
+} -returnCodes error -match glob -result *
test expr-old-41.6 {max math function} -body {
expr {max(200, "0xFF")}
} -result 255