Use check in tests

This commit is contained in:
Ehmry - 2019-04-03 21:29:27 +02:00
parent 0aab9f20dc
commit 00f72b78e4
2 changed files with 16 additions and 16 deletions

View File

@ -54,9 +54,9 @@ suite "store":
blob = blobHash newString(i)
var found = false
apply(client, bs, name) do (id: BlobId; size: BiggestInt):
doAssert(id == blob)
check(id == blob)
found = true
doAssert(found)
check(found)
for i in 1..count:
let
i = i and 0x8000
@ -89,7 +89,7 @@ suite "store":
complete stream
found = true
inc count
doAssert(count > 0, "FutureStream is fucked")
doAssert(found, $i & " not found in set")
check(count > 0)
check(found)
echo "found ", i, " after ", count
waitFor findAll()

View File

@ -9,7 +9,7 @@ suite "Blob set tests":
randomCid = blobHash("")
# test "zero blob":
# doAssert(randomCid == zeroChunk)
# check(randomCid == zeroChunk)
proc randomize() =
randomCid = blobHash(randomCid.toHex)
@ -20,25 +20,25 @@ suite "Blob set tests":
let
blob = randomCid
str = $randomCid
doAssert(str.toBlobid == randomCid)
check(str.toBlobid == randomCid)
result = waitFor insert(store, s, path, blob, 0)
var found = false
apply(store, result, path) do (id: BlobId; size: BiggestInt):
doAssert(id == randomCid)
check(id == randomCid)
found = true
doAssert(found)
check(found)
test "functional insert":
let
a = newBlobSet()
b = waitFor insert(store, a, "foo", randomCid, 0)
c = waitFor insert(store, b, "bar", randomCid, 0)
doAssert(contains(store, b, "foo"))
doAssert(contains(store, c, "foo"))
doAssert(contains(store, c, "bar"))
doAssert(not contains(store, a, "foo"))
doAssert(not contains(store, a, "bar"))
doAssert(not contains(store, b, "bar"))
check(contains(store, b, "foo"))
check(contains(store, c, "foo"))
check(contains(store, c, "bar"))
check(not contains(store, a, "foo"))
check(not contains(store, a, "bar"))
check(not contains(store, b, "bar"))
test "apply":
var bs = newBlobSet()
@ -52,7 +52,7 @@ suite "Blob set tests":
name = $i
blob = blobHash name
apply(store, bs, name) do (id: BlobId; size: BiggestInt):
doAssert(id == blob)
check(id == blob)
test "remove":
var bs = newBlobSet()
@ -64,7 +64,7 @@ suite "Blob set tests":
for i in 1..1024:
let name = $i
bs = waitFor remove(store, bs, name)
doAssert(not contains(store, bs, name))
check(not contains(store, bs, name))
test "sets":
var s = newBlobSet()