Turn some test outputs into actual tests

This commit is contained in:
Oleh Prypin 2015-04-21 15:45:30 +03:00
commit 22db40e5e4
13 changed files with 84 additions and 52 deletions

View file

@ -286,6 +286,8 @@ proc `$`*[T](c: CritBitTree[T]): string =
result.add("}")
when isMainModule:
import sequtils
var r: CritBitTree[void]
r.incl "abc"
r.incl "xyz"
@ -295,12 +297,8 @@ when isMainModule:
doAssert r.contains"def"
when not defined(testing):
#r.del "def"
r.excl "def"
for w in r.items:
echo w
for w in r.itemsWithPrefix("de"):
echo w
assert toSeq(r.items) == @["abc", "definition", "prefix", "xyz"]
assert toSeq(r.itemsWithPrefix("de")) == @["definition"]