fix some more warnings
This commit is contained in:
parent
b234c7ac4e
commit
8ece8646d4
|
@ -74,8 +74,8 @@ instance Num NodeID where
|
||||||
instance Ord NodeID where
|
instance Ord NodeID where
|
||||||
a `compare` b
|
a `compare` b
|
||||||
| getNodeID a == getNodeID b = EQ
|
| getNodeID a == getNodeID b = EQ
|
||||||
| wayForwards <= wayBackwards = LT
|
|
||||||
| wayForwards > wayBackwards = GT
|
| wayForwards > wayBackwards = GT
|
||||||
|
| otherwise = LT
|
||||||
where
|
where
|
||||||
wayForwards = getNodeID (b - a)
|
wayForwards = getNodeID (b - a)
|
||||||
wayBackwards = getNodeID (a - b)
|
wayBackwards = getNodeID (a - b)
|
||||||
|
|
|
@ -31,8 +31,8 @@ spec = do
|
||||||
a > b `shouldBe` True
|
a > b `shouldBe` True
|
||||||
b < a `shouldBe` True
|
b < a `shouldBe` True
|
||||||
-- edge cases
|
-- edge cases
|
||||||
(toNodeID 5001 - toNodeID 2^255) < 5001 `shouldBe` True
|
(toNodeID 5001 - toNodeID 2^(255::Integer) < 5001) `shouldBe` True
|
||||||
(toNodeID 5001 - toNodeID 2^255 - 1) < 5001 `shouldBe` False
|
(toNodeID 5001 - toNodeID 2^(255::Integer) - 1) < 5001 `shouldBe` False
|
||||||
it "throws an exception when @toNodeID@ on out-of-bound values" $
|
it "throws an exception when @toNodeID@ on out-of-bound values" $
|
||||||
pending
|
pending
|
||||||
it "can be generated" $ do
|
it "can be generated" $ do
|
||||||
|
@ -41,7 +41,7 @@ spec = do
|
||||||
|
|
||||||
describe "ByteString to Integer conversion" $
|
describe "ByteString to Integer conversion" $
|
||||||
it "correctly interprets ByteStrings as unsigned big-endian integers" $ do
|
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 $ replicate 32 0x00) `shouldBe` 0
|
||||||
byteStringToUInteger (BS.pack [0x00, 0x03, 0xf6, 0x78, 0x10, 0x00]) `shouldBe` 17019965440
|
byteStringToUInteger (BS.pack [0x00, 0x03, 0xf6, 0x78, 0x10, 0x00]) `shouldBe` 17019965440
|
||||||
describe "NodeState" $ do
|
describe "NodeState" $ do
|
||||||
|
|
Loading…
Reference in a new issue