Esempio n. 1
0
 static void Check(EditScript edits, params EditType[] expectedEditTypes)
 {
     TextDiffTests.Check(edits, expectedEditTypes);
     foreach (Edit edit in edits)
     {
         edit.Length.ShouldBe(1);
     }
 }
Esempio n. 2
0
        public void ExecuteTest()
        {
            // Execute is tested a lot via TextDiffTests (using MyersDiff<int> for string/line hashes).
            var        diff  = Diff("abc", "aoc");
            EditScript edits = diff.Execute();

            TextDiffTests.Check(edits, EditType.Change);
            TextDiffTests.Check(edits[0], 1, 1, 1);
        }
Esempio n. 3
0
        public void OffsetTest()
        {
            EditScript edits = TextDiffTests.Diff("1", "2", false, false);

            TextDiffTests.Check(edits, EditType.Change);
            Edit edit = edits[0];

            TextDiffTests.Check(edit, 1, 0, 0);

            edit.Offset(10, 20);
            edit.StartA.ShouldBe(10);
            edit.StartB.ShouldBe(20);

            edit.Offset(20, 10);
            edit.StartA.ShouldBe(30);
            edit.StartB.ShouldBe(30);
        }