assertEquals("patch_toText: Dual.", strp, dmp.patch_toText(patches));
}
public void testPatchAddContext() {
dmp.Patch_Margin = 4;
Patch p;
p = dmp.patch_fromText("@@ -21,4 +21,10 @@\n-jump\n+somersault\n").get(0);
dmp.patch_addContext(p, "The quick brown fox jumps over the lazy dog.");
assertEquals("patch_addContext: Simple case.", "@@ -17,12 +17,18 @@\n fox \n-jump\n+somersault\n s ov\n", p.toString());
p = dmp.patch_fromText("@@ -21,4 +21,10 @@\n-jump\n+somersault\n").get(0);
dmp.patch_addContext(p, "The quick brown fox jumps.");
assertEquals("patch_addContext: Not enough trailing context.", "@@ -17,10 +17,16 @@\n fox \n-jump\n+somersault\n s.\n", p.toString());
p = dmp.patch_fromText("@@ -3 +3,2 @@\n-e\n+at\n").get(0);
dmp.patch_addContext(p, "The quick brown fox jumps.");
assertEquals("patch_addContext: Not enough leading context.", "@@ -1,7 +1,8 @@\n Th\n-e\n+at\n qui\n", p.toString());
p = dmp.patch_fromText("@@ -3 +3,2 @@\n-e\n+at\n").get(0);
dmp.patch_addContext(p, "The quick brown fox jumps. The quick brown fox crashes.");
assertEquals("patch_addContext: Ambiguity.", "@@ -1,27 +1,28 @@\n Th\n-e\n+at\n quick brown fox jumps. \n", p.toString());
}