From 27758821e899c7b705e69727cdbda9e34455fea1 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Oct 2017 15:10:11 -0400 Subject: [PATCH] Use the comparableTerms relation in the RWS tests. --- test/Data/RandomWalkSimilarity/Spec.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Data/RandomWalkSimilarity/Spec.hs b/test/Data/RandomWalkSimilarity/Spec.hs index cb0db7cd2..43167826d 100644 --- a/test/Data/RandomWalkSimilarity/Spec.hs +++ b/test/Data/RandomWalkSimilarity/Spec.hs @@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} module Data.RandomWalkSimilarity.Spec where +import Algorithm import Data.Array.IArray import Data.Bifunctor import Data.Diff @@ -35,12 +36,12 @@ spec = parallel $ do \ (as, bs) -> let tas = decorate <$> (as :: [Term ListableSyntax (Record '[])]) tbs = decorate <$> (bs :: [Term ListableSyntax (Record '[])]) wrap = termIn Nil . inj - diff = merge (Nil, Nil) (inj (stripDiff . diffThese <$> rws comparableByConstructor (equalTerms comparableByConstructor) tas tbs)) in + diff = merge (Nil, Nil) (inj (stripDiff . diffThese <$> rws comparableTerms (equalTerms comparableTerms) tas tbs)) in (beforeTerm diff, afterTerm diff) `shouldBe` (Just (wrap (stripTerm <$> tas)), Just (wrap (stripTerm <$> tbs))) it "produces unbiased insertions within branches" $ let (a, b) = (decorate (termIn Nil (inj [ termIn Nil (inj (Syntax.Identifier "a")) ])), decorate (termIn Nil (inj [ termIn Nil (inj (Syntax.Identifier "b")) ]))) in - fmap (bimap stripTerm stripTerm) (rws comparableByConstructor (equalTerms comparableByConstructor) [ b ] [ a, b ]) `shouldBe` fmap (bimap stripTerm stripTerm) [ That a, These b b ] + fmap (bimap stripTerm stripTerm) (rws comparableTerms (equalTerms comparableTerms) [ b ] [ a, b ]) `shouldBe` fmap (bimap stripTerm stripTerm) [ That a, These b b ] where decorate = defaultFeatureVectorDecorator constructorNameAndConstantFields