Commit 9609a451 authored by Benjamin Summerton's avatar Benjamin Summerton

Cleanup extra whitespace in tester code

parent ff00839a
......@@ -3,7 +3,7 @@ from sequtils import map
# Choose where to get the "sleep" function from
when defined(js):
# NOTE: This isn't giving me the result I want...
proc sleep(ms: int) =
{.emit: ["return new Promise(resolve => setTimeout(resolve,", ms, "));"].}
......@@ -24,26 +24,26 @@ var
proc test() =
# Print a message
echo "Testing with laps ", (if recordLaps: "on." else: "off.")
# Init the stopwatch and go
sw = stopwatch(recordLaps)
echo "laps=", sw.laps(true)
echo "total=", sw.totalSecs
sw.start()
echo "laps=", sw.laps(true)
sleep(1000)
echo "total=", sw.totalSecs
sw.stop()
echo sw.secs
#echo sw.msecs
#echo sw.usecs
#echo sw.nsecs
echo "total=", sw.totalSecs
echo ""
sw.start()
sleep(500)
echo "total=", sw.totalSecs
......@@ -52,7 +52,7 @@ proc test() =
echo sw.secs
echo "total=", sw.totalSecs
echo ""
sw.start()
echo sw.secs
sleep(100)
......@@ -69,9 +69,9 @@ proc test() =
echo sw.secs
echo "total=", sw.totalSecs
echo ""
var sw2 = sw.clone()
echo "lapCount=", sw.numLaps
echo "L1=", sw.lap(0).secs
echo "L2=", if sw.isRecordingLaps: sw.laps()[1].secs else: 0
......@@ -80,12 +80,12 @@ proc test() =
echo "lapCount=", sw.numLaps
echo "----"
echo "lapCount=", sw2.numLaps
var lapsSecs = sw2.laps().map(proc(x: int64): float = secs(x))
echo "all laps(s)=", lapsSecs
echo ""
sw.reset()
echo "lapCount=", sw.numLaps
sw.start()
......@@ -99,10 +99,10 @@ proc test() =
echo "total(u)=", sw.totalUsecs
echo "total(n)=", sw.totalNsecs
echo ""
bench(sw, sleep(1000))
echo "bench(sleep(1000))=", sw.secs
# Test with laps or no laps via an argument (non-js only)
......@@ -119,5 +119,3 @@ else:
recordLaps = false
test()
......@@ -23,23 +23,23 @@ proc test() =
# Print a message
echo "Testing with laps ", (if recordLaps: "on." else: "off.")
# Init the stopwatch and go
sw = stopwatch(recordLaps)
echo "laps=", sw.laps(true)
echo "total=", sw.totalSecs
sw.start()
echo "laps=", sw.laps(true)
sleep(1000)
echo "total=", sw.totalSecs
sw.stop()
echo sw.secs
echo "total=", sw.totalSecs
echo ""
sw.start()
sleep(500)
echo "total=", sw.totalSecs
......@@ -48,7 +48,7 @@ proc test() =
echo sw.secs
echo "total=", sw.totalSecs
echo ""
sw.start()
echo sw.secs
sleep(100)
......@@ -63,9 +63,9 @@ proc test() =
echo sw.secs
echo "total=", sw.totalSecs
echo ""
var sw2 = sw.clone()
echo "lapCount=", sw.numLaps
echo "L1=", sw.lap(0).secs
echo "L2=", if sw.isRecordingLaps: sw.laps()[1].secs else: 0
......@@ -74,12 +74,12 @@ proc test() =
echo "lapCount=", sw.numLaps
echo "----"
echo "lapCount=", sw2.numLaps
var lapsSecs = sw2.laps().map(proc(x: int): float = secs(x))
echo "all laps(s)=", lapsSecs
echo ""
sw.reset()
echo "lapCount=", sw.numLaps
sw.start()
......@@ -91,10 +91,10 @@ proc test() =
echo "total(s)=", sw.totalSecs
echo "total(m)=", sw.totalMsecs
echo ""
bench(sw, sleep(1000))
echo "bench(sleep(1000))=", sw.secs
# Call test inside body.onload for browser JS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment