public void FindMatchingNullIntSequencesTest() { MinimalDAGSearcher <int?> DagSearcher = new MinimalDAGSearcher <int?>(_nullIntDAG); List <int?> ValuePool = new List <int?>() { 1, 2, 9, 8 }; int?[] ExistingValues = new int?[] { -1, 5, 1, -1, -1 }; var matches = DagSearcher.FindMatchingSequences(ValuePool, new Pattern <int?>(ExistingValues, -1), 0).Select(x => x.MatchingSequence.ToList()).ToList(); var ExpectedMatches = new List <List <int?> >() { new List <int?>() { 5, 1, 9, 8 }, new List <int?>() { 5, 1, 2 } }; NestedSequenceCompare(ExpectedMatches, matches); }
public void FindMatchingEnglishWordsOptionTest() { MinimalDAGSearcher <char> minimalDAGSearcher = new MinimalDAGSearcher <char>(_dawg); List <char> CharPool = new List <char>(); //var existing = new char[] { default(char), default(char), default(char), 'i', 'z', 'z', 'a', 'r', default(char), default(char), default(char) }; var existing = new HashSet <char>[] { null, null, new HashSet <char>() { 'l', 'g', default(char) }, new HashSet <char>() { 'i' }, new HashSet <char>() { 'z' }, new HashSet <char>() { 'z' }, new HashSet <char>() { 'a' }, new HashSet <char>() { 'r' }, null, null, null }; var ExpectedMatches = new List <string>() { "blizzard", "blizzardly", "blizzards", "blizzardy", "gizzard", "gizzards", "izzard", "izzards", }; var Actual = minimalDAGSearcher.FindMatchingSequences(CharPool, new Pattern <char>(existing, default(char)), 6).Select(x => string.Concat(x.MatchingSequence)).ToList(); CollectionAssert.AreEquivalent(ExpectedMatches, Actual); }
public void SimpleBenchmarkTest() { MinimalDAGSearcher <char> minimalDAGSearcher = new MinimalDAGSearcher <char>(_dawg); List <char> CharPool = new List <char>(); var existing = new char[] { default(char), default(char), default(char), default(char), 'e', default(char), default(char), default(char), default(char), default(char), default(char), default(char), default(char), default(char), default(char) }; var Actual = minimalDAGSearcher.FindMatchingSequences(CharPool, new Pattern <char>(existing, default(char)), 14).Select(x => string.Concat(x.MatchingSequence)).ToList(); Assert.IsTrue(Actual.Count > 0); }