DiffEntry c = DiffEntry.add("c.txt", foo);
DiffEntry d = DiffEntry.delete("d.txt", foo);
+ DiffEntry e = DiffEntry.add("the_e_file.txt", foo);
// Add out of order to avoid first-match succeeding
rd.add(a);
rd.add(d);
+ rd.add(e);
rd.add(b);
rd.add(c);
List<DiffEntry> entries = rd.compute();
- assertEquals(2, entries.size());
+ assertEquals(3, entries.size());
assertRename(d, c, 100, entries.get(0));
assertRename(b, a, 100, entries.get(1));
+ assertCopy(d, e, 100, entries.get(2));
}
public void testExactRename_OneDeleteManyAdds() throws Exception {
List<DiffEntry> dels = (List<DiffEntry>) o;
long[] matrix = new long[dels.size() * adds.size()];
int mNext = 0;
- for (int addIdx = 0; addIdx < adds.size(); addIdx++) {
- String addedName = adds.get(addIdx).newName;
+ for (int delIdx = 0; delIdx < dels.size(); delIdx++) {
+ String deletedName = dels.get(delIdx).oldName;
- for (int delIdx = 0; delIdx < dels.size(); delIdx++) {
- String deletedName = dels.get(delIdx).oldName;
+ for (int addIdx = 0; addIdx < adds.size(); addIdx++) {
+ String addedName = adds.get(addIdx).newName;
int score = SimilarityRenameDetector.nameScore(addedName, deletedName);
- matrix[mNext] = SimilarityRenameDetector.encode(score, addIdx, delIdx);
+ matrix[mNext] = SimilarityRenameDetector.encode(score, delIdx, addIdx);
mNext++;
}
}