summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-09-06 13:33:31 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-09-10 22:18:54 -0700
commit307ba53eb65f616252567bfc6b8c52703a192be1 (patch)
tree68cb0049974443c5268ff3cf1afdc71b759b0147 /org.eclipse.jgit.test
parent9d14f56442fe02bc3417b26c1211b9f1d0ee476a (diff)
downloadjgit-307ba53eb65f616252567bfc6b8c52703a192be1.tar.gz
jgit-307ba53eb65f616252567bfc6b8c52703a192be1.zip
Define DiffAlgorithm as an abstract function
This makes it easier to parametrize DiffFormatter with a different implementation, as we later plan to add PatienceDiff to JGit. Change-Id: Id35ef478d5fa20fe10a1ba297f9436fd7adde9ce Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java4
2 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java
index 38fac3cc96..a3f9c22e31 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java
@@ -164,14 +164,14 @@ public class MyersDiffPerformanceTest extends TestCase {
CharArray ac = new CharArray(a);
CharArray bc = new CharArray(b);
CharCmp cmp = new CharCmp();
- MyersDiff<CharArray> myersDiff = null;
+ int D = 0;
int cpuTimeChanges = 0;
long lastReadout = 0;
long interimTime = 0;
int repetitions = 0;
stopwatch.start();
while (cpuTimeChanges < minCPUTimerTicks && interimTime < longTaskBoundary) {
- myersDiff = new MyersDiff<CharArray>(cmp, ac, bc);
+ D = MyersDiff.INSTANCE.diff(cmp, ac, bc).size();
repetitions++;
interimTime = stopwatch.readout();
if (interimTime != lastReadout) {
@@ -181,7 +181,7 @@ public class MyersDiffPerformanceTest extends TestCase {
}
ret.runningTime = stopwatch.stop() / repetitions;
ret.N = ac.size() + bc.size();
- ret.D = myersDiff.getEdits().size();
+ ret.D = D;
return ret;
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java
index 60c1b47280..2410e8eabd 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java
@@ -63,9 +63,9 @@ public class MyersDiffTest extends TestCase {
}
public void assertDiff(String a, String b, String edits) {
- MyersDiff diff = new MyersDiff<CharArray>(new CharCmp(),
+ EditList editList = MyersDiff.INSTANCE.diff(new CharCmp(),
toCharArray(a), toCharArray(b));
- assertEquals(edits, toString(diff.getEdits()));
+ assertEquals(edits, toString(editList));
}
private static String toString(EditList list) {