forked from facebookincubator/hsthrift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSocketChannelTest.hs
39 lines (30 loc) · 1008 Bytes
/
SocketChannelTest.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- Copyright (c) Facebook, Inc. and its affiliates.
module SocketChannelTest where
import Network.Socket (maxListenQueue)
import TestRunner
import Test.HUnit hiding (State)
import Thrift.Api
import Thrift.Channel
import Thrift.Channel.SocketChannel.Server
import Thrift.Protocol.Id
import Math.Calculator.Client
import TestCommon
main :: IO ()
main = testRunner . TestList $
runChannelTests mkClientTestSockWith
[ addTest, divTest, putGetTest, putPutGetTest
, exceptionTest, unimplementedTest, multiTest ]
-- Client utilities ------------------------------------------------------------
mkClientTestSock
:: String
-> Thrift Calculator ()
-> Test
mkClientTestSock lbl = mkClientTestSockWith lbl defaultRpcOptions
mkClientTestSockWith
:: String
-> RpcOptions
-> Thrift Calculator ()
-> Test
mkClientTestSockWith lbl _opts action = TestLabel lbl $ TestCase $ do
state <- initServerState
withServer binaryProtocolId Nothing maxListenQueue (processCommand state) action