mirror of https://github.com/status-im/nim-eth.git
Add whisper encode decode test and rename rlp test
This commit is contained in:
parent
0874f41a53
commit
94dee80aeb
|
@ -0,0 +1,18 @@
|
|||
import
|
||||
options, sequtils, chronicles,
|
||||
eth/p2p/rlpx_protocols/whisper_protocol as whisper,
|
||||
../fuzztest
|
||||
|
||||
test:
|
||||
let
|
||||
data = @payload.distribute(2)
|
||||
whisperPayload = Payload(payload: data[0], padding: some(data[1]))
|
||||
encoded = whisper.encode(whisperPayload)
|
||||
|
||||
decoded = whisper.decode(encoded.get())
|
||||
|
||||
doAssert data[0] == decoded.get().payload
|
||||
if data[1].len > 0:
|
||||
doAssert data[1] == decoded.get().padding.get()
|
||||
else:
|
||||
doAssert decoded.get().padding.isNone()
|
Loading…
Reference in New Issue