parse ASN.1 representation of load querying
includes tests contributes to #71
This commit is contained in:
parent
ddea599022
commit
41aaa8ff70
3 changed files with 59 additions and 0 deletions
|
@ -221,6 +221,14 @@ spec = do
|
|||
, exampleNodeState {nid = fromInteger (-5)}
|
||||
]
|
||||
}
|
||||
qLoadReqPayload = LoadRequestPayload
|
||||
{ loadLowerBound = fromInteger 12
|
||||
, loadUpperBound = fromInteger 1025
|
||||
}
|
||||
qLoadResPayload = LoadResponsePayload
|
||||
{ loadSum = 3.141
|
||||
, loadRemainingTarget = -1.337
|
||||
}
|
||||
requestTemplate = Request {
|
||||
requestID = 2342
|
||||
, sender = exampleNodeState
|
||||
|
@ -259,6 +267,8 @@ spec = do
|
|||
encodeDecodeAndCheck $ responseWith Leave lResPayload
|
||||
encodeDecodeAndCheck $ responseWith Stabilise stabResPayload
|
||||
encodeDecodeAndCheck $ responseWith Ping pingResPayload
|
||||
encodeDecodeAndCheck $ requestWith QueryLoad qLoadReqPayload
|
||||
encodeDecodeAndCheck $ responseWith QueryLoad qLoadResPayload
|
||||
it "messages are encoded and decoded to ASN.1 DER properly" $
|
||||
deserialiseMessage (fromJust $ Map.lookup 1 (serialiseMessage 652 $ responseWith Ping pingResPayload)) `shouldBe` Right (responseWith Ping pingResPayload)
|
||||
it "messages too large for a single packet can (often) be split into multiple parts" $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue