Improved test for #6.

This commit is contained in:
cheatfate 2018-08-06 22:33:52 +03:00
parent 9fb0eb8f36
commit 44565b398e
1 changed files with 6 additions and 1 deletions

View File

@ -20,7 +20,12 @@ type
proc udp4DataAvailable(transp: DatagramTransport, proc udp4DataAvailable(transp: DatagramTransport,
remote: TransportAddress): Future[void] {.async, gcsafe.} = remote: TransportAddress): Future[void] {.async, gcsafe.} =
var udata = getUserData[CustomData](transp) var udata = getUserData[CustomData](transp)
if udata.test == "CHECK": var expect = TEST_MSG
var data: seq[byte]
var datalen: int
transp.peekMessage(data, datalen)
if udata.test == "CHECK" and datalen == MSG_LEN and
equalMem(addr data[0], addr expect[0], datalen):
udata.test = "OK" udata.test = "OK"
transp.close() transp.close()