Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
This commit is contained in:
commit
5d4c048705
10 changed files with 115 additions and 31 deletions
17
tests/collections/tsets.nim
Normal file
17
tests/collections/tsets.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
discard """
|
||||
output: '''true
|
||||
true'''
|
||||
"""
|
||||
|
||||
import sets
|
||||
var
|
||||
a = initSet[int]()
|
||||
b = initSet[int]()
|
||||
c = initSet[string]()
|
||||
|
||||
for i in 0..5: a.incl(i)
|
||||
for i in 1..6: b.incl(i)
|
||||
for i in 0..5: c.incl($i)
|
||||
|
||||
echo map(a, proc(x: int): int = x + 1) == b
|
||||
echo map(a, proc(x: int): string = $x) == c
|
||||
20
tests/generics/tinferredgenericprocs.nim
Normal file
20
tests/generics/tinferredgenericprocs.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
discard """
|
||||
output: '''123
|
||||
1
|
||||
2
|
||||
3'''
|
||||
"""
|
||||
|
||||
# https://github.com/Araq/Nimrod/issues/797
|
||||
proc foo[T](s:T):string = $s
|
||||
|
||||
type IntStringProc = proc(x: int): string
|
||||
|
||||
var f1 = IntStringProc(foo)
|
||||
var f2: proc(x: int): string = foo
|
||||
var f3: IntStringProc = foo
|
||||
|
||||
echo f1(1), f2(2), f3(3)
|
||||
|
||||
for x in map([1,2,3], foo): echo x
|
||||
|
||||
12
tests/sets/tsets_lt.nim
Normal file
12
tests/sets/tsets_lt.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
discard """
|
||||
output: '''true
|
||||
true
|
||||
true'''
|
||||
"""
|
||||
|
||||
var s, s1: set[char]
|
||||
s = {'a'..'d'}
|
||||
s1 = {'a'..'c'}
|
||||
echo s1 < s
|
||||
echo s1 * s == {'a'..'c'}
|
||||
echo s1 <= s
|
||||
Loading…
Add table
Add a link
Reference in a new issue