mirror of
https://github.com/github/semantic.git
synced 2024-12-29 18:06:14 +03:00
Move compare to the where clause.
This commit is contained in:
parent
8aa0f082a6
commit
02bb72ee0b
@ -29,7 +29,6 @@ spec = parallel $ do
|
||||
\ (term, p, q, d) -> featureVectorDecorator (rhead . headF) (positively p) (positively q) (positively d) (toTerm term :: Term Text (Record '[Text])) `shouldSatisfy` all ((== (positively d)) . length . rhead)
|
||||
|
||||
describe "rws" $ do
|
||||
let compare a b = if ((==) `on` category . extract) a b then Just (replacing a b) else Nothing
|
||||
let decorate = featureVectorDecorator (category . headF) 2 3 15
|
||||
let toTerm' = decorate . toTerm
|
||||
prop "produces correct diffs" . forAll (scale (`div` 4) arbitrary) $
|
||||
@ -42,3 +41,4 @@ spec = parallel $ do
|
||||
it "produces unbiased insertions within branches" $
|
||||
let (a, b) = (decorate (cofree ((StringLiteral .: RNil) :< Indexed [ cofree ((StringLiteral .: RNil) :< Leaf "a") ])), decorate (cofree ((StringLiteral .: RNil) :< Indexed [ cofree ((StringLiteral .: RNil) :< Leaf "b") ]))) in
|
||||
fmap stripDiff (rws compare [ b ] [ a, b ]) `shouldBe` fmap stripDiff [ inserting a, replacing b b ]
|
||||
where compare a b = if ((==) `on` category . extract) a b then Just (replacing a b) else Nothing
|
||||
|
Loading…
Reference in New Issue
Block a user