Ejemplo n.º 1
0
        public void diff_bisectTest()
        {
            var dmp = new diff_match_patchTest();
            // Normal.
            const string a = "cat";
            const string b = "map";
            // Since the resulting diff hasn't been normalized, it would be ok if
            // the insertion and deletion pairs are swapped.
            // If the order changes, tweak this test as required.
            var diffs = new List<Diff>{new Diff(Operation.Delete, "c"), new Diff(Operation.Insert, "m"), new Diff(Operation.Equal, "a"), new Diff(Operation.Delete, "t"), new Diff(Operation.Insert, "p")};
            Assert.AreEqual(diffs, dmp.diff_bisect(a, b, DateTime.MaxValue));

            // Timeout.
            diffs = new List<Diff>{new Diff(Operation.Delete, "cat"), new Diff(Operation.Insert, "map")};
            Assert.AreEqual(diffs, dmp.diff_bisect(a, b, DateTime.MinValue));
        }