public void testExternalExportProjectProvider_CLinkage() throws Exception { WritablePDOM wpdom = generatePDOM(LOC_TSTPRJ3, TestProjectProvider5.class, null); IndexFilter CLinkage = new IndexFilter() { @Override public boolean acceptLinkage(ILinkage linkage) { return linkage.getLinkageID() == ILinkage.C_LINKAGE_ID; } }; IndexFilter CPPLinkage = new IndexFilter() { @Override public boolean acceptLinkage(ILinkage linkage) { return linkage.getLinkageID() == ILinkage.CPP_LINKAGE_ID; } }; wpdom.acquireReadLock(); try { assertEquals( 1, wpdom.findBindings(new char[][] {"foo".toCharArray()}, CLinkage, npm()).length); assertEquals( 0, wpdom.findBindings(new char[][] {"foo".toCharArray()}, CPPLinkage, npm()).length); } finally { wpdom.releaseReadLock(); } }
public void verifyProject1Content(WritablePDOM wpdom) throws Exception { wpdom.acquireReadLock(); try { IBinding[] bindings = wpdom.findBindings(Pattern.compile(".*foo.*"), false, IndexFilter.ALL, PROGRESS); assertEquals(1, bindings.length); bindings = wpdom.findBindings(Pattern.compile(".*bar.*"), false, IndexFilter.ALL, PROGRESS); assertEquals(1, bindings.length); } finally { wpdom.releaseReadLock(); } }
public void verifyProject2Content(WritablePDOM wpdom) throws Exception { wpdom.acquireReadLock(); try { IBinding[] bindings = wpdom.findBindings(Pattern.compile(".*"), true, IndexFilter.ALL, npm()); assertEquals(2, bindings.length); int b = bindings[0].getName().equals("A") ? 1 : 0; assertTrue(bindings[0] instanceof ICPPClassType); assertTrue(bindings[1] instanceof ICPPClassType); assertTrue(((ICPPClassType) bindings[1 - b]).getBases().length == 0); assertTrue(((ICPPClassType) bindings[b]).getBases().length == 1); } finally { wpdom.releaseReadLock(); } }