Esempio n. 1
0
        public void DiffBisectTest()
        {
            diff_match_patchTest dmp = new diff_match_patchTest();
              // Normal.
              string a = "cat";
              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.
              List<Diff> 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")};
              CollectionAssert.AreEqual(diffs, dmp.DiffBisect(a, b, DateTime.MaxValue));

              // Timeout.
              diffs = new List<Diff> {new Diff(Operation.DELETE, "cat"), new Diff(Operation.INSERT, "map")};
              CollectionAssert.AreEqual(diffs, dmp.DiffBisect(a, b, DateTime.MinValue));
        }