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