diff options
author | dgp <dgp@users.sourceforge.net> | 2005-07-27 18:12:24 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-07-27 18:12:24 (GMT) |
commit | e5c93914d5de3897143d17c46b6e4faf138db73c (patch) | |
tree | ef92791aebce3cc91ebd625875211b7595c68aed | |
parent | 2430f497f1715d87f7c9b5f9374320566776fb6f (diff) | |
download | tcl-e5c93914d5de3897143d17c46b6e4faf138db73c.zip tcl-e5c93914d5de3897143d17c46b6e4faf138db73c.tar.gz tcl-e5c93914d5de3897143d17c46b6e4faf138db73c.tar.bz2 |
* tests/expr.test: Consolidated equivalent constraints into
* tests/fileName.test: single definitions and (more precise) names:
* tests/get.test: longis32bit, 32bit, !intsAre64bit => longIs32bit * tests/listObj.test: empty => emptyTest; winOnly => win
* tests/obj.test: intsAre64bit => longIs64bit
Also updated some "nonPortable" tests to use constraints that mark
precisely what about them isn't portable, so the tests can run where
they work.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | tests/expr.test | 361 | ||||
-rw-r--r-- | tests/fileName.test | 4 | ||||
-rw-r--r-- | tests/get.test | 22 | ||||
-rw-r--r-- | tests/listObj.test | 4 | ||||
-rw-r--r-- | tests/obj.test | 18 |
6 files changed, 208 insertions, 207 deletions
@@ -1,5 +1,11 @@ 2005-07-27 Don Porter <dgp@users.sourceforge.net> + * tests/expr.test: Consolidated equivalent constraints into + * tests/fileName.test: single definitions and (more precise) names: + * tests/get.test: longis32bit, 32bit, !intsAre64bit => longIs32bit + * tests/listObj.test: empty => emptyTest; winOnly => win + * tests/obj.test: intsAre64bit => longIs64bit + * library/init.tcl ([unknown]): Corrected return code handling in the portions of [unknown] that expand incomplete commands during interactive operations. [Bug 1214462]. diff --git a/tests/expr.test b/tests/expr.test index 781eb8e..be60bcb 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.35 2005/07/09 00:27:33 mdejong Exp $ +# RCS: @(#) $Id: expr.test,v 1.36 2005/07/27 18:12:36 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -24,54 +24,10 @@ testConstraint testmathfunctions [expr { # Determine if "long int" type is a 32 bit number and if the wide # type is a 64 bit number on this machine. -testConstraint longis32bit [expr {(0x7FFFFFFF + 1) eq (0 - 0x80000000)}] +testConstraint longIs32bit [expr {int(0x80000000) < 0}] +testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}] testConstraint wideis64bit [expr {" 0x8000000000000000 " == "0x8000000000000000"}] -# procedures used below - -proc put_hello_char {c} { - global a - append a [format %c $c] - return $c -} -proc hello_world {} { - global a - set a "" - set L1 [set l0 [set h_1 [set q 0]]] - for {put_hello_char [expr [put_hello_char [expr [set h 7]*10+2]]+29]} {$l0?[put_hello_char $l0] - :!$h_1} {put_hello_char $ll;expr {$L1==2?[set ll [expr 32+0-0+[set bar 0]]]:0}} {expr {[incr L1]==[expr 1+([string length "abc"]-[string length "abc"])] - ?[set ll [set l0 [expr 54<<1]]]:$ll==108&&$L1<3? - [incr ll [expr 1|1<<1]; set ll $ll; set ll $ll; set ll $ll; set ll $ll; set l0 [expr ([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])]; set l0; set l0 $l0; set l0; set l0]:$L1==4&&$ll==32?[set ll [expr 19+$h1+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])+[set foo [expr ([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])]]]] - :[set q [expr $q-$h1+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])]]};expr {$L1==5?[incr ll -8; set ll $ll; set ll]:$q&&$h1&&1};expr {$L1==4+2 - ?[incr ll 3]:[expr ([string length "abc"]-[string length "abc"])+1]};expr {$ll==($h<<4)+2+0&&$L1!=6?[incr ll -6]:[set h1 [expr 100+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])]]} - expr {$L1!=1<<3?[incr q [expr ([string length "abc"]-[string length "abc"])-1]]:[set h_1 [set ll $h1]]} - } - set a -} - -proc 12days {a b c} { - global xxx - expr {1<$a?[expr {$a<3?[12days -79 -13 [string range $c [12days -87 \ - [expr 1-$b] [string range $c [12days -86 0 [string range $c 1 end]] \ - end]] end]]:1};expr {$a<$b?[12days [expr $a+1] $b $c]:3};expr {[12days \ - -94 [expr $a-27] $c]&&$a==2?$b<13?[12days 2 [expr $b+1] "%s %d %d\n"]:9 - :16}]:$a<0?$a<-72?[12days $b $a "@n'+,#'/*\{\}w+/w#cdnr/+,\{\}r/*de\}+,/*\{*+,/w\{%+,/w#q#n+,/#\{l+,/n\{n+,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,\}\{w+K w'K:'+\}e#';dq#'l q#'+d'K#!/+k#;q#'r\}eKK#\}w'r\}eKK\{nl\]'/#;#q#n')\{)#\}w')\{)\{nl\]'/+#n';d\}rw' i;# )\{nl\]!/n\{n#'; r\{#w'r nc\{nl\]'/#\{l,+'K \{rw' iK\{;\[\{nl\]'/w#q#n'wk nw' iwk\{KK\{nl\]!/w\{%'l##w#' i; :\{nl\]'/*\{q#'ld;r'\}\{nlwb!/*de\}'c ;;\{nl'-\{\}rw\]'/+,\}##'*\}#nc,',#nw\]'/+kd'+e\}+;#'rdq#w! nr'/ ') \}+\}\{rl#'\{n' ')# \}'+\}##(!!/"] - :$a<-50?[string compare [format %c $b] [string index $c 0]]==0?[append \ - xxx [string index $c 31];scan [string index $c 31] %c x;set x] - :[12days -65 $b [string range $c 1 end]]:[12days [expr ([string compare \ - [string index $c 0] "/"]==0)+$a] $b [string range $c 1 end]]:0<$a - ?[12days 2 2 "%s"]:[string compare [string index $c 0] "/"]==0|| - [12days 0 [12days -61 [scan [string index $c 0] %c x; set x] \ - "!ek;dc i@bK'(q)-\[w\]*%n+r3#l,\{\}:\nuwloca-O;m .vpbks,fxntdCeghiry"] \ - [string range $c 1 end]]} -} -proc do_twelve_days {} { - global xxx - set xxx "" - 12days 1 1 1 - string length $xxx -} - # Big test for correct ordering of data in [expr] proc testIEEE {} { @@ -128,7 +84,54 @@ proc testIEEE {} { } } } -::tcltest::testConstraint ieeeFloatingPoint [testIEEE] + +testConstraint ieeeFloatingPoint [testIEEE] +# procedures used below + +proc put_hello_char {c} { + global a + append a [format %c $c] + return $c +} +proc hello_world {} { + global a + set a "" + set L1 [set l0 [set h_1 [set q 0]]] + for {put_hello_char [expr [put_hello_char [expr [set h 7]*10+2]]+29]} {$l0?[put_hello_char $l0] + :!$h_1} {put_hello_char $ll;expr {$L1==2?[set ll [expr 32+0-0+[set bar 0]]]:0}} {expr {[incr L1]==[expr 1+([string length "abc"]-[string length "abc"])] + ?[set ll [set l0 [expr 54<<1]]]:$ll==108&&$L1<3? + [incr ll [expr 1|1<<1]; set ll $ll; set ll $ll; set ll $ll; set ll $ll; set l0 [expr ([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])]; set l0; set l0 $l0; set l0; set l0]:$L1==4&&$ll==32?[set ll [expr 19+$h1+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])+[set foo [expr ([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])+([string length "abc"]-[string length "abc"])]]]] + :[set q [expr $q-$h1+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])]]};expr {$L1==5?[incr ll -8; set ll $ll; set ll]:$q&&$h1&&1};expr {$L1==4+2 + ?[incr ll 3]:[expr ([string length "abc"]-[string length "abc"])+1]};expr {$ll==($h<<4)+2+0&&$L1!=6?[incr ll -6]:[set h1 [expr 100+([string length "abc"]-[string length "abc"])-([string length "abc"]-[string length "abc"])]]} + expr {$L1!=1<<3?[incr q [expr ([string length "abc"]-[string length "abc"])-1]]:[set h_1 [set ll $h1]]} + } + set a +} + +proc 12days {a b c} { + global xxx + expr {1<$a?[expr {$a<3?[12days -79 -13 [string range $c [12days -87 \ + [expr 1-$b] [string range $c [12days -86 0 [string range $c 1 end]] \ + end]] end]]:1};expr {$a<$b?[12days [expr $a+1] $b $c]:3};expr {[12days \ + -94 [expr $a-27] $c]&&$a==2?$b<13?[12days 2 [expr $b+1] "%s %d %d\n"]:9 + :16}]:$a<0?$a<-72?[12days $b $a "@n'+,#'/*\{\}w+/w#cdnr/+,\{\}r/*de\}+,/*\{*+,/w\{%+,/w#q#n+,/#\{l+,/n\{n+,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,\}\{w+K w'K:'+\}e#';dq#'l q#'+d'K#!/+k#;q#'r\}eKK#\}w'r\}eKK\{nl\]'/#;#q#n')\{)#\}w')\{)\{nl\]'/+#n';d\}rw' i;# )\{nl\]!/n\{n#'; r\{#w'r nc\{nl\]'/#\{l,+'K \{rw' iK\{;\[\{nl\]'/w#q#n'wk nw' iwk\{KK\{nl\]!/w\{%'l##w#' i; :\{nl\]'/*\{q#'ld;r'\}\{nlwb!/*de\}'c ;;\{nl'-\{\}rw\]'/+,\}##'*\}#nc,',#nw\]'/+kd'+e\}+;#'rdq#w! nr'/ ') \}+\}\{rl#'\{n' ')# \}'+\}##(!!/"] + :$a<-50?[string compare [format %c $b] [string index $c 0]]==0?[append \ + xxx [string index $c 31];scan [string index $c 31] %c x;set x] + :[12days -65 $b [string range $c 1 end]]:[12days [expr ([string compare \ + [string index $c 0] "/"]==0)+$a] $b [string range $c 1 end]]:0<$a + ?[12days 2 2 "%s"]:[string compare [string index $c 0] "/"]==0|| + [12days 0 [12days -61 [scan [string index $c 0] %c x; set x] \ + "!ek;dc i@bK'(q)-\[w\]*%n+r3#l,\{\}:\nuwloca-O;m .vpbks,fxntdCeghiry"] \ + [string range $c 1 end]]} +} +proc do_twelve_days {} { + global xxx + set xxx "" + 12days 1 1 1 + set result [string length $xxx] + unset xxx + return $result +} # start of tests @@ -222,16 +225,13 @@ test expr-3.6 {CompileCondExpr: error compiling false arm} { catch {expr 2>3?44:2***3} msg set msg } {syntax error in expression "2>3?44:2***3": unexpected operator *} -test expr-3.7 {CompileCondExpr: long arms & nested cond exprs} {unix nonPortable} { - puts "Note: doing test expr-3.7 which can take several minutes to run" +test expr-3.7 {CompileCondExpr: long arms & nested cond exprs} { hello_world } {Hello world} catch {unset xxx} -test expr-3.8 {CompileCondExpr: long arms & nested cond exprs} {unix nonPortable} { - puts "Note: doing test expr-3.8 which can take several minutes to run" +test expr-3.8 {CompileCondExpr: long arms & nested cond exprs} { do_twelve_days } 2358 -catch {unset xxx} test expr-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1 test expr-4.2 {CompileLorExpr: error in land expr} -body { @@ -441,18 +441,14 @@ test expr-9.2 {CompileRelationalExpr: just shift expr} {expr 0xff>>2} 63 test expr-9.3 {CompileRelationalExpr: just shift expr} {expr -1>>2} -1 test expr-9.4 {CompileRelationalExpr: just shift expr} {expr {1<<3}} 8 -# The following test is different for 32-bit versus 64-bit -# architectures because LONG_MIN is different - -if {0x80000000 > 0} { - test expr-9.5a {CompileRelationalExpr: shift expr producing LONG_MIN} {nonPortable} { - expr {1<<63} - } -9223372036854775808 -} else { - test expr-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} {nonPortable} { - expr {1<<31} - } -2147483648 -} +test expr-9.5a {CompileRelationalExpr: shift expr producing LONG_MIN} longIs64bit { + expr {1<<63} +} -9223372036854775808 + +test expr-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} longIs32bit { + expr {1<<31} +} -2147483648 + test expr-9.6 {CompileRelationalExpr: error in shift expr} -body { catch {expr x>>3} msg set msg @@ -934,33 +930,30 @@ test expr-21.22 {non-numeric boolean variables} { } {1 {can't use empty string as operand of "!"}} # Test for non-numeric float handling. -# -# These are non-portable because strtod()-support for "Inf" and "NaN" -# is so wildly variable. This sucks... -test expr-22.1 {non-numeric floats} nonPortable { +test expr-22.1 {non-numeric floats} { list [catch {expr {NaN + 1}} msg] $msg } {1 {can't use non-numeric floating-point value as operand of "+"}} -test expr-22.2 {non-numeric floats} nonPortable { +test expr-22.2 {non-numeric floats} !ieeeFloatingPoint { list [catch {expr {Inf + 1}} msg] $msg } {1 {can't use infinite floating-point value as operand of "+"}} -test expr-22.3 {non-numeric floats} nonPortable { +test expr-22.3 {non-numeric floats} { set nan NaN list [catch {expr {$nan + 1}} msg] $msg } {1 {can't use non-numeric floating-point value as operand of "+"}} -test expr-22.4 {non-numeric floats} nonPortable { +test expr-22.4 {non-numeric floats} !ieeeFloatingPoint { set inf Inf list [catch {expr {$inf + 1}} msg] $msg } {1 {can't use infinite floating-point value as operand of "+"}} -test expr-22.5 {non-numeric floats} nonPortable { +test expr-22.5 {non-numeric floats} { list [catch {expr NaN} msg] $msg } {1 {domain error: argument not in valid range}} -test expr-22.6 {non-numeric floats} nonPortable { +test expr-22.6 {non-numeric floats} !ieeeFloatingPoint { list [catch {expr Inf} msg] $msg } {1 {floating-point value too large to represent}} -test expr-22.7 {non-numeric floats} nonPortable { +test expr-22.7 {non-numeric floats} { list [catch {expr {1 / NaN}} msg] $msg } {1 {can't use non-numeric floating-point value as operand of "/"}} -test expr-22.8 {non-numeric floats} nonPortable { +test expr-22.8 {non-numeric floats} !ieeeFloatingPoint { list [catch {expr {1 / Inf}} msg] $msg } {1 {can't use infinite floating-point value as operand of "/"}} # Make sure [Bug 761471] stays fixed. @@ -1031,8 +1024,8 @@ test expr-24.1 {expr edge cases; shifting} {expr int(5)>>32} 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)>>32} 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)<<32} 0 -test expr-24.6 {expr edge cases; shifting} nonPortable {expr int(5)<<63} 0 +test expr-24.5 {expr edge cases; shifting} longIs32bit {expr int(5)<<32} 0 +test expr-24.6 {expr edge cases; shifting} longIs32bit {expr int(5)<<63} 0 test expr-24.7 {expr edge cases; shifting} {expr wide(5)<<32} 21474836480 test expr-24.8 {expr edge cases; shifting} {expr wide(10)<<63} 0 test expr-24.9 {expr edge cases; shifting} {expr 5>>32} 0 @@ -5416,7 +5409,7 @@ test expr-32.2 {expr div basics} { -3 -2 -1 -1 -1 \ ] -test expr-33.1 {parse largest long value} {longis32bit} { +test expr-33.1 {parse largest long value} {longIs32bit} { set max_long_str 2147483647 set max_long_hex "0x7FFFFFFF " @@ -5434,7 +5427,7 @@ test expr-33.1 {parse largest long value} {longis32bit} { } {2147483647 2147483647 2147483647 2147483647 1 1} -test expr-33.2 {parse smallest long value} {longis32bit} { +test expr-33.2 {parse smallest long value} {longIs32bit} { set min_long_str -2147483648 set min_long_hex "-0x80000000 " @@ -5498,370 +5491,370 @@ test expr-33.4 {parse smallest wide value} {wideis64bit} { set min -2147483648 set max 2147483647 -test expr-34.1 {expr edge cases} {longis32bit} { +test expr-34.1 {expr edge cases} {longIs32bit} { expr {$min / $min} } {1} -test expr-34.2 {expr edge cases} {longis32bit} { +test expr-34.2 {expr edge cases} {longIs32bit} { expr {$min % $min} } {0} -test expr-34.3 {expr edge cases} {longis32bit} { +test expr-34.3 {expr edge cases} {longIs32bit} { expr {$min / ($min + 1)} } {1} -test expr-34.4 {expr edge cases} {longis32bit} { +test expr-34.4 {expr edge cases} {longIs32bit} { expr {$min % ($min + 1)} } {-1} -test expr-34.5 {expr edge cases} {longis32bit} { +test expr-34.5 {expr edge cases} {longIs32bit} { expr {$min / ($min + 2)} } {1} -test expr-34.6 {expr edge cases} {longis32bit} { +test expr-34.6 {expr edge cases} {longIs32bit} { expr {$min % ($min + 2)} } {-2} -test expr-34.7 {expr edge cases} {longis32bit} { +test expr-34.7 {expr edge cases} {longIs32bit} { expr {$min / ($min + 3)} } {1} -test expr-34.8 {expr edge cases} {longis32bit} { +test expr-34.8 {expr edge cases} {longIs32bit} { expr {$min % ($min + 3)} } {-3} -test expr-34.9 {expr edge cases} {longis32bit} { +test expr-34.9 {expr edge cases} {longIs32bit} { expr {$min / -3} } {715827882} -test expr-34.10 {expr edge cases} {longis32bit} { +test expr-34.10 {expr edge cases} {longIs32bit} { expr {$min % -3} } {-2} -test expr-34.11 {expr edge cases} {longis32bit} { +test expr-34.11 {expr edge cases} {longIs32bit} { expr {$min / -2} } {1073741824} -test expr-34.12 {expr edge cases} {longis32bit} { +test expr-34.12 {expr edge cases} {longIs32bit} { expr {$min % -2} } {0} -test expr-34.13 {expr edge cases} {longis32bit} { +test expr-34.13 {expr edge cases} {longIs32bit} { expr {$min / -1} } {-2147483648} -test expr-34.14 {expr edge cases} {longis32bit} { +test expr-34.14 {expr edge cases} {longIs32bit} { expr {$min % -1} } {0} -test expr-34.15 {expr edge cases} {longis32bit} { +test expr-34.15 {expr edge cases} {longIs32bit} { expr {$min * -1} } $min -test expr-34.16 {expr edge cases} {longis32bit} { +test expr-34.16 {expr edge cases} {longIs32bit} { expr {-$min} } $min -test expr-34.17 {expr edge cases} {longis32bit} { +test expr-34.17 {expr edge cases} {longIs32bit} { expr {$min / 1} } $min -test expr-34.18 {expr edge cases} {longis32bit} { +test expr-34.18 {expr edge cases} {longIs32bit} { expr {$min % 1} } {0} -test expr-34.19 {expr edge cases} {longis32bit} { +test expr-34.19 {expr edge cases} {longIs32bit} { expr {$min / 2} } {-1073741824} -test expr-34.20 {expr edge cases} {longis32bit} { +test expr-34.20 {expr edge cases} {longIs32bit} { expr {$min % 2} } {0} -test expr-34.21 {expr edge cases} {longis32bit} { +test expr-34.21 {expr edge cases} {longIs32bit} { expr {$min / 3} } {-715827883} -test expr-34.22 {expr edge cases} {longis32bit} { +test expr-34.22 {expr edge cases} {longIs32bit} { expr {$min % 3} } {1} -test expr-34.23 {expr edge cases} {longis32bit} { +test expr-34.23 {expr edge cases} {longIs32bit} { expr {$min / ($max - 3)} } {-2} -test expr-34.24 {expr edge cases} {longis32bit} { +test expr-34.24 {expr edge cases} {longIs32bit} { expr {$min % ($max - 3)} } {2147483640} -test expr-34.25 {expr edge cases} {longis32bit} { +test expr-34.25 {expr edge cases} {longIs32bit} { expr {$min / ($max - 2)} } {-2} -test expr-34.26 {expr edge cases} {longis32bit} { +test expr-34.26 {expr edge cases} {longIs32bit} { expr {$min % ($max - 2)} } {2147483642} -test expr-34.27 {expr edge cases} {longis32bit} { +test expr-34.27 {expr edge cases} {longIs32bit} { expr {$min / ($max - 1)} } {-2} -test expr-34.28 {expr edge cases} {longis32bit} { +test expr-34.28 {expr edge cases} {longIs32bit} { expr {$min % ($max - 1)} } {2147483644} -test expr-34.29 {expr edge cases} {longis32bit} { +test expr-34.29 {expr edge cases} {longIs32bit} { expr {$min / $max} } {-2} -test expr-34.30 {expr edge cases} {longis32bit} { +test expr-34.30 {expr edge cases} {longIs32bit} { expr {$min % $max} } {2147483646} -test expr-34.31 {expr edge cases} {longis32bit} { +test expr-34.31 {expr edge cases} {longIs32bit} { expr {$max / $max} } {1} -test expr-34.32 {expr edge cases} {longis32bit} { +test expr-34.32 {expr edge cases} {longIs32bit} { expr {$max % $max} } {0} -test expr-34.33 {expr edge cases} {longis32bit} { +test expr-34.33 {expr edge cases} {longIs32bit} { expr {$max / ($max - 1)} } {1} -test expr-34.34 {expr edge cases} {longis32bit} { +test expr-34.34 {expr edge cases} {longIs32bit} { expr {$max % ($max - 1)} } {1} -test expr-34.35 {expr edge cases} {longis32bit} { +test expr-34.35 {expr edge cases} {longIs32bit} { expr {$max / ($max - 2)} } {1} -test expr-34.36 {expr edge cases} {longis32bit} { +test expr-34.36 {expr edge cases} {longIs32bit} { expr {$max % ($max - 2)} } {2} -test expr-34.37 {expr edge cases} {longis32bit} { +test expr-34.37 {expr edge cases} {longIs32bit} { expr {$max / ($max - 3)} } {1} -test expr-34.38 {expr edge cases} {longis32bit} { +test expr-34.38 {expr edge cases} {longIs32bit} { expr {$max % ($max - 3)} } {3} -test expr-34.39 {expr edge cases} {longis32bit} { +test expr-34.39 {expr edge cases} {longIs32bit} { expr {$max / 3} } {715827882} -test expr-34.40 {expr edge cases} {longis32bit} { +test expr-34.40 {expr edge cases} {longIs32bit} { expr {$max % 3} } {1} -test expr-34.41 {expr edge cases} {longis32bit} { +test expr-34.41 {expr edge cases} {longIs32bit} { expr {$max / 2} } {1073741823} -test expr-34.42 {expr edge cases} {longis32bit} { +test expr-34.42 {expr edge cases} {longIs32bit} { expr {$max % 2} } {1} -test expr-34.43 {expr edge cases} {longis32bit} { +test expr-34.43 {expr edge cases} {longIs32bit} { expr {$max / 1} } $max -test expr-34.44 {expr edge cases} {longis32bit} { +test expr-34.44 {expr edge cases} {longIs32bit} { expr {$max % 1} } {0} -test expr-34.45 {expr edge cases} {longis32bit} { +test expr-34.45 {expr edge cases} {longIs32bit} { expr {$max / -1} } "-$max" -test expr-34.46 {expr edge cases} {longis32bit} { +test expr-34.46 {expr edge cases} {longIs32bit} { expr {$max % -1} } {0} -test expr-34.47 {expr edge cases} {longis32bit} { +test expr-34.47 {expr edge cases} {longIs32bit} { expr {$max / -2} } {-1073741824} -test expr-34.48 {expr edge cases} {longis32bit} { +test expr-34.48 {expr edge cases} {longIs32bit} { expr {$max % -2} } {-1} -test expr-34.49 {expr edge cases} {longis32bit} { +test expr-34.49 {expr edge cases} {longIs32bit} { expr {$max / -3} } {-715827883} -test expr-34.50 {expr edge cases} {longis32bit} { +test expr-34.50 {expr edge cases} {longIs32bit} { expr {$max % -3} } {-2} -test expr-34.51 {expr edge cases} {longis32bit} { +test expr-34.51 {expr edge cases} {longIs32bit} { expr {$max / ($min + 3)} } {-2} -test expr-34.52 {expr edge cases} {longis32bit} { +test expr-34.52 {expr edge cases} {longIs32bit} { expr {$max % ($min + 3)} } {-2147483643} -test expr-34.53 {expr edge cases} {longis32bit} { +test expr-34.53 {expr edge cases} {longIs32bit} { expr {$max / ($min + 2)} } {-2} -test expr-34.54 {expr edge cases} {longis32bit} { +test expr-34.54 {expr edge cases} {longIs32bit} { expr {$max % ($min + 2)} } {-2147483645} -test expr-34.55 {expr edge cases} {longis32bit} { +test expr-34.55 {expr edge cases} {longIs32bit} { expr {$max / ($min + 1)} } {-1} -test expr-34.56 {expr edge cases} {longis32bit} { +test expr-34.56 {expr edge cases} {longIs32bit} { expr {$max % ($min + 1)} } {0} -test expr-34.57 {expr edge cases} {longis32bit} { +test expr-34.57 {expr edge cases} {longIs32bit} { expr {$max / $min} } {-1} -test expr-34.58 {expr edge cases} {longis32bit} { +test expr-34.58 {expr edge cases} {longIs32bit} { expr {$max % $min} } {-1} -test expr-34.59 {expr edge cases} {longis32bit} { +test expr-34.59 {expr edge cases} {longIs32bit} { expr {($min + 1) / ($max - 1)} } {-2} -test expr-34.60 {expr edge cases} {longis32bit} { +test expr-34.60 {expr edge cases} {longIs32bit} { expr {($min + 1) % ($max - 1)} } {2147483645} -test expr-34.61 {expr edge cases} {longis32bit} { +test expr-34.61 {expr edge cases} {longIs32bit} { expr {($max - 1) / ($min + 1)} } {-1} -test expr-34.62 {expr edge cases} {longis32bit} { +test expr-34.62 {expr edge cases} {longIs32bit} { expr {($max - 1) % ($min + 1)} } {-1} -test expr-34.63 {expr edge cases} {longis32bit} { +test expr-34.63 {expr edge cases} {longIs32bit} { expr {($max - 1) / $min} } {-1} -test expr-34.64 {expr edge cases} {longis32bit} { +test expr-34.64 {expr edge cases} {longIs32bit} { expr {($max - 1) % $min} } {-2} -test expr-34.65 {expr edge cases} {longis32bit} { +test expr-34.65 {expr edge cases} {longIs32bit} { expr {($max - 2) / $min} } {-1} -test expr-34.66 {expr edge cases} {longis32bit} { +test expr-34.66 {expr edge cases} {longIs32bit} { expr {($max - 2) % $min} } {-3} -test expr-34.67 {expr edge cases} {longis32bit} { +test expr-34.67 {expr edge cases} {longIs32bit} { expr {($max - 3) / $min} } {-1} -test expr-34.68 {expr edge cases} {longis32bit} { +test expr-34.68 {expr edge cases} {longIs32bit} { expr {($max - 3) % $min} } {-4} -test expr-34.69 {expr edge cases} {longis32bit} { +test expr-34.69 {expr edge cases} {longIs32bit} { expr {-3 / $min} } {0} -test expr-34.70 {expr edge cases} {longis32bit} { +test expr-34.70 {expr edge cases} {longIs32bit} { expr {-3 % $min} } {-3} -test expr-34.71 {expr edge cases} {longis32bit} { +test expr-34.71 {expr edge cases} {longIs32bit} { expr {-2 / $min} } {0} -test expr-34.72 {expr edge cases} {longis32bit} { +test expr-34.72 {expr edge cases} {longIs32bit} { expr {-2 % $min} } {-2} -test expr-34.73 {expr edge cases} {longis32bit} { +test expr-34.73 {expr edge cases} {longIs32bit} { expr {-1 / $min} } {0} -test expr-34.74 {expr edge cases} {longis32bit} { +test expr-34.74 {expr edge cases} {longIs32bit} { expr {-1 % $min} } {-1} -test expr-34.75 {expr edge cases} {longis32bit} { +test expr-34.75 {expr edge cases} {longIs32bit} { expr {0 / $min} } {0} -test expr-34.76 {expr edge cases} {longis32bit} { +test expr-34.76 {expr edge cases} {longIs32bit} { expr {0 % $min} } {0} -test expr-34.77 {expr edge cases} {longis32bit} { +test expr-34.77 {expr edge cases} {longIs32bit} { expr {0 / ($min + 1)} } {0} -test expr-34.78 {expr edge cases} {longis32bit} { +test expr-34.78 {expr edge cases} {longIs32bit} { expr {0 % ($min + 1)} } {0} -test expr-34.79 {expr edge cases} {longis32bit} { +test expr-34.79 {expr edge cases} {longIs32bit} { expr {1 / $min} } {-1} -test expr-34.80 {expr edge cases} {longis32bit} { +test expr-34.80 {expr edge cases} {longIs32bit} { expr {1 % $min} } {-2147483647} -test expr-34.81 {expr edge cases} {longis32bit} { +test expr-34.81 {expr edge cases} {longIs32bit} { expr {1 / ($min + 1)} } {-1} -test expr-34.82 {expr edge cases} {longis32bit} { +test expr-34.82 {expr edge cases} {longIs32bit} { expr {1 % ($min + 1)} } {-2147483646} -test expr-34.83 {expr edge cases} {longis32bit} { +test expr-34.83 {expr edge cases} {longIs32bit} { expr {2 / $min} } {-1} -test expr-34.84 {expr edge cases} {longis32bit} { +test expr-34.84 {expr edge cases} {longIs32bit} { expr {2 % $min} } {-2147483646} -test expr-34.85 {expr edge cases} {longis32bit} { +test expr-34.85 {expr edge cases} {longIs32bit} { expr {2 / ($min + 1)} } {-1} -test expr-34.86 {expr edge cases} {longis32bit} { +test expr-34.86 {expr edge cases} {longIs32bit} { expr {2 % ($min + 1)} } {-2147483645} -test expr-34.87 {expr edge cases} {longis32bit} { +test expr-34.87 {expr edge cases} {longIs32bit} { expr {3 / $min} } {-1} -test expr-34.88 {expr edge cases} {longis32bit} { +test expr-34.88 {expr edge cases} {longIs32bit} { expr {3 % $min} } {-2147483645} -test expr-34.89 {expr edge cases} {longis32bit} { +test expr-34.89 {expr edge cases} {longIs32bit} { expr {3 / ($min + 1)} } {-1} -test expr-34.90 {expr edge cases} {longis32bit} { +test expr-34.90 {expr edge cases} {longIs32bit} { expr {3 % ($min + 1)} } {-2147483644} # Euclidean property: # quotient * divisor + remainder = dividend -test expr-35.1 {expr edge cases} {longis32bit} { +test expr-35.1 {expr edge cases} {longIs32bit} { set dividend $max set divisor 2 set q [expr {$dividend / $divisor}] @@ -5869,7 +5862,7 @@ test expr-35.1 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($divisor * $q) + $r}] } {1073741823 * 2 + 1 = 2147483647} -test expr-35.2 {expr edge cases} {longis32bit} { +test expr-35.2 {expr edge cases} {longIs32bit} { set dividend [expr {$max - 1}] set divisor 2 set q [expr {$dividend / $divisor}] @@ -5877,7 +5870,7 @@ test expr-35.2 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {1073741823 * 2 + 0 = 2147483646} -test expr-35.3 {expr edge cases} {longis32bit} { +test expr-35.3 {expr edge cases} {longIs32bit} { set dividend [expr {$max - 2}] set divisor 2 set q [expr {$dividend / $divisor}] @@ -5885,7 +5878,7 @@ test expr-35.3 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {1073741822 * 2 + 1 = 2147483645} -test expr-35.4 {expr edge cases} {longis32bit} { +test expr-35.4 {expr edge cases} {longIs32bit} { set dividend $max set divisor 3 set q [expr {$dividend / $divisor}] @@ -5893,7 +5886,7 @@ test expr-35.4 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {715827882 * 3 + 1 = 2147483647} -test expr-35.5 {expr edge cases} {longis32bit} { +test expr-35.5 {expr edge cases} {longIs32bit} { set dividend [expr {$max - 1}] set divisor 3 set q [expr {$dividend / $divisor}] @@ -5901,7 +5894,7 @@ test expr-35.5 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {715827882 * 3 + 0 = 2147483646} -test expr-35.6 {expr edge cases} {longis32bit} { +test expr-35.6 {expr edge cases} {longIs32bit} { set dividend [expr {$max - 2}] set divisor 3 set q [expr {$dividend / $divisor}] @@ -5909,7 +5902,7 @@ test expr-35.6 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {715827881 * 3 + 2 = 2147483645} -test expr-35.7 {expr edge cases} {longis32bit} { +test expr-35.7 {expr edge cases} {longIs32bit} { set dividend $min set divisor 2 set q [expr {$dividend / $divisor}] @@ -5917,7 +5910,7 @@ test expr-35.7 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {-1073741824 * 2 + 0 = -2147483648} -test expr-35.8 {expr edge cases} {longis32bit} { +test expr-35.8 {expr edge cases} {longIs32bit} { set dividend [expr {$min + 1}] set divisor 2 set q [expr {$dividend / $divisor}] @@ -5925,7 +5918,7 @@ test expr-35.8 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {-1073741824 * 2 + 1 = -2147483647} -test expr-35.9 {expr edge cases} {longis32bit} { +test expr-35.9 {expr edge cases} {longIs32bit} { set dividend [expr {$min + 2}] set divisor 2 set q [expr {$dividend / $divisor}] @@ -5933,7 +5926,7 @@ test expr-35.9 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {-1073741823 * 2 + 0 = -2147483646} -test expr-35.10 {expr edge cases} {longis32bit} { +test expr-35.10 {expr edge cases} {longIs32bit} { # Two things could happen here. The multiplication # could overflow a 32 bit type, so that when # 1 is added it overflows again back to min. @@ -5947,7 +5940,7 @@ test expr-35.10 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {-715827883 * 3 + 1 = -2147483648} -test expr-35.11 {expr edge cases} {longis32bit} { +test expr-35.11 {expr edge cases} {longIs32bit} { set dividend $min set divisor -3 set q [expr {$dividend / $divisor}] @@ -5955,7 +5948,7 @@ test expr-35.11 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {715827882 * -3 + -2 = -2147483648} -test expr-35.12 {expr edge cases} {longis32bit} { +test expr-35.12 {expr edge cases} {longIs32bit} { set dividend $min set divisor $min set q [expr {$dividend / $divisor}] @@ -5963,7 +5956,7 @@ test expr-35.12 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {1 * -2147483648 + 0 = -2147483648} -test expr-35.13 {expr edge cases} {longis32bit} { +test expr-35.13 {expr edge cases} {longIs32bit} { set dividend $min set divisor [expr {$min + 1}] set q [expr {$dividend / $divisor}] @@ -5971,7 +5964,7 @@ test expr-35.13 {expr edge cases} {longis32bit} { list $q * $divisor + $r = [expr {($q * $divisor) + $r}] } {1 * -2147483647 + -1 = -2147483648} -test expr-35.14 {expr edge cases} {longis32bit} { +test expr-35.14 {expr edge cases} {longIs32bit} { set dividend $min set divisor [expr {$min + 2}] set q [expr {$dividend / $divisor}] diff --git a/tests/fileName.test b/tests/fileName.test index 09b7ee1..5768aac 100644 --- a/tests/fileName.test +++ b/tests/fileName.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: fileName.test,v 1.46 2005/06/21 19:20:12 kennykb Exp $ +# RCS: @(#) $Id: fileName.test,v 1.47 2005/07/27 18:12:42 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -1519,7 +1519,7 @@ test filename-17.2 {windows specific glob with executable} {win} { set res } {abc.exe} -test fileName-18.1 {windows - split ADS name correctly} {winOnly} { +test fileName-18.1 {windows - split ADS name correctly} {win} { # bug 1194458 set x [file split c:/c:d] set y [eval [linsert $x 0 file join]] diff --git a/tests/get.test b/tests/get.test index a04e131..ceed09d 100644 --- a/tests/get.test +++ b/tests/get.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: get.test,v 1.9 2004/05/19 10:38:24 dkf Exp $ +# RCS: @(#) $Id: get.test,v 1.10 2005/07/27 18:12:43 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -18,7 +18,9 @@ if {[lsearch [namespace children] ::tcltest] == -1} { } testConstraint testgetint [llength [info commands testgetint]] -testConstraint intsAre64bit [expr {int(0x80000000) > 0}] +testConstraint longIs32bit [expr {int(0x80000000) < 0}] +testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}] +#testConstraint longIsMoreThan32bit [expr {![testConstraint longIs32bit]}] test get-1.1 {Tcl_GetInt procedure} testgetint { testgetint 44 { 22} @@ -38,28 +40,28 @@ test get-1.5 {Tcl_GetInt procedure} testgetint { test get-1.6 {Tcl_GetInt procedure} testgetint { list [catch {testgetint 44 {16 x}} msg] $msg } {1 {expected integer but got "16 x"}} -test get-1.7 {Tcl_GetInt procedure} {testgetint intsAre64bit} { +test get-1.7 {Tcl_GetInt procedure} {testgetint longIs64bit} { list [catch {testgetint 44 18446744073709551616} msg] $msg $errorCode } {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}} -test get-1.8 {Tcl_GetInt procedure} {testgetint intsAre64bit} { +test get-1.8 {Tcl_GetInt procedure} {testgetint longIs64bit} { list [catch {testgetint 18446744073709551614} msg] $msg } {0 -2} -test get-1.9 {Tcl_GetInt procedure} {testgetint intsAre64bit} { +test get-1.9 {Tcl_GetInt procedure} {testgetint longIs64bit} { list [catch {testgetint +18446744073709551614} msg] $msg } {0 -2} -test get-1.10 {Tcl_GetInt procedure} {testgetint intsAre64bit} { +test get-1.10 {Tcl_GetInt procedure} {testgetint longIs64bit} { list [catch {testgetint -18446744073709551614} msg] $msg } {0 2} -test get-1.11 {Tcl_GetInt procedure} {testgetint && !intsAre64bit} { +test get-1.11 {Tcl_GetInt procedure} {testgetint longIs32bit} { list [catch {testgetint 44 4294967296} msg] $msg $errorCode } {1 {integer value too large to represent} {ARITH IOVERFLOW {integer value too large to represent}}} -test get-1.12 {Tcl_GetInt procedure} {testgetint && !intsAre64bit} { +test get-1.12 {Tcl_GetInt procedure} {testgetint longIs32bit} { list [catch {testgetint 4294967294} msg] $msg } {0 -2} -test get-1.13 {Tcl_GetInt procedure} {testgetint && !intsAre64bit} { +test get-1.13 {Tcl_GetInt procedure} {testgetint longIs32bit} { list [catch {testgetint +4294967294} msg] $msg } {0 -2} -test get-1.14 {Tcl_GetInt procedure} {testgetint && !intsAre64bit} { +test get-1.14 {Tcl_GetInt procedure} {testgetint longIs32bit} { list [catch {testgetint -4294967294} msg] $msg } {0 2} diff --git a/tests/listObj.test b/tests/listObj.test index aa3f951..a3c9f20 100644 --- a/tests/listObj.test +++ b/tests/listObj.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: listObj.test,v 1.7 2005/05/17 21:29:18 dgp Exp $ +# RCS: @(#) $Id: listObj.test,v 1.8 2005/07/27 18:12:43 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -19,7 +19,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { } catch {unset x} -test listobj-1.1 {Tcl_GetListObjType} empty { +test listobj-1.1 {Tcl_GetListObjType} emptyTest { # Test removed; tested an internal detail # that's no longer correct, and duplicated test obj-1.1 } {} diff --git a/tests/obj.test b/tests/obj.test index fb7e1d1..76e008e 100644 --- a/tests/obj.test +++ b/tests/obj.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: obj.test,v 1.16 2005/05/18 15:43:38 dgp Exp $ +# RCS: @(#) $Id: obj.test,v 1.17 2005/07/27 18:12:43 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -40,7 +40,7 @@ foreach {MIN_INT MAX_INT} [int_range] break foreach {MIN_WIDE MAX_WIDE} [wide_range] break testConstraint testobj [llength [info commands testobj]] -testConstraint 32bit [expr {$MAX_INT == 0x7fffffff}] +testConstraint longIs32bit [expr {int(0x80000000) < 0}] testConstraint wideBiggerThanInt [expr {$MAX_WIDE > wide($MAX_INT)}] test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} testobj { @@ -620,31 +620,31 @@ test obj-32.1 {freeing very large object trees} { unset x } {} -test obj-33.1 {integer overflow on input} {32bit wideBiggerThanInt} { +test obj-33.1 {integer overflow on input} {longIs32bit wideBiggerThanInt} { set x 0x8000; append x 0000 list [string is integer $x] [expr { wide($x) }] } {1 2147483648} -test obj-33.2 {integer overflow on input} {32bit wideBiggerThanInt} { +test obj-33.2 {integer overflow on input} {longIs32bit wideBiggerThanInt} { set x 0xffff; append x ffff list [string is integer $x] [expr { wide($x) }] } {1 4294967295} -test obj-33.3 {integer overflow on input} {32bit wideBiggerThanInt} { +test obj-33.3 {integer overflow on input} {longIs32bit wideBiggerThanInt} { set x 0x10000; append x 0000 list [string is integer $x] [expr { wide($x) }] } {0 4294967296} -test obj-33.4 {integer overflow on input} {32bit wideBiggerThanInt} { +test obj-33.4 {integer overflow on input} {longIs32bit wideBiggerThanInt} { set x -0x8000; append x 0000 list [string is integer $x] [expr { wide($x) }] } {1 -2147483648} -test obj-33.5 {integer overflow on input} {32bit wideBiggerThanInt} { +test obj-33.5 {integer overflow on input} {longIs32bit wideBiggerThanInt} { set x -0x8000; append x 0001 list [string is integer $x] [expr { wide($x) }] } {1 -2147483649} -test obj-33.6 {integer overflow on input} {32bit wideBiggerThanInt} { +test obj-33.6 {integer overflow on input} {longIs32bit wideBiggerThanInt} { set x -0xffff; append x ffff list [string is integer $x] [expr { wide($x) }] } {1 -4294967295} -test obj-33.7 {integer overflow on input} {32bit wideBiggerThanInt} { +test obj-33.7 {integer overflow on input} {longIs32bit wideBiggerThanInt} { set x -0x10000; append x 0000 list [string is integer $x] [expr { wide($x) }] } {0 -4294967296} |