From 550c1a0d6c5b8ec1f8332f67b3f65672c09130ce Mon Sep 17 00:00:00 2001 From: alexander papageorge Date: Fri, 14 Oct 2022 13:30:53 -0400 Subject: [PATCH] added two tests for deep setRight and setLeft --- exercises/practice/zipper/test/Tests.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/exercises/practice/zipper/test/Tests.hs b/exercises/practice/zipper/test/Tests.hs index fe89057a9..004ee7f25 100644 --- a/exercises/practice/zipper/test/Tests.hs +++ b/exercises/practice/zipper/test/Tests.hs @@ -30,6 +30,8 @@ specs = do t5 = BT 6 (leaf 7 ) $ leaf 8 t6 = BT 1 (node 2 Nothing $ leaf 3) $ node 6 (leaf 7) (leaf 8) t7 = BT 1 (node 2 Nothing $ leaf 5) $ leaf 4 + t8 = BT 1 (node 2 Nothing $ leaf 3) $ node 6 (leaf 7) (node 8 (leaf 15) Nothing) + t9 = BT 1 (node 2 Nothing $ leaf 3) $ node 6 (leaf 7) (node 8 Nothing (leaf 15)) it "data is retained" $ toTree (fromTree t1) @@ -83,4 +85,10 @@ specs = do (right . fromJust . up . fromJust . left . fromTree) t1 `shouldBe` (right . fromTree) t1 --- 59c9e4719c6f47c505bf531de711bb3e8a429141 + it "setLeft with subtree on deep focus" $ + (toTree . setLeft (leaf 15) . fromJust . right . fromJust . right . fromTree) t6 + `shouldBe` t8 + + it "setRight with subtree on deep focus" $ + (toTree . setRight (leaf 15) . fromJust . right . fromJust . right . fromTree) t6 + `shouldBe` t9