diff options
author | joe <joe@jerkface.net> | 2017-01-21 19:38:06 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-01-21 19:38:06 -0500 |
commit | 21e1fdde98a2e263bf8dfc34a2545b0635e358c8 (patch) | |
tree | e0452404a8131304f786f58d7ee2a86062a7ebba | |
parent | bff5b058b2caaeef335c2a50032df15fc23568f9 (diff) |
Routing table is idempotent test.
-rw-r--r-- | tests/Main.hs | 4 | ||||
-rw-r--r-- | tests/Network/BitTorrent/DHT/RoutingSpec.hs | 13 |
2 files changed, 7 insertions, 10 deletions
diff --git a/tests/Main.hs b/tests/Main.hs index 2f249945..5ed953da 100644 --- a/tests/Main.hs +++ b/tests/Main.hs | |||
@@ -13,7 +13,7 @@ import Text.Printf | |||
13 | import Test.Hspec | 13 | import Test.Hspec |
14 | 14 | ||
15 | import Config | 15 | import Config |
16 | import Spec | 16 | import qualified Spec as Generated |
17 | 17 | ||
18 | 18 | ||
19 | type Command = String | 19 | type Command = String |
@@ -80,7 +80,7 @@ terminateEnv = do | |||
80 | runTestSuite :: [String] -> IO ExitCode | 80 | runTestSuite :: [String] -> IO ExitCode |
81 | runTestSuite args = do | 81 | runTestSuite args = do |
82 | _ <- printf "running hspec test suite with args: %s\n" (show args) | 82 | _ <- printf "running hspec test suite with args: %s\n" (show args) |
83 | catch (withArgs args (hspec spec) >> return ExitSuccess) return | 83 | catch (withArgs args (hspec Generated.spec) >> return ExitSuccess) return |
84 | 84 | ||
85 | withEnv :: EnvOpts -> IO a -> IO a | 85 | withEnv :: EnvOpts -> IO a -> IO a |
86 | withEnv opts action = bracket (setupEnv opts) terminate (const action) | 86 | withEnv opts action = bracket (setupEnv opts) terminate (const action) |
diff --git a/tests/Network/BitTorrent/DHT/RoutingSpec.hs b/tests/Network/BitTorrent/DHT/RoutingSpec.hs index 6c0caad5..07a906ba 100644 --- a/tests/Network/BitTorrent/DHT/RoutingSpec.hs +++ b/tests/Network/BitTorrent/DHT/RoutingSpec.hs | |||
@@ -69,12 +69,9 @@ spec = do | |||
69 | let justOnce x = L.length (L.filter (L.elem x) xss) == 1 | 69 | let justOnce x = L.length (L.filter (L.elem x) xss) == 1 |
70 | L.all justOnce (L.concat xss) | 70 | L.all justOnce (L.concat xss) |
71 | 71 | ||
72 | it "insert is idemponent" $ do | 72 | it "insert is idemponent" $ property $ \ (e :: Env Int) n t -> do |
73 | pending | 73 | let ins :: NodeInfo Int -> Table Int -> Routing Int (Table Int) |
74 | {- | 74 | ins n t = snd <$> T.insert (currentTime e) (TryInsert n) t |
75 | property $ \ (e :: Env Int) n t -> do | 75 | let t1 = runSimulation e (ins n t) |
76 | 76 | let t2 = runSimulation e (ins n t >>= ins n) | |
77 | let t1 = runSimulation e (T.insert n t) | ||
78 | let t2 = runSimulation e (T.insert n t >>= T.insert n) | ||
79 | t1 `shouldBe` t2 | 77 | t1 `shouldBe` t2 |
80 | -} | ||