create a test for parts of #48
This commit is contained in:
parent
2739b47162
commit
7612f5532a
|
@ -148,6 +148,27 @@ spec = do
|
||||||
it "does not fail on nodes without neighbours (initial state)" $ do
|
it "does not fail on nodes without neighbours (initial state)" $ do
|
||||||
(FORWARD nodeset) <- queryLocalCache <$> exampleLocalNode <*> cacheWith4Entries <*> pure 3 <*> pure (toNodeID 11)
|
(FORWARD nodeset) <- queryLocalCache <$> exampleLocalNode <*> cacheWith4Entries <*> pure 3 <*> pure (toNodeID 11)
|
||||||
Set.map (nid . remoteNode ) nodeset `shouldBe` Set.fromList [nid4, nid2, nid3]
|
Set.map (nid . remoteNode ) nodeset `shouldBe` Set.fromList [nid4, nid2, nid3]
|
||||||
|
describe "successors and predecessors do not disturb the ring characteristics of EpiChord operations (see #48)" $ do
|
||||||
|
let
|
||||||
|
emptyCache = initCache
|
||||||
|
-- implicitly relies on kNieghbours to be <= 3
|
||||||
|
thisNid = toNodeID 1000
|
||||||
|
thisNode = setNid thisNid <$> exampleLocalNode
|
||||||
|
nid2 = toNodeID 1003
|
||||||
|
node2 = exampleNodeState { nid = nid2}
|
||||||
|
nid3 = toNodeID 1010
|
||||||
|
node3 = exampleNodeState { nid = nid3}
|
||||||
|
nid4 = toNodeID 1020
|
||||||
|
node4 = exampleNodeState { nid = nid4}
|
||||||
|
nid5 = toNodeID 1025
|
||||||
|
node5 = exampleNodeState { nid = nid5}
|
||||||
|
allRemoteNodes = [node2, node3, node4, node5]
|
||||||
|
it "lookups also work for slices larger than 1/2 key space" $ do
|
||||||
|
node <- setSuccessors allRemoteNodes . setPredecessors allRemoteNodes <$> thisNode
|
||||||
|
-- do lookup on empty cache but with successors for a key > 1/2 key space
|
||||||
|
-- succeeding the node
|
||||||
|
queryLocalCache node emptyCache 1 (nid5 + 10) `shouldBe` FOUND (toRemoteNodeState node)
|
||||||
|
|
||||||
|
|
||||||
describe "Messages can be encoded to and decoded from ASN.1" $ do
|
describe "Messages can be encoded to and decoded from ASN.1" $ do
|
||||||
-- define test messages
|
-- define test messages
|
||||||
|
|
Loading…
Reference in a new issue