mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Extract the decorating of arbitrary terms.
This commit is contained in:
parent
7dcaf788f6
commit
f7055f16e8
@ -30,8 +30,9 @@ spec = parallel $ do
|
||||
|
||||
describe "rws" $ do
|
||||
let compare a b = if extract a == extract b then Just (pure (Replace a b)) else Nothing
|
||||
let toTerm' = featureVectorDecorator (category . headF) 2 2 15 . toTerm
|
||||
prop "produces correct diffs" . forAll (scale (`div` 4) arbitrary) $
|
||||
\ (as, bs) -> let tas = featureVectorDecorator (category . headF) 2 2 15 . toTerm <$> (as :: [ArbitraryTerm Text (Record '[Category])])
|
||||
tbs = featureVectorDecorator (category . headF) 2 2 15 . toTerm <$> (bs :: [ArbitraryTerm Text (Record '[Category])])
|
||||
\ (as, bs) -> let tas = toTerm' <$> (as :: [ArbitraryTerm Text (Record '[Category])])
|
||||
tbs = toTerm' <$> (bs :: [ArbitraryTerm Text (Record '[Category])])
|
||||
diff = free (Free (pure (pure 0 .: Program .: RNil) :< Indexed (rws compare tas tbs))) in
|
||||
(beforeTerm diff, afterTerm diff) `shouldBe` (Just (cofree ((pure 0 .: Program .: RNil) :< Indexed tas)), Just (cofree ((pure 0 .: Program .: RNil) :< Indexed tbs)))
|
||||
|
Loading…
Reference in New Issue
Block a user