public void TestDoesStartWithSuffixTooHigh() { const string STR = "12345678901234"; FourBitDigitBigArray fourBitDigitArray = FourBitDigitBigArrayTests.convertStringTo4BitDigitArray(STR); string strToFind = "2" + STR.Substring(1); byte[] toFind = stringToByteArr(strToFind); Assert.AreEqual(-1, SearchString.doesStartWithSuffix(fourBitDigitArray, toFind, 0)); }
public void TestDoesStartWithSuffix() { const string STR = "12345678901234"; FourBitDigitBigArray fourBitDigitArray = FourBitDigitBigArrayTests.convertStringTo4BitDigitArray(STR); //Start index for (int i = 0; i < STR.Length - 1; i++) { //End index for (int j = i + 1; j < STR.Length; j++) { string strFind = STR.Substring(i, j - i); byte[] find = stringToByteArr(strFind); Assert.AreEqual(0, SearchString.doesStartWithSuffix(fourBitDigitArray, find, i)); } } }
public void SearchSuffixArray() { const string STR = "123456789"; IBigArray <ulong> suffixArray = buildSuffixArray(STR); FourBitDigitBigArray fourBitDigitArray = FourBitDigitBigArrayTests.convertStringTo4BitDigitArray(STR); for (int i = 0; i < STR.Length; i++) { for (int j = i + 1; j <= STR.Length; j++) { string find = STR.Substring(i, j - i); long[] seqSearchRes = SearchString.Search(STR, find).ToLongArr(); SuffixArrayRange suffixArrayRange = SearchString.Search(suffixArray, fourBitDigitArray, find); long[] suffixArraySearchRes = suffixArrayRange.SortedValues; CollectionAssert.AreEqual(seqSearchRes, suffixArraySearchRes); } } }