nwaku/tests/testlib/assertions.nim
Álex a3fa175054
test(rln): Implement rln tests (#2639)
* Implement tests.
* Clean coding.
2024-08-02 16:43:22 +02:00

15 lines
433 B
Nim

import chronos
template assertResultOk*[T, E](result: Result[T, E]) =
assert result.isOk(), $result.error()
template assertResultOk*(result: Result[void, string]) =
assert result.isOk(), $result.error()
template typeEq*(t: typedesc, u: typedesc): bool =
# <a is b> is also true if a is subtype of b
t is u and u is t # Only true if actually equal types
template typeEq*(t: auto, u: typedesc): bool =
typeEq(type(t), u)