1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +02:00

Improve completion result comparison in tests

This commit is contained in:
Anton Leherbauer 2007-01-25 10:09:33 +00:00
parent dc1b1b8a53
commit df85b0a70c

View file

@ -103,14 +103,17 @@ public abstract class AbstractCompletionTest extends BaseUITestCase {
assertTrue(results != null); assertTrue(results != null);
results= filterProposals(results); results= filterProposals(results);
String[] resultStrings= toStringArray(results, compareIdString);
Arrays.sort(expected);
Arrays.sort(resultStrings);
checkCompletionNode(completionProcessor.getCurrentCompletionNode()); checkCompletionNode(completionProcessor.getCurrentCompletionNode());
if (CTestPlugin.getDefault().isDebugging()) { if (CTestPlugin.getDefault().isDebugging()) {
System.out.println("Time (ms): " + (endTime-startTime)); System.out.println("Time (ms): " + (endTime-startTime));
for (int i = 0; i < results.length; i++) { for (int i = 0; i < resultStrings.length; i++) {
ICompletionProposal proposal = results[i]; String proposal = resultStrings[i];
System.out.println("Result: " + proposal.getDisplayString()); System.out.println("Result: " + proposal);
} }
} }
@ -118,10 +121,9 @@ public abstract class AbstractCompletionTest extends BaseUITestCase {
for (int i = 0; i< expected.length; i++){ for (int i = 0; i< expected.length; i++){
boolean found = false; boolean found = false;
for(int j = 0; j< results.length; j++){ for(int j = 0; j< resultStrings.length; j++){
ICompletionProposal proposal = results[j]; String proposal = resultStrings[j];
String displayString = proposal.getDisplayString(); if(expected[i].equals(proposal)){
if(expected[i].equals(displayString)){
found = true; found = true;
if (CTestPlugin.getDefault().isDebugging()) { if (CTestPlugin.getDefault().isDebugging()) {
System.out.println("Lookup success for " + expected[i]); System.out.println("Lookup success for " + expected[i]);
@ -137,10 +139,6 @@ public abstract class AbstractCompletionTest extends BaseUITestCase {
} }
} }
String[] resultStrings= toStringArray(results, compareIdString);
Arrays.sort(expected);
Arrays.sort(resultStrings);
if (!allFound) { if (!allFound) {
assertEquals("Missing results!", toString(expected), toString(resultStrings)); assertEquals("Missing results!", toString(expected), toString(resultStrings));
} else if (doCheckExtraResults()) { } else if (doCheckExtraResults()) {