1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 18:06:14 +03:00

Use a single function to compute both roots.

This commit is contained in:
Rob Rix 2016-08-11 12:36:41 -04:00
parent b551f9c3d9
commit 7bb5d7cd36

View File

@ -39,6 +39,5 @@ spec = parallel $ do
Pure a -> pure a
prop "produces unbiased deletions" $
\ a b -> let (a', b') = (decorate (toTerm a), decorate (toTerm (b :: ArbitraryTerm Text (Record '[Category]))))
two a b = cofree $ (pure 0 .: Program .: RNil) :< Indexed [ a, b ]
one a = cofree $ (pure 0 .: Program .: RNil) :< Indexed [ a ] in
diffTerms wrap compare diffCost (two a' b') (one a') `shouldBe` reverse' (diffTerms wrap compare diffCost (two b' a') (one a'))
root c = cofree $ (pure 0 .: Program .: RNil) :< Indexed c in
diffTerms wrap compare diffCost (root [ a', b' ]) (root [ a' ]) `shouldBe` reverse' (diffTerms wrap compare diffCost (root [ b', a' ]) (root [ a' ]))