public void Find_PatternDoesNotExistInText_NoResultExists(string text, string pattern) { var tree = new SuffixTree(_encoder.GetBytes(text)); tree.Initialize(); var results = tree.Find(_encoder.GetBytes(pattern)); Assert.AreEqual(0, results.OccurrencesCount); }
public void Find_an() { const string text = "banana"; var tree = new SuffixTree(_encoder.GetBytes(text)); tree.Initialize(); var results = tree.Find(_encoder.GetBytes("an")); Assert.AreEqual(2, results.OccurrencesCount); Assert.AreEqual(3, results.Indices[0]); Assert.AreEqual(1, results.Indices[1]); }
public void Find_PatternEqualText_OneResultExists(string s) { var tree = new SuffixTree(_encoder.GetBytes(s)); tree.Initialize(); var results = tree.Find(_encoder.GetBytes(s)); Assert.AreEqual(1, results.OccurrencesCount); }
public void Initialize_ReturnComparisonsCount() { const string text = "banana"; var tree = new SuffixTree(_encoder.GetBytes(text)); var comparisonsCount = tree.Initialize(); Assert.Greater(comparisonsCount, 0); }
public void Find_sba() { const string text = "sasbasaasba"; var tree = new SuffixTree(_encoder.GetBytes(text)); tree.Initialize(); var results = tree.Find(_encoder.GetBytes("sba")); Assert.AreEqual(2, results.OccurrencesCount); }
public void Find_PatternEqualText_ReturnIndexZero(string s) { var tree = new SuffixTree(_encoder.GetBytes(s)); tree.Initialize(); var results = tree.Find(_encoder.GetBytes(s)); Assert.AreEqual(0, results.Indices[0]); }