Merge pull request #2122 from c-blake/devel

Update collections/tables.nim as with sets.nim
This commit is contained in:
Andreas Rumpf 2015-02-15 15:04:04 +01:00
commit 3fc100276c
4 changed files with 162 additions and 78 deletions

View file

@ -47,7 +47,7 @@ block tableTest1:
for y in 0..1:
assert t[(x,y)] == $x & $y
assert($t ==
"{(x: 0, y: 0): 00, (x: 0, y: 1): 01, (x: 1, y: 0): 10, (x: 1, y: 1): 11}")
"{(x: 0, y: 1): 01, (x: 0, y: 0): 00, (x: 1, y: 0): 10, (x: 1, y: 1): 11}")
block tableTest2:
var t = initTable[string, float]()

View file

@ -302,7 +302,7 @@ template build_specification_lookup():
## Returns the table used to keep pointers to all of the specifications.
var result {.gensym.}: OrderedTable[string, ptr Tparameter_specification]
result = initOrderedTable[string, ptr Tparameter_specification](
nextPowerOfTwo(expected.len))
tables.rightSize(expected.len))
for i in 0..expected.len-1:
for param_to_detect in expected[i].names:
if result.hasKey(param_to_detect):