fix some more warnings

This commit is contained in:
Trolli Schmittlauch 2020-03-20 20:25:52 +01:00
parent b234c7ac4e
commit 8ece8646d4
2 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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