Exemplo n.º 1
0
        public void testsuccessfulFindAllStringsArrays()
        {
            string      theString = "abracadabraababbra";
            SuffixArray theArray  = new SuffixArray(theString);
            List <int>  result    = new List <int>(theArray.FindAllOccurrences("bra"));
            List <int>  correct   = new List <int>();

            correct.Add(1); correct.Add(8); correct.Add(15);
            //Assert.AreEqual(result, correct);
            Assert.AreEqual(result.Count(), 3);

            result.Clear(); correct.Clear();

            result = new List <int>(theArray.FindAllOccurrences("brac"));
            Assert.AreEqual(result.Count(), 1);
            correct.Add(1);
            //Assert.AreEqual(result, correct);

            result.Clear(); correct.Clear();

            result = new List <int>(theArray.FindAllOccurrences("ab"));
            correct.Add(0); correct.Add(7); correct.Add(11); correct.Add(13);
            //Assert.AreEqual(result, correct);
            Assert.AreEqual(result.Count(), 4);
        }
Exemplo n.º 2
0
        public void testfailedFindAllOccurrencesArrays()
        {
            string theString = "abracadabraababbra";
            SuffixArray theArray = new SuffixArray(theString);
            List<int> result = new List<int>(theArray.FindAllOccurrences("jason"));
            Assert.AreEqual(result.Count(), 0);

            result = new List<int>(theArray.FindAllOccurrences("testword"));
            Assert.AreEqual(result.Count(), 0);
        }
Exemplo n.º 3
0
        public void testfailedFindAllOccurrencesArrays()
        {
            string      theString = "abracadabraababbra";
            SuffixArray theArray  = new SuffixArray(theString);
            List <int>  result    = new List <int>(theArray.FindAllOccurrences("jason"));

            Assert.AreEqual(result.Count(), 0);

            result = new List <int>(theArray.FindAllOccurrences("testword"));
            Assert.AreEqual(result.Count(), 0);
        }
Exemplo n.º 4
0
        public void testsuccessfulFindAllStringsArrays()
        {
            string theString = "abracadabraababbra";
            SuffixArray theArray = new SuffixArray(theString);
            List<int> result = new List<int>(theArray.FindAllOccurrences("bra"));
            List<int> correct = new List<int>();
            correct.Add(1); correct.Add(8); correct.Add(15);
            //Assert.AreEqual(result, correct);
            Assert.AreEqual(result.Count(), 3);

            result.Clear(); correct.Clear();

            result = new List<int>(theArray.FindAllOccurrences("brac"));
            Assert.AreEqual(result.Count(), 1);
            correct.Add(1);
            //Assert.AreEqual(result, correct);

            result.Clear(); correct.Clear();

            result = new List<int>(theArray.FindAllOccurrences("ab"));
            correct.Add(0); correct.Add(7); correct.Add(11); correct.Add(13);
            //Assert.AreEqual(result, correct);
            Assert.AreEqual(result.Count(), 4);
        }