示例#1
0
        public void diff_xIndexTest()
        {
            var dmp = new diff_match_patchTest();
            // Translate a location in text1 to text2.
            var diffs = new List<Diff>{
                new Diff(Operation.Delete, "a"),
                new Diff(Operation.Insert, "1234"),
                new Diff(Operation.Equal, "xyz")
            };
            Assert.AreEqual(5, dmp.diff_xIndex(diffs, 2), "diff_xIndex: Translation on equality.");

            diffs = new List<Diff>{
                new Diff(Operation.Equal, "a"),
                new Diff(Operation.Delete, "1234"),
                new Diff(Operation.Equal, "xyz")
            };
            Assert.AreEqual(1, dmp.diff_xIndex(diffs, 3), "diff_xIndex: Translation on deletion.");
        }
    public void diff_xIndexTest() {
      diff_match_patchTest dmp = new diff_match_patchTest();
      // Translate a location in text1 to text2.
      List<Diff> diffs = new List<Diff> {
          new Diff(Operation.DELETE, "a"),
          new Diff(Operation.INSERT, "1234"),
          new Diff(Operation.EQUAL, "xyz")};
      Assert.AreEqual(5, dmp.diff_xIndex(diffs, 2), "diff_xIndex: Translation on equality.");

      diffs = new List<Diff> {
          new Diff(Operation.EQUAL, "a"),
          new Diff(Operation.DELETE, "1234"),
          new Diff(Operation.EQUAL, "xyz")};
      Assert.AreEqual(1, dmp.diff_xIndex(diffs, 3), "diff_xIndex: Translation on deletion.");
    }