Add whisper encode decode test and rename rlp test

This commit is contained in:
kdeme 2019-10-02 11:55:49 +02:00 committed by zah
parent 0874f41a53
commit 94dee80aeb
2 changed files with 18 additions and 0 deletions

View File

@ -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()