diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-19 03:36:43 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-04-19 03:36:43 (GMT) |
commit | e90011ea9128906229133a832d088ef05d55d964 (patch) | |
tree | de026a36db288f1a077e836827f45939d96461ff /tests | |
parent | 9a3cd17eb7e23e7c12ee4fb0028468637c2871f9 (diff) | |
parent | f42b2cef2a2a399a2f0d50633b9d6e018cc2deaf (diff) | |
download | tcl-e90011ea9128906229133a832d088ef05d55d964.zip tcl-e90011ea9128906229133a832d088ef05d55d964.tar.gz tcl-e90011ea9128906229133a832d088ef05d55d964.tar.bz2 |
TIP 660 accepted.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/indexObj.test | 9 | ||||
-rw-r--r-- | tests/interp.test | 8 | ||||
-rw-r--r-- | tests/listObj.test | 9 | ||||
-rw-r--r-- | tests/stringObj.test | 22 |
4 files changed, 28 insertions, 20 deletions
diff --git a/tests/indexObj.test b/tests/indexObj.test index b2cb912..4c01210 100644 --- a/tests/indexObj.test +++ b/tests/indexObj.test @@ -19,6 +19,7 @@ catch [list package require -exact tcl::test [info patchlevel]] testConstraint testindexobj [llength [info commands testindexobj]] testConstraint testgetintforindex [llength [info commands testgetintforindex]] testConstraint testparseargs [llength [info commands testparseargs]] +testConstraint has64BitLengths [expr {$tcl_platform(pointerSize) == 8}] test indexObj-1.1 {exact match} testindexobj { testindexobj 1 1 xyz abc def xyz alm @@ -184,7 +185,7 @@ test indexObj-8.4 {Tcl_GetIntForIndex INT_MAX} testgetintforindex { } 2147483647 test indexObj-8.5 {Tcl_GetIntForIndex INT_MAX+1} testgetintforindex { testgetintforindex 2147483648 0 -} 2147483648 +} [expr {[testConstraint has64BitLengths] ? 2147483648 : 2147483647}] test indexObj-8.6 {Tcl_GetIntForIndex end-1} testgetintforindex { testgetintforindex end-1 2147483646 } 2147483645 @@ -199,16 +200,16 @@ test indexObj-8.9 {Tcl_GetIntForIndex end} testgetintforindex { } 2147483647 test indexObj-8.10 {Tcl_GetIntForIndex end-1} testgetintforindex { testgetintforindex end-1 -1 -} -2 +} -1 test indexObj-8.11 {Tcl_GetIntForIndex end-1} testgetintforindex { testgetintforindex end-1 -2 -} -3 +} -1 test indexObj-8.12 {Tcl_GetIntForIndex end} testgetintforindex { testgetintforindex end -1 } -1 test indexObj-8.13 {Tcl_GetIntForIndex end} testgetintforindex { testgetintforindex end -2 -} -2 +} -1 test indexObj-8.14 {Tcl_GetIntForIndex end+1} testgetintforindex { testgetintforindex end+1 -1 } 0 diff --git a/tests/interp.test b/tests/interp.test index 3aac4de..5bb5342 100644 --- a/tests/interp.test +++ b/tests/interp.test @@ -2419,13 +2419,13 @@ test interp-29.1.5 {interp recursionlimit argument checking} -body { set result [catch {interp recursionlimit moo 0} msg] interp delete moo list $result $msg -} -match glob -result {1 {recursion limit must be > 0 and < *}} +} -match glob -result {1 {recursion limit must be > 0}} test interp-29.1.6 {interp recursionlimit argument checking} -body { interp create moo set result [catch {interp recursionlimit moo -1} msg] interp delete moo list $result $msg -} -match glob -result {1 {recursion limit must be > 0 and < *}} +} -match glob -result {1 {recursion limit must be > 0}} test interp-29.1.7 {interp recursionlimit argument checking} { interp create moo set result [catch {interp recursionlimit moo [expr {wide(1)<<64}]} msg] @@ -2449,13 +2449,13 @@ test interp-29.1.10 {child recursionlimit argument checking} -body { set result [catch {moo recursionlimit 0} msg] interp delete moo list $result $msg -} -match glob -result {1 {recursion limit must be > 0 and < *}} +} -match glob -result {1 {recursion limit must be > 0}} test interp-29.1.11 {child recursionlimit argument checking} -body { interp create moo set result [catch {moo recursionlimit -1} msg] interp delete moo list $result $msg -} -match glob -result {1 {recursion limit must be > 0 and < *}} +} -match glob -result {1 {recursion limit must be > 0}} test interp-29.1.12 {child recursionlimit argument checking} { interp create moo set result [catch {moo recursionlimit [expr {wide(1)<<64}]} msg] diff --git a/tests/listObj.test b/tests/listObj.test index c360fbb..c5ebbb0 100644 --- a/tests/listObj.test +++ b/tests/listObj.test @@ -22,6 +22,9 @@ catch [list package require -exact tcl::test [info patchlevel]] testConstraint testobj [llength [info commands testobj]] testConstraint memory [llength [info commands memory]] +set INT_MAX 0x7fffffff; # Assumes sizeof(int) == 4 +set SIZE_MAX [expr {(1 << (8*$::tcl_platform(pointerSize) - 1)) - 1}] + catch {unset x} test listobj-1.1 {Tcl_GetListObjType} emptyTest { # Test removed; tested an internal detail @@ -206,14 +209,14 @@ test listobj-10.3 {Tcl_ListObjReplace with negative count value} testobj { testlistobj replace 1 1 -1 f testlistobj get 1 } {a f b c d e} -test listobj-10.4 {Tcl_ListObjReplace with UINT_MAX-1 count value} testobj { +test listobj-10.4 {Tcl_ListObjReplace with $SIZE_MAX count value} testobj { testlistobj set 1 a b c d e - testlistobj replace 1 1 0xFFFFFFFE f + testlistobj replace 1 1 $SIZE_MAX f testlistobj get 1 } {a f} test listobj-10.5 {Tcl_ListObjReplace with SIZE_MAX-1 count value} testobj { testlistobj set 1 a b c d e - testlistobj replace 1 1 -2 f + testlistobj replace 1 1 [expr {$SIZE_MAX -1}] f testlistobj get 1 } {a f} diff --git a/tests/stringObj.test b/tests/stringObj.test index 9c9cd16..4245a13 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -31,6 +31,9 @@ test stringObj-1.1 {string type registration} testobj { set result [expr {$first >= 0}] } 1 +set INT_MAX 0x7fffffff; # Assumes sizeof(int) == 4 +set SIZE_MAX [expr {(1 << (8*$::tcl_platform(pointerSize) - 1)) - 1}] + test stringObj-2.1 {Tcl_NewStringObj} testobj { set result "" lappend result [testobj freeallvars] @@ -500,29 +503,30 @@ test stringObj-16.6 {Tcl_GetRange: old anomaly} testobj { teststringobj set 1 abcde teststringobj range 1 2 0 } {} -test stringObj-16.7 {Tcl_GetRange: first = UINT_MAX-1} testobj { +test stringObj-16.7 {Tcl_GetRange: first = INT_MAX-1} testobj { teststringobj set 1 abcde - teststringobj range 1 0xFFFFFFFE 3 + teststringobj range 1 [expr {$INT_MAX-1}] 3 } {} test stringObj-16.8 {Tcl_GetRange: first = SIZE_MAX-1} testobj { teststringobj set 1 abcde - teststringobj range 1 -2 3 + teststringobj range 1 [expr {$SIZE_MAX - 1}] 3 } {} -test stringObj-16.9 {Tcl_GetRange: last = UINT_MAX-1} testobj { +test stringObj-16.9 {Tcl_GetRange: last = INT_MAX-1} testobj { teststringobj set 1 abcde - teststringobj range 1 1 0xFFFFFFFE + teststringobj range 1 1 [expr {$INT_MAX-1}] } bcde test stringObj-16.10 {Tcl_GetRange: last = SIZE_MAX-1} testobj { teststringobj set 1 abcde - teststringobj range 1 1 -2 + teststringobj range 1 1 [expr {$SIZE_MAX - 1}] } bcde -test stringObj-16.11 {Tcl_GetRange: first = last = UINT_MAX-1} testobj { +test stringObj-16.11 {Tcl_GetRange: first = last = INT_MAX-1} testobj { teststringobj set 1 abcde - teststringobj range 1 0xFFFFFFFE 0xFFFFFFFE + teststringobj range 1 [expr {$INT_MAX-1}] [expr {$INT_MAX-1}] } {} test stringObj-16.12 {Tcl_GetRange: first = last = SIZE_MAX-1} testobj { teststringobj set 1 abcde - teststringobj range 1 -2 -2 + set i [expr {$SIZE_MAX - 1}] + teststringobj range 1 $i $i } {} if {[testConstraint testobj]} { |