add total count to test helpers

This commit is contained in:
andri lim 2018-12-26 11:19:14 +07:00 committed by zah
parent 6a24701bbf
commit 83e01994df
1 changed files with 10 additions and 0 deletions

View File

@ -173,6 +173,9 @@ macro jsonTest*(s: static[string], handler: untyped): untyped =
let `symbol`: array[Status, string] = ["+", "-", " "]
var raw = ""
var okCountTotal = 0
var failCountTotal = 0
var skipCountTotal = 0
raw.add(`s` & "\n")
raw.add("===\n")
for folder, statuses in status:
@ -192,7 +195,14 @@ macro jsonTest*(s: static[string], handler: untyped): untyped =
of Status.Skip: skipCount += 1
raw.add("```\n")
let sum = okCount + failCount + skipCount
okCountTotal += okCount
failCountTotal += failCount
skipCountTotal += skipCount
raw.add("OK: " & $okCount & "/" & $sum & " Fail: " & $failCount & "/" & $sum & " Skip: " & $skipCount & "/" & $sum & "\n")
let sumTotal = okCountTotal + failCountTotal + skipCountTotal
raw.add("\n---TOTAL---\n")
raw.add("OK: $1/$4 Fail: $2/$4 Skip: $3/$4\n" % [$okCountTotal, $failCountTotal, $skipCountTotal, $sumTotal])
writeFile(`s` & ".md", raw)
func ethAddressFromHex*(s: string): EthAddress = hexToByteArray(s, result)