1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Use the defaultFeatureVectorDecorator in the tests.

This commit is contained in:
Rob Rix 2016-08-18 14:03:36 -04:00
parent 1473c10659
commit 00689650dd
4 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ 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 decorate = featureVectorDecorator (category . headF) 2 3 15
let decorate = defaultFeatureVectorDecorator (category . headF)
let toTerm' = decorate . toTerm
prop "produces correct diffs" . forAll (scale (`div` 4) arbitrary) $
\ (as, bs) -> let tas = toTerm' <$> (as :: [ArbitraryTerm Text (Record '[Category])])

View File

@ -17,7 +17,7 @@ import Test.QuickCheck
spec :: Spec
spec = parallel $ do
let toTerm' = featureVectorDecorator (category . headF) 2 3 15 . toTerm
let toTerm' = defaultFeatureVectorDecorator (category . headF) . toTerm
prop "equality is reflexive" $
\ a b -> let diff = diffTerms wrap (==) diffCost (toTerm' a) (toTerm' (b :: ArbitraryTerm Text (Record '[Category]))) in
diff `shouldBe` diff

View File

@ -45,7 +45,7 @@ spec = parallel $ do
diffSummaries sources testDiff `shouldBe` [ DiffSummary { patch = Insert (LeafInfo "string" "a"), parentAnnotation = Nothing } ]
prop "equal terms produce identity diffs" $
\ a -> let term = featureVectorDecorator (category . headF) 2 3 15 (toTerm (a :: ArbitraryTerm Text (Record '[Category, Range]))) in
\ a -> let term = defaultFeatureVectorDecorator (category . headF) (toTerm (a :: ArbitraryTerm Text (Record '[Category, Range]))) in
diffSummaries sources (diffTerms wrap (==) diffCost term term) `shouldBe` []
describe "annotatedSummaries" $ do

View File

@ -18,7 +18,7 @@ import Test.Hspec.QuickCheck
spec :: Spec
spec = parallel $ do
describe "interpret" $ do
let decorate = featureVectorDecorator (category . headF) 2 3 15
let decorate = defaultFeatureVectorDecorator (category . headF)
let compare = ((==) `on` category . extract)
it "returns a replacement when comparing two unicode equivalent terms" $
let termA = cofree $ (StringLiteral .: RNil) :< Leaf ("t\776" :: Text)