zeromq-haskell 0.8.2 → 0.8.3
raw patch · 4 files changed
+17/−3 lines, 4 files
Files
- README.md +2/−0
- src/System/ZMQ.hs +2/−2
- tests/System/ZMQ/Test/Properties.hs +12/−0
- zeromq-haskell.cabal +1/−1
README.md view
@@ -5,6 +5,8 @@ This software currently has *beta* status, i.e. it had seen limited testing. +Version 0.8.3 - Derive Read in SocketOption and PollEvent.+ Version 0.8.2 - Revert changes to support 0MQ 2.x as well as 3.x in a single package. Instead git branches will be used to track the various 0MQ versions and a separate zeromq-haskell-3 library will be released to hackage.
src/System/ZMQ.hs view
@@ -208,7 +208,7 @@ | McastLoop Bool -- ^ ZMQ_MCAST_LOOP | RecoveryIVLMsec Int64 -- ^ ZMQ_RECOVERY_IVL_MSEC | Swap Int64 -- ^ ZMQ_SWAP- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Read) -- | The events to wait for in poll (cf. man zmq_poll) data PollEvent =@@ -217,7 +217,7 @@ | InOut -- ^ ZMQ_POLLIN | ZMQ_POLLOUT | Native -- ^ ZMQ_POLLERR | None- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Read) -- | Type representing a descriptor, poll is waiting for -- (either a 0MQ socket or a file descriptor) plus the type
tests/System/ZMQ/Test/Properties.hs view
@@ -46,6 +46,7 @@ testProperty "msg send == msg received (Req/Rep)" (prop_send_receive ZMQ.Req ZMQ.Rep) , testProperty "msg send == msg received (Push/Pull)" (prop_send_receive ZMQ.Push ZMQ.Pull) , testProperty "msg send == msg received (Pair/Pair)" (prop_send_receive ZMQ.Pair ZMQ.Pair)+ , testProperty "publish/subscribe (Pub/Sub)" (prop_pub_sub ZMQ.Pub ZMQ.Sub) ] ] @@ -82,6 +83,17 @@ ZMQ.receive receiver [] assert (msg == msg') +prop_pub_sub :: (ZMQ.SType a, ZMQ.SubsType b, ZMQ.SType b) => a -> b -> ByteString -> Property+prop_pub_sub a b msg = monadicIO $ do+ msg' <- run $ ZMQ.withContext 0 $ \c ->+ ZMQ.withSocket c a $ \pub ->+ ZMQ.withSocket c b $ \sub -> do+ ZMQ.subscribe sub ""+ ZMQ.bind sub "inproc://endpoint"+ ZMQ.connect pub "inproc://endpoint"+ ZMQ.send pub msg []+ ZMQ.receive sub []+ assert (msg == msg') instance Arbitrary ZMQ.SocketOption where arbitrary = oneof [ ZMQ.Affinity . fromIntegral <$> (arbitrary :: Gen Word64)
zeromq-haskell.cabal view
@@ -1,5 +1,5 @@ name: zeromq-haskell-version: 0.8.2+version: 0.8.3 synopsis: Bindings to ZeroMQ 2.1.x category: System, FFI license: MIT