new tester; all tests categorized
This commit is contained in:
parent
51ee524109
commit
20b5f31c03
481 changed files with 794 additions and 2506 deletions
|
|
@ -1,36 +0,0 @@
|
|||
discard """
|
||||
output: "0false12"
|
||||
"""
|
||||
|
||||
# Test multiple generic instantiation of generic proc vars:
|
||||
|
||||
proc threadProcWrapper[TMsg]() =
|
||||
var x: TMsg
|
||||
stdout.write($x)
|
||||
|
||||
#var x = threadProcWrapper[int]
|
||||
#x()
|
||||
|
||||
#var y = threadProcWrapper[bool]
|
||||
#y()
|
||||
|
||||
threadProcWrapper[int]()
|
||||
threadProcWrapper[bool]()
|
||||
|
||||
type
|
||||
TFilterProc[T,D] = proc (item: T, env:D): bool {.nimcall.}
|
||||
|
||||
proc filter[T,D](data: seq[T], env:D, pred: TFilterProc[T,D]): seq[T] =
|
||||
result = @[]
|
||||
for e in data:
|
||||
if pred(e, env): result.add(e)
|
||||
|
||||
proc predTest(item: int, value: int): Bool =
|
||||
return item <= value
|
||||
|
||||
proc test(data: seq[int], value: int): seq[int] =
|
||||
return filter(data, value, predTest)
|
||||
|
||||
for x in items(test(@[1,2,3], 2)):
|
||||
stdout.write(x)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue