summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2008-07-23 22:50:32 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2008-07-23 22:50:32 (GMT)
commit4f9bbccc00c295f21e8675079ffa2664f4d2c41d (patch)
tree20de07e9fe2812770974be255fae98340eccb37d
parentaf2edfcf503b8fbedd006c9df5e2e4c04ff4c7e5 (diff)
downloadtcl-4f9bbccc00c295f21e8675079ffa2664f4d2c41d.zip
tcl-4f9bbccc00c295f21e8675079ffa2664f4d2c41d.tar.gz
tcl-4f9bbccc00c295f21e8675079ffa2664f4d2c41d.tar.bz2
Added relative speed test for lrange, checking fro in-place optimization.
-rw-r--r--ChangeLog5
-rw-r--r--tests/lrange.test9
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7fe6b8b..2b129a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-23 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * tests/lrange.test: Added relative speed test to check for lrange
+ in-place optimization committed 2008-06-30.
+
2008-07-23 Andreas Kupries <andreask@activestate.com>
* tests/info.test: Reordered the tests to have monotonously
diff --git a/tests/lrange.test b/tests/lrange.test
index 29eafb9..443d8c9 100644
--- a/tests/lrange.test
+++ b/tests/lrange.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: lrange.test,v 1.9 2005/05/10 18:35:22 kennykb Exp $
+# RCS: @(#) $Id: lrange.test,v 1.10 2008/07/23 22:50:42 ferrieux Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -66,7 +66,12 @@ test lrange-1.15 {range of list elements} {
test lrange-1.16 {list element quoting} {
lrange {[append a .b]} 0 end
} {{[append} a .b\]}
-
+test lrange-1.17 {lrange in-place speed} {
+ set l [lrepeat 1000000 1]
+ set t1 [lindex [time {set l [lrange $l 0 end-1]}] 0]
+ set t2 [lindex [time {set l [lrange $l[unset l] 0 end-1]}] 0]
+ expr {($t1/$t2)>100}
+} 1
test lrange-2.1 {error conditions} {
list [catch {lrange a b} msg] $msg
} {1 {wrong # args: should be "lrange list first last"}}