diff options
author | sebres <sebres@users.sourceforge.net> | 2019-07-15 11:34:53 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2019-07-15 11:34:53 (GMT) |
commit | 140064bf12fdf57b87abdbcadb7c8d62b843c309 (patch) | |
tree | 923743d311a09d68581ad80f1bfda5a477c8f3e2 | |
parent | 7357639c2bbdcdb6ebd6028d9764fa723a3f8660 (diff) | |
parent | 8324e0015df62351375e81975bbb928a3ffec5db (diff) | |
download | tcl-140064bf12fdf57b87abdbcadb7c8d62b843c309.zip tcl-140064bf12fdf57b87abdbcadb7c8d62b843c309.tar.gz tcl-140064bf12fdf57b87abdbcadb7c8d62b843c309.tar.bz2 |
merge 8.5
-rw-r--r-- | tests-perf/clock.perf.tcl | 10 | ||||
-rw-r--r-- | tests-perf/test-performance.tcl | 21 |
2 files changed, 20 insertions, 11 deletions
diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index f80746f..c0da0ab 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -122,7 +122,7 @@ proc test-format {{reptime 1000}} { } proc test-scan {{reptime 1000}} { - _test_run $reptime { + _test_run -convert-result {clock format $_(r) -locale en} $reptime { # Scan : date (in gmt) {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} # Scan : date (system time zone, with base) @@ -198,11 +198,11 @@ proc test-scan {{reptime 1000}} { # {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} # # Scan : again: # {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} - } {puts [clock format $_(r) -locale en]} + } } proc test-freescan {{reptime 1000}} { - _test_run $reptime { + _test_run -convert-result {clock format $_(r) -locale en} $reptime { # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} # FreeScan : relative date with relative weekday @@ -239,7 +239,7 @@ proc test-freescan {{reptime 1000}} { {clock scan "19:18:30 MST" -base 148863600 -gmt 1 clock scan "19:18:30 EST" -base 148863600 } - } {puts [clock format $_(r) -locale en]} + } } proc test-add {{reptime 1000}} { @@ -282,7 +282,7 @@ proc test-add {{reptime 1000}} { if {[catch {clock add 0 3 weekdays -gmt 1}]} { regsub -all {\mweekdays\M} $tests "days" tests } - _test_run $reptime $tests {puts [clock format $_(r) -locale en]} + _test_run -convert-result {clock format $_(r) -locale en} $reptime $tests } proc test-convert {{reptime 1000}} { diff --git a/tests-perf/test-performance.tcl b/tests-perf/test-performance.tcl index 78189e6..a715c8a 100644 --- a/tests-perf/test-performance.tcl +++ b/tests-perf/test-performance.tcl @@ -127,15 +127,23 @@ proc _adjust_maxcount {reptime maxcount} { proc _test_run {args} { upvar _ _ # parse args: - array set _ [set _opts {-no-result 0 -uplevel 0}] + array set _ {-no-result 0 -uplevel 0 -convert-result {}} while {[llength $args] > 2} { - if {[set o [lindex $args 0]] ni $_opts || $_($o)} { + if {![info exists _([set o [lindex $args 0]])]} { break } - set _($o) 1 - set args [lrange $args 1 end] + if {[string is boolean -strict $_($o)]} { + set _($o) [expr {! $_($o)}] + set args [lrange $args 1 end] + } else { + if {[llength $args] <= 2} { + return -code error "value expected for option $o" + } + set _($o) [lindex $args 1] + set args [lrange $args 2 end] + } } - unset -nocomplain _opts o + unset -nocomplain o if {[llength $args] < 2 || [llength $args] > 3} { return -code error "wrong # args: should be \"[lindex [info level [info level]] 0] ?-no-result? reptime lst ?outcmd?\"" } @@ -173,7 +181,8 @@ proc _test_run {args} { # if output result (and not once): if {!$_(-no-result)} { set _(r) [if 1 $_(c)] - if {$_(outcmd) ne {}} {{*}$_(outcmd) $_(r)} + if {$_(-convert-result) ne ""} { set _(r) [if 1 $_(-convert-result)] } + {*}$_(outcmd) $_(r) if {[llength $_(ittime)] > 1} { # decrement max-count lset _(ittime) 1 [expr {[lindex $_(ittime) 1] - 1}] } |