diff --git a/Hash2Pub/shell.nix b/Hash2Pub/shell.nix index 0d9af5e..82fb296 100644 --- a/Hash2Pub/shell.nix +++ b/Hash2Pub/shell.nix @@ -1 +1 @@ -(import ./. {}).shell +(import ./default.nix {}).shell diff --git a/Hash2Pub/src/Hash2Pub/FediChord.hs b/Hash2Pub/src/Hash2Pub/FediChord.hs index 24908a6..5d059b4 100644 --- a/Hash2Pub/src/Hash2Pub/FediChord.hs +++ b/Hash2Pub/src/Hash2Pub/FediChord.hs @@ -11,6 +11,7 @@ Modernised EpiChord + k-choices load balancing module Hash2Pub.FediChord ( NodeID -- abstract, but newtype constructors cannot be hidden + , getNodeID , mkNodeID , NodeState (..) , CacheEntry diff --git a/Hash2Pub/test/MyLibTest.hs b/Hash2Pub/test/MyLibTest.hs index b808c81..28428c9 100644 --- a/Hash2Pub/test/MyLibTest.hs +++ b/Hash2Pub/test/MyLibTest.hs @@ -1,6 +1,13 @@ module Main (main) where -import qualified Hash2Pub.FediChord as FC +import Test.Hspec + +import Hash2Pub.FediChord main :: IO () -main = putStrLn "Test suite not yet implemented." +main = hspec $ do + describe "NodeID" $ do + it "can store a numeral ID" $ do + getNodeID (mkNodeID 2342) `shouldBe` 2342 + it "computes ID values within the modular bounds" $ do + getNodeID ((maxBound :: NodeID) + mkNodeID 2) < getNodeID (maxBound :: NodeID) `shouldBe` True