summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-19 05:51:39 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-19 05:51:39 +0400
commit6e9b81c9009140db4807bd51baadcf3be785ee15 (patch)
tree2d844f091b67f5b272ba33c925e3b39f7b56e72b /tests/Network/BitTorrent
parent0012588a36900e333e09182c8d08671999c77767 (diff)
Add MonadActive instance for DHT
Diffstat (limited to 'tests/Network/BitTorrent')
-rw-r--r--tests/Network/BitTorrent/DHT/SessionSpec.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/Network/BitTorrent/DHT/SessionSpec.hs b/tests/Network/BitTorrent/DHT/SessionSpec.hs
index 381aa77d..343c8ab6 100644
--- a/tests/Network/BitTorrent/DHT/SessionSpec.hs
+++ b/tests/Network/BitTorrent/DHT/SessionSpec.hs
@@ -1,6 +1,7 @@
1{-# LANGUAGE ScopedTypeVariables #-} 1{-# LANGUAGE ScopedTypeVariables #-}
2module Network.BitTorrent.DHT.SessionSpec (spec) where 2module Network.BitTorrent.DHT.SessionSpec (spec) where
3import Control.Monad.Reader 3import Control.Monad.Reader
4import Control.Monad.Trans.Resource
4import Data.Default 5import Data.Default
5import Data.List as L 6import Data.List as L
6import Test.Hspec 7import Test.Hspec
@@ -29,8 +30,19 @@ isRight (Right _) = True
29isLeft :: Either a b -> Bool 30isLeft :: Either a b -> Bool
30isLeft = not . isRight 31isLeft = not . isRight
31 32
33nullLogger :: LogFun
34nullLogger _ _ _ _ = return ()
35
32spec :: Spec 36spec :: Spec
33spec = do 37spec = do
38 describe "session" $ do
39 it "is active until stopNode called" $ do
40 node <- startNode [] def myAddr nullLogger
41 runDHT node monadActive `shouldReturn` True
42 runDHT node monadActive `shouldReturn` True
43 stopNode node
44 runDHT node monadActive `shouldReturn` False
45
34 describe "tokens" $ do 46 describe "tokens" $ do
35 it "should not complain about valid token" $ 47 it "should not complain about valid token" $
36 property $ \ (addrs :: [NodeAddr IPv4]) -> do 48 property $ \ (addrs :: [NodeAddr IPv4]) -> do