| Chunk |
|---|
| Conflicting content |
|---|
STDataViewersCSVExporter exporter = new STDataViewersCSVExporter(view.getSTViewer()); exporter.exportTo(dumpFullFileName, new NullProgressMonitor()); // compare with ref <<<<<<< HEAD compareIgnoreEOL(dumpFullFileName, refFullFileName, true); ======= return compareCSVIgnoreEOL(dumpFullFileName, refFullFileName, true); >>>>>>> 4658f8662834b2842d0fee2c878b12cb47dae628 } /** |
| Solution content |
|---|
STDataViewersCSVExporter exporter = new STDataViewersCSVExporter(view.getSTViewer()); exporter.exportTo(dumpFullFileName, new NullProgressMonitor()); // compare with ref return compareCSVIgnoreEOL(dumpFullFileName, refFullFileName, true); } /** |
| File |
|---|
| STJunitUtils.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Return statement |
| Chunk |
|---|
| Conflicting content |
|---|
break;
}
} while (true);
<<<<<<< HEAD
if (!equals) {
junit.framework.Assert.assertEquals(message + ": not correspond ", true, false);
}
is1.close();
is2.close();
// delete dump only for sucessful tests
=======
is1.close();
is2.close();
if (!equals) {
StringBuffer msg = new StringBuffer(message + ": not correspond ");
msg.append("\n========= begin dump file =========\n");
FileReader fr = new FileReader(dumpFile);
int c;
while ((c = fr.read()) != -1) {
msg.append((char) c);
}
fr.close();
msg.append("\n========= end dump file =========\n");
junit.framework.Assert.assertEquals(msg.toString(), true, false);
}
// delete dump only for successful tests
>>>>>>> 4658f8662834b2842d0fee2c878b12cb47dae628
if (equals && deleteDumpFileIfOk) {
new File(dumpFile).delete();
} |
| Solution content |
|---|
fr.close();
break;
}
} while (true);
if (!equals) {
junit.framework.Assert.assertEquals(message + ": not correspond ", true, false);
}
is1.close();
is2.close();
// delete dump only for successful tests
if (equals && deleteDumpFileIfOk) {
new File(dumpFile).delete();
}
}catch (FileNotFoundException _) {
message += "... FAILED: One of these files may not exist";
junit.framework.Assert.assertNull(message, _);
}
catch (Exception _) {
message += ": exception raised ... FAILED";
junit.framework.Assert.assertNull(message, _);
}
return equals;
}
/**
* Utility method to compare exported CSV files
* @param dumpFile
* @param refFile
* @return
*/
public static boolean compareCSVIgnoreEOL(String dumpFile, String refFile, boolean deleteDumpFileIfOk) {
String message = "Comparing ref file ("+refFile+ ")and dump file (" +
dumpFile+")";
boolean equals = false;
String str = "[in-charge]"; // this string can be dumped according to binutils version installed on local machine
try {
LineNumberReader is1 = new LineNumberReader(new FileReader(dumpFile));
LineNumberReader is2 = new LineNumberReader(new FileReader(refFile));
do {
String line1 = is1.readLine();
String line2 = is2.readLine();
int length = str.length();
if (line1 == null) {
if (line2 == null) {
equals = true;
}
break;
} else if (line1.contains(str)){
int idx = line1.indexOf("[in-charge]");
char c = line1.charAt(idx -1);
if (c == ' ' ){
idx--;
length++;
}
line1 = line1.substring(0, idx) + line1.substring(idx+length, line1.length());
if (!line1.equals(line2))
break;
} else if (line2 == null || !line1.equals(line2)) {
break;
}
} while (true);
is1.close();
is2.close();
if (!equals) {
StringBuffer msg = new StringBuffer(message + ": not correspond ");
msg.append("\n========= begin dump file =========\n");
FileReader fr = new FileReader(dumpFile);
int c;
while ((c = fr.read()) != -1) {
msg.append((char) c);
}
msg.append("\n========= end dump file =========\n");
junit.framework.Assert.assertEquals(msg.toString(), true, false);
}
// delete dump only for successful tests
if (equals && deleteDumpFileIfOk) {
new File(dumpFile).delete();
} |
| File |
|---|
| STJunitUtils.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method invocation |