Exemplo n.º 1
0
        public void EqualSequencesAreMatched()
        {
            var sequence1 = new[] { 1, 2, 3 };
            var sequence2 = new[] { 1, 2, 3 };
            var sut       = new OffsetSequenceMatcher <int>(sequence1, sequence2);

            Assert.That(sut.OverlapPercentage, Is.EqualTo(100));
            Assert.That(sut.CombinedSequence, Is.EqualTo(sequence1));
        }
Exemplo n.º 2
0
        public void PartiallyOveralappingSequencesAreMatched2()
        {
            var sequence1 = new[] { 3, 4, 5, 6, 7 };
            var sequence2 = new[] { 1, 2, 3, 4, 5 };
            var sut       = new OffsetSequenceMatcher <int>(sequence1, sequence2);

            Assert.That(sut.OverlapPercentage, Is.EqualTo(60));
            Assert.That(sut.CombinedSequence, Is.EqualTo(new[] { 1, 2, 3, 4, 5, 6, 7 }));
            Assert.That(sut.SequenceOffset.Item2, Is.EqualTo(2));
        }
Exemplo n.º 3
0
        public void SubsequenceIsMatched()
        {
            var sequenceOffset = 2;
            var sequence1      = new[] { 1, 2, 3, 4, 5 };
            var sequence2      = sequence1.Skip(sequenceOffset).ToArray();
            var sut            = new OffsetSequenceMatcher <int>(sequence1, sequence2);

            Assert.That(sut.OverlapPercentage, Is.EqualTo(100));
            Assert.That(sut.CombinedSequence, Is.EqualTo(sequence1));
            Assert.That(sut.SequenceOffset.Item1, Is.EqualTo(sequenceOffset));
        }