public void FindMatchProposalsTransform_FindsSingleQueryIntersection()
        {
            var ratings = TinyRatingSet.Setup();

            FindMatchProposalsTransform.Execute(ratings, k_Intersection);
            Assert.True(k_Intersection.SetEquals(TinyRatingSet.expectedMatchSet));
        }
        public void FindMatchProposalsTransform_SkipsNonWorkingIndices()
        {
            var ratings = TinyRatingSet.Setup();
            // this transform should only process index 1
            var dataTransform = new FindMatchProposalsTransform()
            {
                WorkingIndices = new List <int> {
                    1
                },
                Input1 = new List <int>(),
                Input2 = new [] { ratings, ratings },
                Output = new [] { new HashSet <int>(), new HashSet <int>() }
            };

            dataTransform.Complete();
            Assert.Zero(dataTransform.Output[0].Count);          // index 0 wasn't processed, so no matches
            Assert.Greater(dataTransform.Output[1].Count, 0);    // index 1 was processed, so has matches
        }
Beispiel #3
0
        public void ExcludedTagsNotUsedAsIntersectionStartingPoint()
        {
            var tagConditions = new ISemanticTagCondition[2];

            tagConditions[0] = m_TestObject.AddSemanticTagCondition("exclude", SemanticTagMatchRule.Exclude);
            tagConditions[1] = m_TestObject.AddSemanticTagCondition("match");

            var conditions = new ProxyConditions(tagConditions);
            var ratings    = new ConditionRatingsData(conditions)
            {
                MatchRuleIndexes = { SemanticTagMatchRule.Exclude, SemanticTagMatchRule.Match }
            };

            // fake like we rated conditions
            var excludeRuleSet     = new [] { 0, 1 };
            var excludeRuleRatings = ratings[typeof(bool)][0];

            foreach (var t in excludeRuleSet)
            {
                excludeRuleRatings.Add(t, 1);
            }

            var matchRuleSet     = new [] { 2, 3, 4 };
            var matchRuleRatings = ratings[typeof(bool)][1];

            foreach (var t in matchRuleSet)
            {
                matchRuleRatings.Add(t, 1);
            }

            var matchSet = new HashSet <int>();

            FindMatchProposalsTransform.GetStartingIdSet(ratings, matchSet);

            // because we can't use the excluding tag ratings as the starting set for intersection,
            // it should skip them & use another set, even though they come first in the ratings in our setup
            Assert.True(matchSet.SetEquals(matchRuleSet));
        }