diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Client.hs | 4 | ||||
-rw-r--r-- | tests/Server.hs | 2 | ||||
-rw-r--r-- | tests/Shared.hs | 12 |
3 files changed, 17 insertions, 1 deletions
diff --git a/tests/Client.hs b/tests/Client.hs index d762976d..1b9ef8d2 100644 --- a/tests/Client.hs +++ b/tests/Client.hs | |||
@@ -4,6 +4,7 @@ module Main (main) where | |||
4 | import Control.Concurrent | 4 | import Control.Concurrent |
5 | import Control.Exception | 5 | import Control.Exception |
6 | import qualified Data.ByteString as B | 6 | import qualified Data.ByteString as B |
7 | import Data.BEncode | ||
7 | import System.Environment | 8 | import System.Environment |
8 | import System.Process | 9 | import System.Process |
9 | import System.FilePath | 10 | import System.FilePath |
@@ -65,4 +66,7 @@ tests = | |||
65 | , testCase "echo bytestring" $ | 66 | , testCase "echo bytestring" $ |
66 | let bs = B.replicate 400 0 in | 67 | let bs = B.replicate 400 0 in |
67 | bs ==? call addr echoBytes bs | 68 | bs ==? call addr echoBytes bs |
69 | |||
70 | , testCase "raw method" $ | ||
71 | BInteger 10 ==? call addr rawM (BInteger 10) | ||
68 | ] | 72 | ] |
diff --git a/tests/Server.hs b/tests/Server.hs index f636b0be..7cd6a5d6 100644 --- a/tests/Server.hs +++ b/tests/Server.hs | |||
@@ -1,6 +1,7 @@ | |||
1 | {-# LANGUAGE IncoherentInstances #-} | 1 | {-# LANGUAGE IncoherentInstances #-} |
2 | module Main (main) where | 2 | module Main (main) where |
3 | 3 | ||
4 | import Data.BEncode | ||
4 | import Remote.KRPC | 5 | import Remote.KRPC |
5 | import Shared | 6 | import Shared |
6 | 7 | ||
@@ -13,4 +14,5 @@ main = server 6000 | |||
13 | , swapM ==> \(a, b) -> return (b, a) | 14 | , swapM ==> \(a, b) -> return (b, a) |
14 | , reverseM ==> return . reverse | 15 | , reverseM ==> return . reverse |
15 | , shiftR ==> \(a, b, c) -> return (c, a, b) | 16 | , shiftR ==> \(a, b, c) -> return (c, a, b) |
17 | , rawM ==> return | ||
16 | ] | 18 | ] |
diff --git a/tests/Shared.hs b/tests/Shared.hs index bf29365b..a04b6093 100644 --- a/tests/Shared.hs +++ b/tests/Shared.hs | |||
@@ -1,9 +1,16 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | 1 | {-# LANGUAGE OverloadedStrings #-} |
2 | module Shared | 2 | module Shared |
3 | (echoM, echoBytes, unitM, swapM, reverseM, shiftR | 3 | ( echoM |
4 | , echoBytes | ||
5 | , unitM | ||
6 | , swapM | ||
7 | , reverseM | ||
8 | , shiftR | ||
9 | , rawM | ||
4 | ) where | 10 | ) where |
5 | 11 | ||
6 | import Data.ByteString (ByteString) | 12 | import Data.ByteString (ByteString) |
13 | import Data.BEncode | ||
7 | import Remote.KRPC | 14 | import Remote.KRPC |
8 | 15 | ||
9 | unitM :: Method () () | 16 | unitM :: Method () () |
@@ -23,3 +30,6 @@ swapM = method "swap" ["x", "y"] ["b", "a"] | |||
23 | 30 | ||
24 | shiftR :: Method ((), Int, [Int]) ([Int], (), Int) | 31 | shiftR :: Method ((), Int, [Int]) ([Int], (), Int) |
25 | shiftR = method "shiftR" ["x", "y", "z"] ["a", "b", "c"] | 32 | shiftR = method "shiftR" ["x", "y", "z"] ["a", "b", "c"] |
33 | |||
34 | rawM :: Method BEncode BEncode | ||
35 | rawM = method "rawM" [""] [""] \ No newline at end of file | ||