make tests green again
This commit is contained in:
parent
ddc131cf07
commit
e8eb496e6f
2 changed files with 9 additions and 9 deletions
|
|
@ -19,7 +19,7 @@ proc nrow*(dt: DataTable) : Natural =
|
||||||
return totalLen
|
return totalLen
|
||||||
|
|
||||||
let
|
let
|
||||||
stud = Students (id : @[1,2,3], name : @["Vas", "Pas", "NafNaf"], age : @[10,16,32])
|
stud = Students(id : @[1,2,3], name : @["Vas", "Pas", "NafNaf"], age : @[10,16,32])
|
||||||
|
|
||||||
echo nrow(stud)
|
echo nrow(stud)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,29 +23,29 @@ asm """
|
||||||
"""
|
"""
|
||||||
|
|
||||||
proc consoleprint (str:cstring): void {.importc: "print", noDecl.}
|
proc consoleprint (str:cstring): void {.importc: "print", noDecl.}
|
||||||
proc print* (a: varargs[string, `$`]) = consoleprint "$1: $2" % [consolePrefix, join (a, " ")]
|
proc print* (a: varargs[string, `$`]) = consoleprint "$1: $2" % [consolePrefix, join(a, " ")]
|
||||||
|
|
||||||
type CallbackProc {.importc.} = proc () : cstring
|
type CallbackProc {.importc.} = proc () : cstring
|
||||||
|
|
||||||
proc regCallback (fn:CallbackProc) {.importc.}
|
proc regCallback (fn:CallbackProc) {.importc.}
|
||||||
proc runCallbacks ():cstring {.importc.}
|
proc runCallbacks ():cstring {.importc.}
|
||||||
|
|
||||||
proc `*` (s:string, n:Natural) : string = s.repeat (n)
|
proc `*` (s:string, n:Natural) : string = s.repeat(n)
|
||||||
|
|
||||||
proc outer (i:Natural) : (string, int) =
|
proc outer (i:Natural) : (string, int) =
|
||||||
let c = $char (random (93) + 33)
|
let c = $char(random(93) + 33)
|
||||||
let n = random (40)
|
let n = random(40)
|
||||||
let s = c * n
|
let s = c * n
|
||||||
proc inner () : cstring = ("[$1]" % $n) & s & " <--"
|
proc inner(): cstring = ("[$1]" % $n) & s & " <--"
|
||||||
regCallback (inner)
|
regCallback(inner)
|
||||||
return (s, n)
|
return (s, n)
|
||||||
|
|
||||||
var expected = "\n"
|
var expected = "\n"
|
||||||
for i in 1 .. 10:
|
for i in 1 .. 10:
|
||||||
let (s, n) = outer (i)
|
let (s, n) = outer(i)
|
||||||
expected &= ("($1)[$2]" % [$i, $n]) & s & " <--"
|
expected &= ("($1)[$2]" % [$i, $n]) & s & " <--"
|
||||||
expected &= "\n"
|
expected &= "\n"
|
||||||
|
|
||||||
let results = runCallbacks ()
|
let results = runCallbacks()
|
||||||
|
|
||||||
doAssert(expected == results)
|
doAssert(expected == results)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue