summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorgriffin <briang42@easystreet.net>2023-04-26 03:41:57 (GMT)
committergriffin <briang42@easystreet.net>2023-04-26 03:41:57 (GMT)
commit3aaf8c054455ae5ad096a31922d26477397c8ed7 (patch)
treeda3b4149db099f21abca6f4443b7a054dc2a3f54 /tests
parentda6df4addedb2a495440a76f50733ff7b968cffc (diff)
parent025b74f7c7add01c5ca6654b03c29241c0845def (diff)
downloadtcl-3aaf8c054455ae5ad096a31922d26477397c8ed7.zip
tcl-3aaf8c054455ae5ad096a31922d26477397c8ed7.tar.gz
tcl-3aaf8c054455ae5ad096a31922d26477397c8ed7.tar.bz2
merge trunk, address some 32-bit issues.
Diffstat (limited to 'tests')
-rw-r--r--tests/bigdata.test106
-rw-r--r--tests/cmdIL.test3
-rw-r--r--tests/lsearch.test3
-rwxr-xr-xtests/lseq.test6
-rw-r--r--tests/scan.test6
5 files changed, 92 insertions, 32 deletions
diff --git a/tests/bigdata.test b/tests/bigdata.test
index ced2510..c02d8e3 100644
--- a/tests/bigdata.test
+++ b/tests/bigdata.test
@@ -139,9 +139,8 @@ bigtest string-cat-bigdata-3 "string cat result > UINT_MAX" 1 -body {
bigtestRO string-equal/compare-bigdata-1 "string compare/equal equal strings" {0 1} -body {
list [string compare $s1 $s2] [string equal $s1 $s2]
} -setup {
- set len [expr {$::bigLengths(intmax)+1}]
- set s1 [bigString $len]
- set s2 [bigString $len]; # Use separate string to avoid Tcl_Obj * being same
+ set s1 [bigString 0x100000000]
+ set s2 [bigString 0x100000000]; # Separate so Tcl_Obj is not the same
} -cleanup {
bigClean
}
@@ -152,15 +151,15 @@ bigtestRO string-equal/compare-bigdata-2 "string compare/equal -length unequal s
lappend result [string equal $s1 $s2]
# Check lengths > UINT_MAX
# Also that lengths do not truncate to sizeof(int)
- lappend result [string compare -length $len $s1 $s2]
- lappend result [string equal -length $len $s1 $s2]
+ lappend result [string compare -length 0x100000000 $s1 $s2]
+ lappend result [string equal -length 0x100000000 $s1 $s2]
} -setup {
- set len [expr {$::bigLengths(uintmax)+2}]
- set s1 [bigString $len]
- set s2 [bigString $len $len]; # Differs in last char
+ set s1 [bigString 0x100000001]
+ set s2 [bigString 0x100000001 0x100000000]; # Differs in last char
} -cleanup {
bigClean
-} -constraints bug-a814ee5bbd
+}
+# -constraints bug-a814ee5bbd
#
# string first
@@ -550,7 +549,7 @@ bigtestRO format-bigdata-1 "format %s" 1 -body {
set s [bigString 0x100000000]
} -cleanup {
bigClean
-} -constraints bug-a550f9710b
+}
bigtest format-bigdata-2 "format bigstring%s" 1 -body {
set s [format $s X]
string equal $s [bigString 0x100000001 0x100000000]
@@ -559,24 +558,71 @@ bigtest format-bigdata-2 "format bigstring%s" 1 -body {
append s %s
} -cleanup {
bigClean
-} -constraints bug-a550f9710b
-# TODO - once above bugs fixed, add tests for width and precision
+}
+bigtest format-bigdata-3 "format big width" {4294967300 { } { a}} -body {
+ set s [format %4294967300s a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-4 "format big negative width" {4294967300 {a } { }} -body {
+ set s [format %-4294967300s a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-5 "format big * width" {4294967300 { } { a}} -body {
+ set s [format %*s 4294967300 a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-6 "format big negative * width" {4294967300 {a } { }} -body {
+ set s [format %*s -4294967300 a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtestRO format-bigdata-7 "format big precision" {4294967300 0123 6789} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [format %.4294967300s $s]
+ list [string length $s2] [string range $s2 0 3] [string range $s2 end-3 end]
+} -setup {
+ set s [testbigdata string 4294967310]
+} -cleanup {
+ bigClean
+}
+bigtestRO format-bigdata-8 "format big * precision" {4294967300 0123 6789} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [format %.*s 4294967300 $s]
+ list [string length $s2] [string range $s2 0 3] [string range $s2 end-3 end]
+} -setup {
+ set s [testbigdata string 4294967310]
+} -cleanup {
+ bigClean
+}
#
# scan
-bigtestRO scan-bigdata-1 "scan %s" {1 1 2 1} -body {
+bigtestRO scan-bigdata-1 "scan %s" {1 1 2 X 1 2 4294967300 01234X} -body {
# Unset explicitly before setting to save memory as bigtestRO runs the
# script below twice.
- unset -nocomplain result digits
+ unset -nocomplain result digits x
lappend result [string equal [scan $s %s] $s]
lappend result [string equal [scan $s {%[0-9X]}] $s]
lappend result [scan $s {%[0-9]%s} digits x] $x
- lappend result [string equal $digits [bigString 0x100000008]]
+ lappend result [string equal $digits [bigString 0x100000009]]
+ lappend result [scan $s %4294967300s%s x y]
+ lappend result [string length $x] $y
} -setup {
set s [bigString 0x10000000a 0x100000009]
} -cleanup {
bigClean digits
-} -constraints bug-d4ede611a7
+}
#
# regexp
@@ -635,16 +681,17 @@ bigtestRO subst-bigdata-1 "subst" {1 1} -body {
#
# binary format
-bigtestRO binary-format-bigdata-1 "binary format aN" 4294967296 -body {
+bigtestRO binary-format-bigdata-1 "binary format aN" [list 4294967296 X\0\0\0 \0\0\0\0] -body {
# Unset explicitly before setting to save memory as bigtestRO runs the
# script below twice.
unset -nocomplain bin
set bin [binary format a4294967296 X]
- string length $bin
+ list [string length $bin] [string range $bin 0 3] [string range $bin end-3 end]
} -cleanup {
bigClean
-} -constraints bug-9369f83649
-# TODO - do string compare and add other format specifiers once above bug is fixed
+}
+# -constraints bug-9369f83649
+# TODO - do string compare and add other format specifiers
bigtestRO binary-format-bigdata-2 "binary format a*" 1 -body {
# Unset explicitly before setting to save memory as bigtestRO runs the
@@ -660,17 +707,18 @@ bigtestRO binary-format-bigdata-2 "binary format a*" 1 -body {
#
# binary scan
-bigtestRO binary-scan-bigdata-1 "binary scan aN" 4294967296 -body {
+bigtestRO binary-scan-bigdata-1 "binary scan aN" {4294967296 0123 2345} -body {
# Unset explicitly before setting to save memory as bigtestRO runs the
# script below twice.
unset -nocomplain bin2
binary scan $bin a4294967296 bin2
- string length $bin2
+ list [string length $bin2] [string range $bin2 0 3] [string range $bin2 end-3 end]
} -setup {
set bin [bigBinary 4294967296]
} -cleanup {
bigClean
-} -constraints bug-9369f83649
+}
+# -constraints bug-9369f83649
# TODO - do string compare and add other format specifiers once above bug is fixed
bigtestRO binary-scan-bigdata-2 "binary scan a*" 1 -body {
@@ -696,7 +744,7 @@ bigtestRO binary-encode/decode-base64-bigdata-1 "binary encode/decode base64" 1
set bin [bigBinary 4294967296]
} -cleanup {
bigClean
-} -constraints bug-c719fa8716
+}
#
# binary encode / decode hex
@@ -718,7 +766,7 @@ bigtestRO binary-encode/decode-uuencode-bigdata-1 "binary encode/decode uuencode
set bin [bigBinary 4294967296]
} -cleanup {
bigClean
-} -constraints bug-2e3fed53ba
+}
################################################################
# List commands
@@ -752,17 +800,17 @@ bigtest lappend-bigdata-1 "lappend" {4294967300 4294967300 {1 2 3 4 5 a b c d}}
#
# lassign
-bigtestRO lassign-bigdata-1 "lassign" {0 1 2 3 4 5 6 7 8 9 1} -body {
+bigtestRO lassign-bigdata-1 "lassign" {0 1 2 3 4 5 6 7 8 {9 0 1 2 3 4 5 6 7 8} {6 7 8 9 0 1 2 3 4 5}} -body {
# Unset explicitly before setting to save memory as bigtestRO runs the
# script below twice.
unset -nocomplain l2
- set l2 [lassign $l a b c d e f g h i j]
- list $a $b $c $d $e $f $g $h $i $j [testlutil equal $l2 [bigList 0x100000000]]
+ set l2 [lassign $l a b c d e f g h i]
+ list $a $b $c $d $e $f $g $h $i [lrange $l2 0 9] [lrange $l2 end-9 end]
} -setup {
set l [bigList 0x10000000a]
} -cleanup {
bigClean
-} -constraints bug-d90fee06d0
+}
#
# ledit
diff --git a/tests/cmdIL.test b/tests/cmdIL.test
index 5a68925..b24b10c 100644
--- a/tests/cmdIL.test
+++ b/tests/cmdIL.test
@@ -168,6 +168,9 @@ test cmdIL-1.41 {lsort -stride and -index} -body {
test cmdIL-1.42 {lsort -stride and-index} -body {
lsort -stride 2 -index -1-1 {a 2 b 1}
} -returnCodes error -result {index "-1-1" out of range}
+test cmdIL-1.43 {lsort -stride errors} -returnCodes error -body {
+ lsort -stride 4294967296 bar
+} -result {list size must be a multiple of the stride length}
# Can't think of any good tests for the MergeSort and MergeLists procedures,
# except a bunch of random lists to sort.
diff --git a/tests/lsearch.test b/tests/lsearch.test
index 7c1402d..b8a8aa7 100644
--- a/tests/lsearch.test
+++ b/tests/lsearch.test
@@ -688,6 +688,9 @@ test lsearch-28.8 {lsearch -sorted with -stride} -body {
test lsearch-28.9 {lsearch -sorted with -stride} -body {
lsearch -sorted -stride 2 -index 1 -subindices -inline {3 5 8 7 2 9} 9
} -result 9
+test lsearch-28.10 {lsearch -sorted with -stride} -body {
+ lsearch -sorted -stride 4294967296 -index 1 -subindices -inline {3 5 8 7 2 9} 9
+} -returnCodes 1 -result {list size must be a multiple of the stride length}
# cleanup
diff --git a/tests/lseq.test b/tests/lseq.test
index 7e4c9da..6bf89eb 100755
--- a/tests/lseq.test
+++ b/tests/lseq.test
@@ -416,7 +416,7 @@ test lseq-3.30 {lreverse with double values} arithSeriesDouble {
arithseries
18.5 17.0 15.5 14.0 12.5 11.0 9.5 8.0 6.5 5.0 3.5}
-test lseq-3.31 {lreverse inplace with doubles} arithSeriesDouble {
+test lseq-3.31 {lreverse inplace with doubles} {arithSeriesDouble has64BitLengths} {
lreverse [lseq 1.1 29.9 0.3]
} {29.9 29.6 29.3 29.0 28.7 28.4 28.1 27.8 27.5 27.2 26.9 26.6 26.3 26.0 25.7 25.4 25.1 24.8 24.5 24.2 23.9 23.6 23.3 23.0 22.7 22.4 22.1 21.8 21.5 21.2 20.9 20.6 20.3 20.0 19.7 19.4 19.1 18.8 18.5 18.2 17.9 17.6 17.3 17.0 16.7 16.4 16.1 15.8 15.5 15.2 14.9 14.6 14.3 14.0 13.7 13.4 13.1 12.8 12.5 12.2 11.9 11.6 11.3 11.0 10.7 10.4 10.1 9.8 9.5 9.2 8.9 8.6 8.3 8.0 7.7 7.4 7.1 6.8 6.5 6.2 5.9 5.6 5.3 5.0 4.7 4.4 4.1 3.8 3.5 3.2 2.9 2.6 2.3 2.0 1.7 1.4 1.1}
@@ -568,12 +568,12 @@ test lseq-4.13 {bug lseq} -constraints has64BitLengths -body {
} -result {9223372036854775807 9223372036854775806 9223372036854775800}
-test lseq-4.14 {bug lseq - inconsistent rounding} {
+test lseq-4.14 {bug lseq - inconsistent rounding} has64BitLengths {
# using a non-integer increment, [lseq] rounding seems to be not consistent:
lseq 4 40 0.1
} {4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.0 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 13.0 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 14.0 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 15.0 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16.0 16.1 16.2 16.3 16.4 16.5 16.6 16.7 16.8 16.9 17.0 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 18.0 18.1 18.2 18.3 18.4 18.5 18.6 18.7 18.8 18.9 19.0 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.9 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.9 25.0 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 27.8 27.9 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 29.0 29.1 29.2 29.3 29.4 29.5 29.6 29.7 29.8 29.9 30.0 30.1 30.2 30.3 30.4 30.5 30.6 30.7 30.8 30.9 31.0 31.1 31.2 31.3 31.4 31.5 31.6 31.7 31.8 31.9 32.0 32.1 32.2 32.3 32.4 32.5 32.6 32.7 32.8 32.9 33.0 33.1 33.2 33.3 33.4 33.5 33.6 33.7 33.8 33.9 34.0 34.1 34.2 34.3 34.4 34.5 34.6 34.7 34.8 34.9 35.0 35.1 35.2 35.3 35.4 35.5 35.6 35.7 35.8 35.9 36.0 36.1 36.2 36.3 36.4 36.5 36.6 36.7 36.8 36.9 37.0 37.1 37.2 37.3 37.4 37.5 37.6 37.7 37.8 37.9 38.0 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.0 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40.0}
-test lseq-4.15 {bug lseq - inconsistent rounding} {
+test lseq-4.15 {bug lseq - inconsistent rounding} has64BitLengths {
# using a non-integer increment, [lseq] rounding seems to be not consistent:
lseq 6 40 0.1
} {6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.0 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 13.0 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 14.0 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 15.0 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16.0 16.1 16.2 16.3 16.4 16.5 16.6 16.7 16.8 16.9 17.0 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 18.0 18.1 18.2 18.3 18.4 18.5 18.6 18.7 18.8 18.9 19.0 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.9 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.9 25.0 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 27.8 27.9 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 29.0 29.1 29.2 29.3 29.4 29.5 29.6 29.7 29.8 29.9 30.0 30.1 30.2 30.3 30.4 30.5 30.6 30.7 30.8 30.9 31.0 31.1 31.2 31.3 31.4 31.5 31.6 31.7 31.8 31.9 32.0 32.1 32.2 32.3 32.4 32.5 32.6 32.7 32.8 32.9 33.0 33.1 33.2 33.3 33.4 33.5 33.6 33.7 33.8 33.9 34.0 34.1 34.2 34.3 34.4 34.5 34.6 34.7 34.8 34.9 35.0 35.1 35.2 35.3 35.4 35.5 35.6 35.7 35.8 35.9 36.0 36.1 36.2 36.3 36.4 36.5 36.6 36.7 36.8 36.9 37.0 37.1 37.2 37.3 37.4 37.5 37.6 37.7 37.8 37.9 38.0 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.0 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40.0}
diff --git a/tests/scan.test b/tests/scan.test
index cf58828..6d7a9fb 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -858,6 +858,12 @@ test scan-13.8 {Tcl_ScanObjCmd, inline XPG case lots of arguments} {
set msg [scan "10 20 30" {%100$d %5$d %200$d}]
list [llength $msg] [lindex $msg 99] [lindex $msg 4] [lindex $msg 199]
} {200 10 20 30}
+test scan-13.9 {Tcl_ScanObjCmd, inline XPG case limit error} -body {
+ # Note this applies to 64-bit builds as well so long as max number of
+ # command line arguments allowed for scan command is INT_MAX
+ scan abc {%2147483648$s}
+} -result {"%n$" argument index out of range} -returnCodes error
+
# scan infinities - not working