mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Remove JUnit output to stdout.
This commit is contained in:
parent
1145c22674
commit
5b0b6666ea
5 changed files with 57 additions and 23 deletions
|
@ -14,9 +14,7 @@ import java.io.IOException;
|
|||
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.parser.util.ASTPrinter;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
|
||||
|
@ -41,13 +39,6 @@ public class ClassTypeHelperTests extends AST2BaseTest {
|
|||
return new BindingAssertionHelper(code, true);
|
||||
}
|
||||
|
||||
// int a;
|
||||
// const int& b;
|
||||
public void testTemp() throws Exception {
|
||||
BindingAssertionHelper helper = getAssertionHelper();
|
||||
ASTPrinter.print(helper.getTranslationUnit());
|
||||
}
|
||||
|
||||
// struct A {
|
||||
// A(const A& a);
|
||||
// };
|
||||
|
|
|
@ -36,13 +36,13 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*
|
||||
*/
|
||||
public class BTreeTests extends BaseTestCase {
|
||||
private static int DEBUG= 0;
|
||||
protected File dbFile;
|
||||
protected Database db;
|
||||
protected BTree btree;
|
||||
protected int rootRecord;
|
||||
protected IBTreeComparator comparator;
|
||||
|
||||
protected boolean debugMode = false;
|
||||
|
||||
public static Test suite() {
|
||||
return suite(BTreeTests.class);
|
||||
|
@ -80,7 +80,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
|
||||
for(int i=0; i<noTrials; i++) {
|
||||
int seed = seeder.nextInt();
|
||||
System.out.println("Iteration #"+i);
|
||||
if (DEBUG > 0)
|
||||
System.out.println("Iteration #"+i);
|
||||
trial(seed, false);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +96,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
|
||||
for(int i=0; i<6; i++) {
|
||||
int seed = seeder.nextInt();
|
||||
System.out.println("Iteration #"+i);
|
||||
if (DEBUG > 0)
|
||||
System.out.println("Iteration #"+i);
|
||||
trialImp(seed, false, new Random(seed*2), 1);
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +126,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
|
||||
init(degree);
|
||||
|
||||
System.out.print("\t "+seed+" "+(nIterations/1000)+"K: ");
|
||||
if (DEBUG > 0)
|
||||
System.out.print("\t "+seed+" "+(nIterations/1000)+"K: ");
|
||||
for(int i=0; i<nIterations; i++) {
|
||||
if(random.nextDouble()<pInsert) {
|
||||
Integer value = new Integer(random.nextInt(Integer.MAX_VALUE));
|
||||
|
@ -132,7 +135,7 @@ public class BTreeTests extends BaseTestCase {
|
|||
if(newEntry) {
|
||||
BTMockRecord btValue = new BTMockRecord(db, value.intValue());
|
||||
history.add(btValue);
|
||||
if(debugMode)
|
||||
if(DEBUG > 1)
|
||||
System.out.println("Add: "+value+" @ "+btValue.record);
|
||||
btree.insert(btValue.getRecord());
|
||||
}
|
||||
|
@ -142,12 +145,12 @@ public class BTreeTests extends BaseTestCase {
|
|||
BTMockRecord btValue = (BTMockRecord) history.get(index);
|
||||
history.remove(index);
|
||||
expected.remove(new Integer(btValue.intValue()));
|
||||
if(debugMode)
|
||||
if(DEBUG > 1)
|
||||
System.out.println("Remove: "+btValue.intValue()+" @ "+btValue.record);
|
||||
btree.delete(btValue.getRecord());
|
||||
}
|
||||
}
|
||||
if(i % 1000 == 0) {
|
||||
if(i % 1000 == 0 && DEBUG > 0) {
|
||||
System.out.print(".");
|
||||
}
|
||||
if(checkCorrectnessEachIteration) {
|
||||
|
@ -155,7 +158,8 @@ public class BTreeTests extends BaseTestCase {
|
|||
assertBTreeInvariantsHold("[iteration "+i+"] ");
|
||||
}
|
||||
}
|
||||
System.out.println();
|
||||
if (DEBUG > 0)
|
||||
System.out.println();
|
||||
|
||||
assertBTreeMatchesSortedSet("[Trial end] ", btree, expected);
|
||||
assertBTreeInvariantsHold("[Trial end]");
|
||||
|
@ -174,9 +178,11 @@ public class BTreeTests extends BaseTestCase {
|
|||
final Iterator i = expected.iterator();
|
||||
btree.accept(new IBTreeVisitor(){
|
||||
int k;
|
||||
@Override
|
||||
public int compare(long record) throws CoreException {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public boolean visit(long record) throws CoreException {
|
||||
if(record!=0) {
|
||||
BTMockRecord btValue = new BTMockRecord(record, db);
|
||||
|
@ -227,6 +233,7 @@ public class BTreeTests extends BaseTestCase {
|
|||
}
|
||||
|
||||
private class BTMockRecordComparator implements IBTreeComparator {
|
||||
@Override
|
||||
public int compare(long record1, long record2) throws CoreException {
|
||||
return db.getInt(record1) - db.getInt(record2);
|
||||
}
|
||||
|
|
|
@ -117,8 +117,8 @@ public class ClassTests extends PDOMTestBase {
|
|||
bindings = ns.find("testRef");
|
||||
assertEquals(1, bindings.length);
|
||||
IName[] refs = pdom.findNames(bindings[0], IIndex.FIND_REFERENCES);
|
||||
for (int i = 0; i < refs.length; ++i)
|
||||
System.out.println(refs[i].getFileLocation().getNodeOffset());
|
||||
// for (int i = 0; i < refs.length; ++i)
|
||||
// System.out.println(refs[i].getFileLocation().getNodeOffset());
|
||||
assertEquals(5, refs.length);
|
||||
}
|
||||
|
||||
|
|
|
@ -255,8 +255,8 @@ public class DBTest extends BaseTestCase {
|
|||
int expected = caseSensitive ? a.compareTo(b) : a.compareToIgnoreCase(b);
|
||||
assertCMP(a, expected, b, caseSensitive);
|
||||
}
|
||||
System.out.print("Trials: "+n+" Max length: "+max+" ignoreCase: "+!caseSensitive);
|
||||
System.out.println(" Time: "+(System.currentTimeMillis()-start));
|
||||
// System.out.print("Trials: "+n+" Max length: "+max+" ignoreCase: "+!caseSensitive);
|
||||
// System.out.println(" Time: "+(System.currentTimeMillis()-start));
|
||||
}
|
||||
|
||||
private String randomString(int min, int max, Random r) {
|
||||
|
|
|
@ -274,6 +274,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
IIndexerStateListener listener= null;
|
||||
if(stateCount != null) {
|
||||
listener= new IIndexerStateListener() {
|
||||
@Override
|
||||
public void indexChanged(IIndexerStateEvent event) {
|
||||
stateCount[0]++;
|
||||
}
|
||||
|
@ -299,8 +300,14 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
}
|
||||
|
||||
private void doGenerate(String[] args) throws CoreException {
|
||||
GeneratePDOMApplication app = new GeneratePDOMApplication();
|
||||
IApplicationContext ac= new MockApplicationContext(args);
|
||||
GeneratePDOMApplication app = new GeneratePDOMApplication() {
|
||||
@Override
|
||||
protected void output(String s) {}
|
||||
};
|
||||
String[] newArgs= new String[args.length+1];
|
||||
newArgs[0]= GeneratePDOMApplication.OPT_QUIET;
|
||||
System.arraycopy(args, 0, newArgs, 1, args.length);
|
||||
IApplicationContext ac= new MockApplicationContext(newArgs);
|
||||
app.start(ac);
|
||||
}
|
||||
|
||||
|
@ -309,73 +316,93 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
|||
*/
|
||||
|
||||
public static class TestProjectProvider1 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {return null;}
|
||||
@Override
|
||||
public Map getExportProperties() {return null;}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {return null;}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider2 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {return null;}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {return null;}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider3 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {return null;}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {
|
||||
return new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||
}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider4 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {
|
||||
Map map= new HashMap();
|
||||
map.put(SDK_VERSION, "4.0.1");
|
||||
map.put(IIndexFragment.PROPERTY_FRAGMENT_ID, ACME_SDK_ID);
|
||||
return map;
|
||||
}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {
|
||||
return new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||
}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
|
||||
public static class TestProjectProvider5 implements IExportProjectProvider {
|
||||
@Override
|
||||
public ICProject createProject() throws CoreException {
|
||||
ICProject cproject= CProjectHelper.createCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||
toDeleteOnTearDown.add(cproject);
|
||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ3);
|
||||
return cproject;
|
||||
}
|
||||
@Override
|
||||
public Map getExportProperties() {
|
||||
Map map= new HashMap();
|
||||
map.put(SDK_VERSION, "4.0.1");
|
||||
map.put(IIndexFragment.PROPERTY_FRAGMENT_ID, ACME_SDK_ID);
|
||||
return map;
|
||||
}
|
||||
@Override
|
||||
public IIndexLocationConverter getLocationConverter(ICProject cproject) {
|
||||
return new ResourceContainerRelativeLocationConverter(cproject.getProject());
|
||||
}
|
||||
@Override
|
||||
public void setApplicationArguments(String[] arguments) {}
|
||||
}
|
||||
}
|
||||
|
@ -386,13 +413,22 @@ class MockApplicationContext implements IApplicationContext {
|
|||
arguments= new HashMap();
|
||||
arguments.put(APPLICATION_ARGS, appArgs);
|
||||
}
|
||||
@Override
|
||||
public void applicationRunning() {}
|
||||
@Override
|
||||
public Map getArguments() {return arguments;}
|
||||
@Override
|
||||
public String getBrandingApplication() {return null;}
|
||||
@Override
|
||||
public Bundle getBrandingBundle() {return null;}
|
||||
@Override
|
||||
public String getBrandingDescription() {return null;}
|
||||
@Override
|
||||
public String getBrandingId() {return null;}
|
||||
@Override
|
||||
public String getBrandingName() {return null;}
|
||||
@Override
|
||||
public String getBrandingProperty(String key) {return null;}
|
||||
@Override
|
||||
public void setResult(Object result, IApplication application) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue