summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compExpr-old.test6
-rw-r--r--tests/expr-old.test4
-rw-r--r--tests/expr.test6
-rw-r--r--tests/format.test9
-rw-r--r--tests/get.test4
-rw-r--r--tests/obj.test17
-rw-r--r--tests/scan.test15
-rw-r--r--tests/string.test24
8 files changed, 40 insertions, 45 deletions
diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test
index 0136ccd..9dfe4c4 100644
--- a/tests/compExpr-old.test
+++ b/tests/compExpr-old.test
@@ -78,8 +78,8 @@ proc testIEEE {} {
}
testConstraint ieeeFloatingPoint [testIEEE]
-testConstraint longIs32bit [expr {int(0x80000000) < 0}]
-testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}]
+testConstraint longIs32bit [expr {$tcl_platform(wordSize) == 4}]
+testConstraint longIs64bit [expr {$tcl_platform(wordSize) == 8}]
# procedures used below
@@ -337,7 +337,7 @@ test compExpr-old-9.4 {CompileRelationalExpr: just shift expr} {expr {1<<3}} 8
test compExpr-old-9.5a {CompileRelationalExpr: shift expr producing LONG_MIN} longIs64bit {
expr {int(1<<63)}
-} -9223372036854775808
+} 9223372036854775808
test compExpr-old-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} longIs32bit {
expr {int(1<<31)}
} -2147483648
diff --git a/tests/expr-old.test b/tests/expr-old.test
index a73b77a..7f89d99 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -813,10 +813,10 @@ test expr-old-32.32 {math functions in expressions} {
} {-1}
test expr-old-32.33 {math functions in expressions} {
expr int(1e60)
-} 0
+} 999999999999999949387135297074018866963645011013410073083904
test expr-old-32.34 {math functions in expressions} {
expr int(-1e60)
-} 0
+} -999999999999999949387135297074018866963645011013410073083904
test expr-old-32.35 {math functions in expressions} {
expr round(1.49)
} {1}
diff --git a/tests/expr.test b/tests/expr.test
index 713681a..913df1b 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -21,8 +21,8 @@ catch [list package require -exact Tcltest [info patchlevel]]
# 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 {int(0x80000000) < 0}]
-testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}]
+testConstraint longIs32bit [expr {$tcl_platform(wordSize) == 4}]
+testConstraint longIs64bit [expr {$tcl_platform(wordSize) == 8}]
testConstraint wideIs64bit \
[expr {(wide(0x80000000) > 0) && (wide(0x8000000000000000) < 0)}]
@@ -419,7 +419,7 @@ test expr-9.3 {CompileRelationalExpr: just shift expr} {expr -1>>2} -1
test expr-9.4 {CompileRelationalExpr: just shift expr} {expr {1<<3}} 8
test expr-9.5a {CompileRelationalExpr: shift expr producing LONG_MIN} longIs64bit {
expr {int(1<<63)}
-} -9223372036854775808
+} 9223372036854775808
test expr-9.5b {CompileRelationalExpr: shift expr producing LONG_MIN} longIs32bit {
expr {int(1<<31)}
} -2147483648
diff --git a/tests/format.test b/tests/format.test
index cdea545..2fab1d9 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -16,11 +16,10 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
}
# %u output depends on word length, so this test is not portable.
-testConstraint longIs32bit [expr {int(0x80000000) < 0}]
-testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}]
+testConstraint longIs32bit [expr {$tcl_platform(wordSize) == 4}]
+testConstraint longIs64bit [expr {$tcl_platform(wordSize) == 8}]
testConstraint wideIs64bit \
[expr {(wide(0x80000000) > 0) && (wide(0x8000000000000000) < 0)}]
-testConstraint wideBiggerThanInt [expr {wide(0x80000000) != int(0x80000000)}]
testConstraint pointerIs64bit [expr {$tcl_platform(pointerSize) >= 8}]
test format-1.1 {integer formatting} {
@@ -547,7 +546,7 @@ for {set i 290} {$i < 400} {incr i} {
append b "x"
}
-test format-17.1 {testing %d with wide} {wideIs64bit wideBiggerThanInt} {
+test format-17.1 {testing %d with wide} {wideIs64bit longIs32bit} {
format %d 7810179016327718216
} 1819043144
test format-17.2 {testing %ld with wide} {wideIs64bit} {
@@ -580,7 +579,7 @@ test format-18.1 {do not demote existing numeric values} {
format %08x $b
lappend result [expr {$a == $b}]
} {1 1 1 1}
-test format-18.2 {do not demote existing numeric values} {wideBiggerThanInt} {
+test format-18.2 {do not demote existing numeric values} {longIs32bit} {
set a [expr {0xaaaaaaaaaa + 1}]
set b 0xaaaaaaaaab
list [format %08x $a] [expr {$a == $b}]
diff --git a/tests/get.test b/tests/get.test
index b02b686..f85bc01 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -20,8 +20,8 @@ catch [list package require -exact Tcltest [info patchlevel]]
testConstraint testgetint [llength [info commands testgetint]]
testConstraint testdoubleobj [llength [info commands testdoubleobj]]
-testConstraint longIs32bit [expr {int(0x80000000) < 0}]
-testConstraint longIs64bit [expr {int(0x8000000000000000) < 0}]
+testConstraint longIs32bit [expr {$tcl_platform(wordSize) == 4}]
+testConstraint longIs64bit [expr {$tcl_platform(wordSize) == 8}]
test get-1.1 {Tcl_GetInt procedure} testgetint {
testgetint 44 { 22}
diff --git a/tests/obj.test b/tests/obj.test
index ffd1a59..616564a 100644
--- a/tests/obj.test
+++ b/tests/obj.test
@@ -21,7 +21,6 @@ catch [list package require -exact Tcltest [info patchlevel]]
testConstraint testobj [llength [info commands testobj]]
testConstraint longIs32bit [expr {int(0x80000000) < 0}]
-testConstraint wideBiggerThanInt [expr {wide(0x80000000) != int(0x80000000)}]
test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} testobj {
set r 1
@@ -549,34 +548,34 @@ test obj-32.1 {freeing very large object trees} {
unset x
} {}
-test obj-33.1 {integer overflow on input} {longIs32bit wideBiggerThanInt} {
+test obj-33.1 {integer overflow on input} {longIs32bit} {
set x 0x8000; append x 0000
list [string is integer $x] [expr { wide($x) }]
} {1 2147483648}
-test obj-33.2 {integer overflow on input} {longIs32bit wideBiggerThanInt} {
+test obj-33.2 {integer overflow on input} {longIs32bit} {
set x 0xffff; append x ffff
list [string is integer $x] [expr { wide($x) }]
} {1 4294967295}
-test obj-33.3 {integer overflow on input} {
+test obj-33.3 {no integer overflow on input} {
set x 0x100000000; append x 00000000
list [string is integer $x] [expr { $x }]
-} {0 18446744073709551616}
-test obj-33.4 {integer overflow on input} {longIs32bit wideBiggerThanInt} {
+} {1 18446744073709551616}
+test obj-33.4 {integer overflow on input} {longIs32bit} {
set x -0x8000; append x 0000
list [string is integer $x] [expr { wide($x) }]
} {1 -2147483648}
-test obj-33.5 {integer overflow on input} {longIs32bit wideBiggerThanInt} {
+test obj-33.5 {integer overflow on input} {longIs32bit} {
set x -0x8000; append x 0001
list [string is integer $x] [expr { wide($x) }]
} {1 -2147483649}
-test obj-33.6 {integer overflow on input} {longIs32bit wideBiggerThanInt} {
+test obj-33.6 {integer overflow on input} {longIs32bit} {
set x -0xffff; append x ffff
list [string is integer $x] [expr { wide($x) }]
} {1 -4294967295}
test obj-33.7 {integer overflow on input} {
set x -0x100000000; append x 00000000
list [string is integer $x] [expr { $x }]
-} {0 -18446744073709551616}
+} {1 -18446744073709551616}
test obj-34.1 {mp_iseven} testobj {
set result ""
diff --git a/tests/scan.test b/tests/scan.test
index 1f32b9f..f7f7049 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -19,11 +19,8 @@ if {"::tcltest" ni [namespace children]} {
# procedure that returns the range of integers
proc int_range {} {
- for { set MIN_INT 1 } { int($MIN_INT) > 0 } {} {
- set MIN_INT [expr { $MIN_INT << 1 }]
- }
- set MIN_INT [expr {int($MIN_INT)}]
- set MAX_INT [expr { ~ $MIN_INT }]
+ set MAX_INT [expr {[format %lu -2]/2}]
+ set MIN_INT [expr { ~ $MAX_INT }]
return [list $MIN_INT $MAX_INT]
}
@@ -446,14 +443,14 @@ test scan-4.61 {Tcl_ScanObjCmd, set errors} -setup {
test scan-4.62 {scanning of large and negative octal integers} {
lassign [int_range] MIN_INT MAX_INT
- set scanstring [format {%o %o %o} -1 $MIN_INT $MAX_INT]
- list [scan $scanstring {%o %o %o} a b c] \
+ set scanstring [format {%lo %lo %lo} -1 $MIN_INT $MAX_INT]
+ list [scan $scanstring {%lo %lo %lo} a b c] \
[expr { $a == -1 }] [expr { $b == $MIN_INT }] [expr { $c == $MAX_INT }]
} {3 1 1 1}
test scan-4.63 {scanning of large and negative hex integers} {
lassign [int_range] MIN_INT MAX_INT
- set scanstring [format {%x %x %x} -1 $MIN_INT $MAX_INT]
- list [scan $scanstring {%x %x %x} a b c] \
+ set scanstring [format {%lx %lx %lx} -1 $MIN_INT $MAX_INT]
+ list [scan $scanstring {%lx %lx %lx} a b c] \
[expr { $a == -1 }] [expr { $b == $MIN_INT }] [expr { $c == $MAX_INT }]
} {3 1 1 1}
test scan-4.64 {scanning of hex with %X} {
diff --git a/tests/string.test b/tests/string.test
index 81588ff..a0eaac8 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -674,9 +674,9 @@ test string-6.53.$noComp {string is integer, true with whitespace} {
test string-6.54.$noComp {string is integer, false} {
list [run {string is integer -fail var 123abc}] $var
} {0 3}
-test string-6.55.$noComp {string is integer, false on overflow} {
- list [run {string is integer -fail var +[largest_int]0}] $var
-} {0 -1}
+test string-6.55.$noComp {string is integer, no overflow possible} {
+ run {string is integer +[largest_int]0}
+} 1
test string-6.56.$noComp {string is integer, false} {
list [run {string is integer -fail var [expr double(1)]}] $var
} {0 1}
@@ -807,22 +807,22 @@ test string-6.91.$noComp {string is double, bad doubles} {
}
return $result
} {1 1 0 0 0 1 0 0}
-test string-6.92.$noComp {string is integer, 64-bit overflow} {
+test string-6.92.$noComp {string is integer, no 64-bit overflow} {
# Bug 718878
set x 0x10000000000000000
- list [run {string is integer -failindex var $x}] $var
-} {0 -1}
-test string-6.93.$noComp {string is integer, 64-bit overflow} {
+ run {string is integer $x}
+} 1
+test string-6.93.$noComp {string is integer, no 64-bit overflow} {
# Bug 718878
set x 0x10000000000000000
append x ""
- list [run {string is integer -failindex var $x}] $var
-} {0 -1}
-test string-6.94.$noComp {string is integer, 64-bit overflow} {
+ run {string is integer $x}
+} 1
+test string-6.94.$noComp {string is integer, no 64-bit overflow} {
# Bug 718878
set x 0x10000000000000000
- list [run {string is integer -failindex var [expr {$x}]}] $var
-} {0 -1}
+ run {string is integer [expr {$x}]}
+} 1
test string-6.95.$noComp {string is wideinteger, true} {
run {string is wideinteger +1234567890}
} 1