summaryrefslogtreecommitdiff
path: root/tests/Shared.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Shared.hs')
-rw-r--r--tests/Shared.hs50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/Shared.hs b/tests/Shared.hs
new file mode 100644
index 00000000..e0e5268c
--- /dev/null
+++ b/tests/Shared.hs
@@ -0,0 +1,50 @@
1{-# LANGUAGE OverloadedStrings #-}
2module Shared
3 (echoM, echoBytes, unitM, swapM, reverseM, shiftR
4 ) where
5
6import Data.ByteString (ByteString)
7import Remote.KRPC
8
9unitM :: Method () ()
10unitM = method "unit" [] []
11
12echoM :: Method Int Int
13echoM = method "echo" ["x"] ["x"]
14
15echoBytes :: Method ByteString ByteString
16echoBytes = method "echoBytes" ["x"] ["x"]
17
18reverseM :: Method [Int] [Int]
19reverseM = method "reverse" ["xs"] ["ys"]
20
21swapM :: Method (Int, Int) (Int, Int)
22swapM = method "swap" ["x", "y"] ["b", "a"]
23
24shiftR :: Method ((), Int, [Int]) ([Int], (), Int)
25shiftR = method "shiftR" ["x", "y", "z"] ["a", "b", "c"]
26
27
28
29{-
30type NodeId = Int
31type InfoHashe = Int
32type NodeAddr = Int
33type Token = Int
34type
35
36ping :: Method NodeId NodeId
37ping = method "ping" ["id"] ["id"]
38
39find_node :: Method (NodeId, NodeId) (NodeId, NodeAddr)
40find_node = method "find_node" ["id", "target"] ["id", "nodes"]
41
42get_peers :: Method (NodeId :*: InfoHash) (NodeId, Token, NodeAddr :|: NodeAddr)
43get_peers = method "get_peers"
44 ("id", "target")
45 ("id", "token", view ("values" :|: "nodes"))
46view :: BEncodable -> Maybe BEncodable
47view = undefined
48announce_peer :: Method (NodeId, InfoHash, PortNumber, Token) NodeId
49announce_peer = undefined
50-} \ No newline at end of file