summaryrefslogtreecommitdiffstats
path: root/tests-perf
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2017-01-10 21:59:59 (GMT)
committersebres <sebres@users.sourceforge.net>2017-01-10 21:59:59 (GMT)
commit0e260c3cee3072b0b318b96c63a6242dec096972 (patch)
tree0c4808898402c98ab68d3d0ecf542d7b0dffb5e6 /tests-perf
parent58f947e48be58a2371a0d24f957244796306d2ba (diff)
downloadtcl-0e260c3cee3072b0b318b96c63a6242dec096972.zip
tcl-0e260c3cee3072b0b318b96c63a6242dec096972.tar.gz
tcl-0e260c3cee3072b0b318b96c63a6242dec096972.tar.bz2
[temp-commit]: ClockFreeScan almost ready, test-performance cases merged
Diffstat (limited to 'tests-perf')
-rw-r--r--tests-perf/clock.perf.tcl59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl
new file mode 100644
index 0000000..2e77a26
--- /dev/null
+++ b/tests-perf/clock.perf.tcl
@@ -0,0 +1,59 @@
+#!/usr/bin/tclsh
+# ------------------------------------------------------------------------
+#
+# test-performance.tcl --
+#
+# This file provides common performance tests for comparison of tcl-speed
+# degradation by switching between branches.
+# (currently for clock ensemble only)
+#
+# ------------------------------------------------------------------------
+#
+# Copyright (c) 2014 Serg G. Brester (aka sebres)
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file.
+#
+
+proc test-scan {{rep 100000}} {
+ foreach {comment c} {
+ "# FreeScan : relative date"
+ {clock scan "5 years 18 months 385 days" -base 0 -gmt 1}
+ "# FreeScan : time only with base"
+ {clock scan "19:18:30" -base 148863600 -gmt 1}
+ "# FreeScan : time only without base"
+ {clock scan "19:18:30" -gmt 1}
+ "# FreeScan : date, system time zone"
+ {clock scan "05/08/2016 20:18:30"}
+ "# FreeScan : date, supplied time zone"
+ {clock scan "05/08/2016 20:18:30" -timezone :CET}
+ "# FreeScan : date, supplied gmt (equivalent -timezone :GMT)"
+ {clock scan "05/08/2016 20:18:30" -gmt 1}
+ "# FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500)"
+ {clock scan "20:18:30 -0500" -base 148863600 -gmt 1}
+ "# FreeScan : time only, zone in string (exchange zones between system / gmt)"
+ {clock scan "19:18:30 GMT" -base 148863600}
+ } {
+ puts "\n% $comment\n% $c"
+ puts [clock format [{*}$c]]
+ puts [time $c $rep]
+ }
+}
+
+proc test-other {{rep 100000}} {
+ foreach {comment c} {
+ "# Bad zone"
+ {catch {clock scan "1 day" -timezone BAD_ZONE}}
+ } {
+ puts "\n% $comment\n% $c"
+ puts [if 1 $c]
+ puts [time $c $rep]
+ }
+}
+
+if 1 {;#
+ test-scan 100000
+ test-other 50000
+
+ puts \n**OK**
+};# \ No newline at end of file