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

View File

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