예제 #1
0
        public void DiffLevenshteinTest()
        {
            diff_match_patchTest dmp = new diff_match_patchTest();
              List<Diff> diffs = new List<Diff> {
              new Diff(Operation.DELETE, "abc"),
              new Diff(Operation.INSERT, "1234"),
              new Diff(Operation.EQUAL, "xyz")};
              Assert.AreEqual(4, dmp.DiffLevenshtein(diffs), "DiffLevenshtein: Levenshtein with trailing equality.");

              diffs = new List<Diff> {
              new Diff(Operation.EQUAL, "xyz"),
              new Diff(Operation.DELETE, "abc"),
              new Diff(Operation.INSERT, "1234")};
              Assert.AreEqual(4, dmp.DiffLevenshtein(diffs), "DiffLevenshtein: Levenshtein with leading equality.");

              diffs = new List<Diff> {
              new Diff(Operation.DELETE, "abc"),
              new Diff(Operation.EQUAL, "xyz"),
              new Diff(Operation.INSERT, "1234")};
              Assert.AreEqual(7, dmp.DiffLevenshtein(diffs), "DiffLevenshtein: Levenshtein with middle equality.");
        }