mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-03-30 20:45:52 +00:00
* binary SMP protocol encoding (server tests fail) * use 1 byte for bytestring length when encoding/decoding * Encoding class, binary tags * update server tests * negotiate SMP version in client/server handshake * add version columns to queues and connections * split parsing SMP client commands and server responses to different functions * check uniqueness of protocol tags * split client commands and server responses/messages to separate types * update types in SMP client * remove pattern synonyms for SMP errors * simplify getHandshake * update SMP protocol encoding in protocol spec * encode time as a number of seconds (64-bit integer) since epoch
19 lines
800 B
Haskell
19 lines
800 B
Haskell
module CoreTests.ProtocolErrorTests where
|
|
|
|
import Simplex.Messaging.Agent.Protocol (AgentErrorType, agentErrorTypeP, serializeAgentError, serializeSmpErrorType, smpErrorTypeP)
|
|
import Simplex.Messaging.Parsers (parseAll)
|
|
import Simplex.Messaging.Protocol (ErrorType)
|
|
import Test.Hspec
|
|
import Test.Hspec.QuickCheck (modifyMaxSuccess)
|
|
import Test.QuickCheck
|
|
|
|
protocolErrorTests :: Spec
|
|
protocolErrorTests = modifyMaxSuccess (const 1000) $ do
|
|
describe "errors parsing / serializing" $ do
|
|
it "should parse SMP protocol errors" . property $ \err ->
|
|
parseAll smpErrorTypeP (serializeSmpErrorType err)
|
|
== Right (err :: ErrorType)
|
|
it "should parse SMP agent errors" . property $ \err ->
|
|
parseAll agentErrorTypeP (serializeAgentError err)
|
|
== Right (err :: AgentErrorType)
|