From 8ece8646d41dc14874222548fa43cabec32e92c9 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Fri, 20 Mar 2020 20:25:52 +0100 Subject: [PATCH] fix some more warnings --- Hash2Pub/src/Hash2Pub/FediChord.hs | 2 +- Hash2Pub/test/FediChordSpec.hs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Hash2Pub/src/Hash2Pub/FediChord.hs b/Hash2Pub/src/Hash2Pub/FediChord.hs index 5c88fe2..0460e69 100644 --- a/Hash2Pub/src/Hash2Pub/FediChord.hs +++ b/Hash2Pub/src/Hash2Pub/FediChord.hs @@ -74,8 +74,8 @@ instance Num NodeID where instance Ord NodeID where a `compare` b | getNodeID a == getNodeID b = EQ - | wayForwards <= wayBackwards = LT | wayForwards > wayBackwards = GT + | otherwise = LT where wayForwards = getNodeID (b - a) wayBackwards = getNodeID (a - b) diff --git a/Hash2Pub/test/FediChordSpec.hs b/Hash2Pub/test/FediChordSpec.hs index 6396921..4985091 100644 --- a/Hash2Pub/test/FediChordSpec.hs +++ b/Hash2Pub/test/FediChordSpec.hs @@ -31,8 +31,8 @@ spec = do a > b `shouldBe` True b < a `shouldBe` True -- edge cases - (toNodeID 5001 - toNodeID 2^255) < 5001 `shouldBe` True - (toNodeID 5001 - toNodeID 2^255 - 1) < 5001 `shouldBe` False + (toNodeID 5001 - toNodeID 2^(255::Integer) < 5001) `shouldBe` True + (toNodeID 5001 - toNodeID 2^(255::Integer) - 1) < 5001 `shouldBe` False it "throws an exception when @toNodeID@ on out-of-bound values" $ pending it "can be generated" $ do @@ -41,7 +41,7 @@ spec = do describe "ByteString to Integer conversion" $ it "correctly interprets ByteStrings as unsigned big-endian integers" $ do - byteStringToUInteger (BS.pack $ replicate 32 0xff) `shouldBe` 2^256-1 + byteStringToUInteger (BS.pack $ replicate 32 0xff) `shouldBe` 2^(256::Integer)-1 byteStringToUInteger (BS.pack $ replicate 32 0x00) `shouldBe` 0 byteStringToUInteger (BS.pack [0x00, 0x03, 0xf6, 0x78, 0x10, 0x00]) `shouldBe` 17019965440 describe "NodeState" $ do