public void TestBacktrack()
        {
            var        text     = "acbaca";
            var        sb       = new StringBuilder();
            var        detector = new RepetitionDetector(sb, new RationalNumber(7, 4), true);
            Repetition rep;

            foreach (var c in text)
            {
                sb.Append(c);
                detector.TryDetect(out rep);
            }
            while (sb.Length > 3)
            {
                detector.Backtrack();
                sb.Remove(sb.Length - 1, 1);
            }
            var reps = new List <Repetition>();

            foreach (var c in "cab")
            {
                sb.Append(c);
                if (detector.TryDetect(out rep))
                {
                    reps.Add(rep);
                }
            }
            Assert.That(reps, Is.Empty);
        }
        public void Test(string text, int num, int denom, int lp, int p, bool detectEqual)
        {
            var e  = new RationalNumber(num, denom);
            var sb = new StringBuilder();

            var detector   = new RepetitionDetector(sb, e, detectEqual);
            var repetition = new Repetition(0, 0);

            foreach (var c in text)
            {
                sb.Append(c);
                if (detector.TryDetect(out repetition))
                {
                    break;
                }
            }

            Assert.That(repetition, Is.EqualTo(new Repetition(lp, p)));
        }