From 4447d76a419926aa9f0640b7a045d8149350c506 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 23 Sep 2010 14:45:07 -0700 Subject: [PATCH] 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 --- .../tst/org/eclipse/jgit/diff/DiffTestDataGenerator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffTestDataGenerator.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffTestDataGenerator.java index c40311214..91d757bcc 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffTestDataGenerator.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffTestDataGenerator.java @@ -78,8 +78,11 @@ public class DiffTestDataGenerator { StringBuilder text = new StringBuilder(len); int skipStart = skipPeriod - skipLength; int skippedChars = 0; + int block = 0; 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)); } else { skippedChars++;