public void CreateDeletion() { PatchOperation patchOperation = PatchOperation.CreateDeletion(new Range <int>(10, 15)); Assert.AreEqual(PatchOperationType.Deletion, patchOperation.Type); Assert.AreEqual(new Range <int>(10, 15), patchOperation.Deletion); }
public void GetPatchOperations11() { DiffEngine <string> diffEngine = new DiffEngine <string>( "The metrics for clarity are more-well understood. Do you have a game PLAN to become peerlessly synergetic across all platforms ? Think interactive".Split(' '), //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 "The metrics for obfuscation are more-well understood. Do you have a game plan to become cross-media ? Think interactive".Split(' ')); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateCopy(0, 2), PatchOperation.CreateAddition(3, 3), PatchOperation.CreateDeletion(3, 3), PatchOperation.CreateCopy(4, 11), PatchOperation.CreateAddition(12, 12), PatchOperation.CreateDeletion(12, 12), PatchOperation.CreateCopy(13, 14), PatchOperation.CreateAddition(15, 15), PatchOperation.CreateDeletion(15, 19), PatchOperation.CreateCopy(20, 22) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void Equals() { Assert.AreEqual(PatchOperation.CreateAddition(1, 10), PatchOperation.CreateAddition(1, 10)); Assert.AreEqual(PatchOperation.CreateDeletion(1, 10), PatchOperation.CreateDeletion(1, 10)); Assert.AreEqual(PatchOperation.CreateCopy(1, 10), PatchOperation.CreateCopy(1, 10)); Assert.AreNotEqual(PatchOperation.CreateAddition(1, 10), PatchOperation.CreateDeletion(1, 10)); Assert.AreNotEqual(PatchOperation.CreateAddition(1, 10), PatchOperation.CreateCopy(1, 10)); Assert.AreNotEqual(PatchOperation.CreateAddition(1, 10), PatchOperation.CreateAddition(10, 1)); Assert.AreNotEqual(PatchOperation.CreateDeletion(1, 10), PatchOperation.CreateAddition(1, 10)); Assert.AreNotEqual(PatchOperation.CreateDeletion(1, 10), PatchOperation.CreateDeletion(10, 1)); Assert.AreNotEqual(PatchOperation.CreateDeletion(1, 10), PatchOperation.CreateCopy(10, 1)); Assert.AreNotEqual(PatchOperation.CreateCopy(1, 10), PatchOperation.CreateAddition(1, 10)); Assert.AreNotEqual(PatchOperation.CreateCopy(1, 10), PatchOperation.CreateCopy(10, 1)); Assert.AreNotEqual(PatchOperation.CreateCopy(1, 10), PatchOperation.CreateDeletion(10, 1)); Assert.AreNotEqual(PatchOperation.CreateAddition(1, 1), null); Assert.AreNotEqual(PatchOperation.CreateAddition(1, 1), string.Empty); Assert.AreNotEqual(PatchOperation.CreateDeletion(1, 1), null); Assert.AreNotEqual(PatchOperation.CreateDeletion(1, 1), string.Empty); Assert.AreNotEqual(PatchOperation.CreateCopy(1, 1), null); Assert.AreNotEqual(PatchOperation.CreateCopy(1, 1), string.Empty); }
public void GetPatchOperations5() { DiffEngine <long> diffEngine = new DiffEngine <long>( new long[] { 1, 2, 3 }, new long[] { 2, 3 }); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateDeletion(0, 0), PatchOperation.CreateCopy(1, 2) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void GetPatchOperations2() { DiffEngine <string> diffEngine = new DiffEngine <string>( new string[] { "a", "b", "c", "d" }, new string[] { "c", "d" }); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateDeletion(0, 1), PatchOperation.CreateCopy(2, 3) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void GetPatchOperations9() { DiffEngine <string> diffEngine = new DiffEngine <string>( new string[] { "same", "same", "same", "", "same", "del", "", "del" }, new string[] { "ins", "", "same", "same", "same", "", "same" }); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateAddition(0, 1), PatchOperation.CreateCopy(0, 4), PatchOperation.CreateDeletion(5, 7) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void GetPatchOperations4() { DiffEngine <string> diffEngine = new DiffEngine <string>( new string[] { "a", "b", "c", "d", "e" }, new string[] { "a", "x", "y", "b", "c", "j", "e", }); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateCopy(0, 0), PatchOperation.CreateAddition(1, 2), PatchOperation.CreateCopy(1, 2), PatchOperation.CreateAddition(5, 5), PatchOperation.CreateDeletion(3, 3), PatchOperation.CreateCopy(4, 4) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void GetPatchOperations7() { DiffEngine <string> diffEngine = new DiffEngine <string>( new string[] { "a", "a", "a", "a", "b", "b", "b", "a", "a", "a", "a", "b", "b", "b", "a", "a", "a", "a", "b", "b", "b", "a", "a", "a", "a", "b", "b", "b" }, new string[] { "a", "a", "a", "a", "b", "b", "b", "a", "b", "b", "b", "a", "a", "a", "a" }); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateCopy(0, 7), PatchOperation.CreateDeletion(8, 10), PatchOperation.CreateCopy(11, 17), PatchOperation.CreateDeletion(18, 27) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void GetPatchOperations6() { DiffEngine <string> diffEngine = new DiffEngine <string>( new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" }, new string[] { "a", "b", "p", "q", "r", "s", "t", "c", "d", "e", "f", "g", "h", "i", "j", "u", "l" }); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateCopy(0, 1), PatchOperation.CreateAddition(2, 6), PatchOperation.CreateCopy(2, 9), PatchOperation.CreateAddition(15, 15), PatchOperation.CreateDeletion(10, 10), PatchOperation.CreateCopy(11, 11) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void GetPatchOperations() { DiffEngine <string> diffEngine = new DiffEngine <string>( new string[] { "a", "b", "c", "e", "h", "j", "l", "m", "n", "p" }, new string[] { "b", "c", "d", "e", "f", "j", "k", "l", "m", "r", "s", "t" }); PatchOperation[] expectedPatchOperations = new PatchOperation[] { PatchOperation.CreateDeletion(0, 0), PatchOperation.CreateCopy(1, 2), PatchOperation.CreateAddition(2, 2), PatchOperation.CreateCopy(3, 3), PatchOperation.CreateAddition(4, 4), PatchOperation.CreateDeletion(4, 4), PatchOperation.CreateCopy(5, 5), PatchOperation.CreateAddition(6, 6), PatchOperation.CreateCopy(6, 7), PatchOperation.CreateAddition(9, 11), PatchOperation.CreateDeletion(8, 9) }; AssertDifferences(diffEngine, expectedPatchOperations); }
public void DeletionDifferenceDoesNotAllowSetAdditionProperty() { PatchOperation patchOperation = PatchOperation.CreateDeletion(new Range <int>(10, 15)); patchOperation.Addition = new Range <int>(); }
public void DeletionDifferenceDoesNotAllowGetCopyProperty() { PatchOperation patchOperation = PatchOperation.CreateDeletion(new Range <int>(10, 15)); Range <int> range = patchOperation.Copy; }