summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-07-08 21:03:55 +0400
committerSam T <pxqr.sta@gmail.com>2013-07-08 21:03:55 +0400
commit2be391c59deb670fd8084c6bd0fa9c2cbe2fd5cf (patch)
tree8f3e7c6b6f418273e53b4cde5bb2dcbb12cc83d1 /tests
parentbbd7e81df12a15c588e1b38627983e8bddc42367 (diff)
~ Add test case, fix cabal.
Diffstat (limited to 'tests')
-rw-r--r--tests/Client.hs4
-rw-r--r--tests/Server.hs2
-rw-r--r--tests/Shared.hs12
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
4import Control.Concurrent 4import Control.Concurrent
5import Control.Exception 5import Control.Exception
6import qualified Data.ByteString as B 6import qualified Data.ByteString as B
7import Data.BEncode
7import System.Environment 8import System.Environment
8import System.Process 9import System.Process
9import System.FilePath 10import 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 #-}
2module Main (main) where 2module Main (main) where
3 3
4import Data.BEncode
4import Remote.KRPC 5import Remote.KRPC
5import Shared 6import 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 #-}
2module Shared 2module 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
6import Data.ByteString (ByteString) 12import Data.ByteString (ByteString)
13import Data.BEncode
7import Remote.KRPC 14import Remote.KRPC
8 15
9unitM :: Method () () 16unitM :: Method () ()
@@ -23,3 +30,6 @@ swapM = method "swap" ["x", "y"] ["b", "a"]
23 30
24shiftR :: Method ((), Int, [Int]) ([Int], (), Int) 31shiftR :: Method ((), Int, [Int]) ([Int], (), Int)
25shiftR = method "shiftR" ["x", "y", "z"] ["a", "b", "c"] 32shiftR = method "shiftR" ["x", "y", "z"] ["a", "b", "c"]
33
34rawM :: Method BEncode BEncode
35rawM = method "rawM" [""] [""] \ No newline at end of file