public void Find_arrayIsNotInitialized_ThrowInvalidOperationException() { const string text = "banana"; var array = new SuffixArray(_encoder.GetBytes(text)); Assert.Throws<InvalidOperationException>(() => array.Find(_encoder.GetBytes("an"))); }
public void Find_an() { const string text = "banana"; var array = new SuffixArray(_encoder.GetBytes(text)); array.Initialize(); var results = array.Find(_encoder.GetBytes("an")); Assert.AreEqual(2, results.OccurrencesCount); Assert.AreEqual(1, results.Indices[0]); Assert.AreEqual(3, results.Indices[1]); }
public void Find_PatternDoesNotExistInText_NoResultExists(string text, string pattern) { var array = new SuffixArray(_encoder.GetBytes(text)); array.Initialize(); var results = array.Find(_encoder.GetBytes(pattern)); Assert.AreEqual(0, results.OccurrencesCount); }
public void Find_sba() { const string text = "sasbasaasba"; var array = new SuffixArray(_encoder.GetBytes(text)); array.Initialize(); var results = array.Find(_encoder.GetBytes("sba")); Assert.AreEqual(2, results.OccurrencesCount); }
public void Find_PatternEqualText_ReturnIndexZero(string s) { var array = new SuffixArray(_encoder.GetBytes(s)); array.Initialize(); var results = array.Find(_encoder.GetBytes(s)); Assert.AreEqual(0, results.Indices[0]); }
public void Find_PatternEqualText_OneResultExists(string s) { var array = new SuffixArray(_encoder.GetBytes(s)); array.Initialize(); var results = array.Find(_encoder.GetBytes(s)); Assert.AreEqual(1, results.OccurrencesCount); }