Commit 37cbfe5d authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

tests: Add more tests for splitBlock

parent bc438245
......@@ -157,17 +157,44 @@ splitBlockSpec = describe "splitBlock" $ do
$ let res = withState @Powerset (enc [True, False] [(0, (), 1)]) $ do
[(b, v0)] <- collectTouchedBlocks (Block 1)
updateBlock b v0
lift . Queue.clear =<< view _2
splitBlock b
in res `shouldBe` [0]
in res `shouldBe` [0]
it "splits blocks into marked and unmaked" $
let res = withState @Powerset (enc [True, True, False] [(0, (), 2), (1, (), 0)]) $ do
[(b, v0)] <- collectTouchedBlocks (Block 1)
updateBlock b v0
lift . Queue.clear =<< view _2
splitBlock b
in res `shouldMatchList` [Block 0, Block 2]
it "splits blocks into marked and unmaked"
$ let
res =
withState @Powerset (enc [True, True, False] [(0, (), 2), (1, (), 0)])
$ do
[(b, v0)] <- collectTouchedBlocks (Block 1)
updateBlock b v0
splitBlock b
in res `shouldMatchList` [Block 0, Block 2]
it "splits different H3s into different blocks"
$ let
res =
withState @(MonoidValued Int)
(enc [3, 3, 3, 0]
[(0, 1, 3), (1, 2, 3), (2, 3, 3), (0, 2, 0), (1, 1, 1)]
)
$ do
[(b, v0)] <- collectTouchedBlocks (Block 1)
updateBlock b v0
splitBlock b
in res `shouldMatchList` [Block 0, Block 2, Block 3]
it "combines equal H3s into the same block"
$ let
res =
withState @(MonoidValued Int)
(enc [3, 3, 3, 0]
[(0, 1, 3), (1, 1, 3), (2, 3, 3), (0, 2, 0), (1, 2, 1)]
)
$ do
[(b, v0)] <- collectTouchedBlocks (Block 1)
updateBlock b v0
splitBlock b
in res `shouldMatchList` [Block 0, Block 2]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment