@Test public void testCalculateMissingHydrogens_Aromatic() throws Exception { IAtomContainer pyrrole = MoleculeFactory.makePyrrole(); IAtom n = pyrrole.getAtom(1); IRingSet rs = (new SSSRFinder(pyrrole)).findSSSR(); IRing ring = (IRing) rs.getAtomContainer(0); for (int j = 0; j < ring.getBondCount(); j++) { ring.getBond(j).setFlag(CDKConstants.ISAROMATIC, true); } Assert.assertEquals(5, ring.getBondCount()); Assert.assertEquals(1, satcheck.calculateNumberOfImplicitHydrogens(n, pyrrole)); }
@Test public void testFingerprinter_int_int() throws java.lang.Exception { ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(1024); Assert.assertNotNull(fingerprinter); IAtomContainer mol = MoleculeFactory.makeIndole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet(); IAtomContainer frag1 = MoleculeFactory.makePyrrole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(frag1); BitSet bs1 = fingerprinter.getBitFingerprint(frag1).asBitSet(); Assert.assertTrue(FingerprinterTool.isSubset(bs, bs1)); }
@Test public void testRegression() throws Exception { IAtomContainer mol1 = MoleculeFactory.makeIndole(); IAtomContainer mol2 = MoleculeFactory.makePyrrole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2); ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(); IBitFingerprint bs1 = fingerprinter.getBitFingerprint(mol1); Assert.assertEquals( "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!", 22, bs1.cardinality()); IBitFingerprint bs2 = fingerprinter.getBitFingerprint(mol2); Assert.assertEquals( "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!", 11, bs2.cardinality()); }