nimbus-eth1/hive_integration/nodocker/engine/types.nim

52 lines
876 B
Nim

import
std/options,
test_env,
unittest2,
web3/ethtypes,
../../../nimbus/merge/mergeutils
export ethtypes
type
TestSpec* = object
name*: string
run*: proc(t: TestEnv): TestStatus
ttd*: int64
chainFile*: string
slotsToFinalized*: int
slotsToSafe*: int
enableAuth*: bool
template testCond*(expr: untyped) =
if not (expr):
when result is bool:
return false
else:
return TestStatus.Failed
template testCond*(expr, body: untyped) =
if not (expr):
body
when result is bool:
return false
else:
return TestStatus.Failed
proc `$`*(x: Option[Hash256]): string =
if x.isNone:
"none"
else:
$x.get()
proc `$`*(x: Option[BlockHash]): string =
if x.isNone:
"none"
else:
$x.get()
proc `$`*(x: Option[PayloadID]): string =
if x.isNone:
"none"
else:
x.get().toHex