コード例 #1
0
        public virtual void TestFallbackToMyersDiff()
        {
            HistogramDiff hd = new HistogramDiff();

            hd.SetMaxChainLength(4);
            RawTextComparator cmp = RawTextComparator.DEFAULT;
            RawText           ac  = T("bbbbb");
            RawText           bc  = T("AbCbDbEFbZ");
            EditList          r;

            // Without fallback our results are limited due to collisions.
            hd.SetFallbackAlgorithm(null);
            r = hd.Diff(cmp, ac, bc);
            NUnit.Framework.Assert.AreEqual(1, r.Count);
            // Results go up when we add a fallback for the high collision regions.
            hd.SetFallbackAlgorithm(MyersDiff <Sequence> .INSTANCE);
            r = hd.Diff(cmp, ac, bc);
            NUnit.Framework.Assert.AreEqual(5, r.Count);
        }
コード例 #2
0
        public virtual void TestExceedsChainLength_DuringScanOfB()
        {
            HistogramDiff hd = new HistogramDiff();

            hd.SetFallbackAlgorithm(null);
            hd.SetMaxChainLength(1);
            EditList r = hd.Diff(RawTextComparator.DEFAULT, T("RaaS"), T("QaaT"));

            NUnit.Framework.Assert.AreEqual(1, r.Count);
            NUnit.Framework.Assert.AreEqual(new Edit(0, 4, 0, 4), r[0]);
        }
コード例 #3
0
        public virtual void TestExceedsChainLength_DuringScanOfA()
        {
            HistogramDiff hd = new HistogramDiff();

            hd.SetFallbackAlgorithm(null);
            hd.SetMaxChainLength(3);
            SequenceComparator <RawText> cmp = new _SequenceComparator_97();
            EditList r = hd.Diff(cmp, T("RabS"), T("QabT"));

            NUnit.Framework.Assert.AreEqual(1, r.Count);
            NUnit.Framework.Assert.AreEqual(new Edit(0, 4, 0, 4), r[0]);
        }