Browse Source

Fix PatienceDiffTest

Because PatienceDiff works by looking for common unique lines within
the region, the DiffTestDataGenerator needs to be modified to produce
a unique character for each region.  If we don't give PatienceDiff
a few unique points, it will just offer back a single REPLACE edit
that covers the entire files, and this doesn't tell us very much.

Change-Id: I5129faea1e763c74739118ca20d86bd62e0deaef
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.10
Shawn O. Pearce 14 years ago
parent
commit
4447d76a41
  1. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffTestDataGenerator.java

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffTestDataGenerator.java

@ -78,8 +78,11 @@ public class DiffTestDataGenerator {
StringBuilder text = new StringBuilder(len); StringBuilder text = new StringBuilder(len);
int skipStart = skipPeriod - skipLength; int skipStart = skipPeriod - skipLength;
int skippedChars = 0; int skippedChars = 0;
int block = 0;
for (int i = 0; i - skippedChars < len; ++i) { for (int i = 0; i - skippedChars < len; ++i) {
if (skipPeriod == 0 || i % skipPeriod < skipStart) { if ((i % skipPeriod) == 1)
text.append((char) (256 + block++));
else if (skipPeriod == 0 || i % skipPeriod < skipStart) {
text.append((char) (32 + i % 95)); text.append((char) (32 + i % 95));
} else { } else {
skippedChars++; skippedChars++;

Loading…
Cancel
Save