Skip to content

Commit

Permalink
Unit test with the SMILES reported by Kevin Lawson
Browse files Browse the repository at this point in the history
Change-Id: I2a3c6cfec082a82ce48434ab0120ae4ac8fd2bd6

Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Mar 22, 2012
1 parent 47d65be commit d9c147d
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/test/org/openscience/cdk/smiles/DeduceBondSystemToolTest.java
Expand Up @@ -26,12 +26,12 @@
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.CDKTestCase;
import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.config.Elements;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomType.Hybridization;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IBond.Order;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IAtomType.Hybridization;
import org.openscience.cdk.nonotify.NNAtom;
import org.openscience.cdk.nonotify.NNBond;
import org.openscience.cdk.nonotify.NNMolecule;
Expand Down Expand Up @@ -82,6 +82,28 @@ public void testPyrrole() throws Exception {
}
}

@Test
public void testLargeRingSystem() throws Exception {
String smiles = "O=C1Oc6ccccc6(C(O)C1C5c2ccccc2CC(c3ccc(cc3)c4ccccc4)C5)";
SmilesParser smilesParser = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IMolecule molecule = smilesParser.parseSmiles(smiles);

DeduceBondSystemTool dbst = new DeduceBondSystemTool(new AllRingsFinder());
molecule = dbst.fixAromaticBondOrders(molecule);
Assert.assertNotNull(molecule);

molecule = (IMolecule) AtomContainerManipulator.removeHydrogens(molecule);
Assert.assertEquals(34, molecule.getAtomCount());

// we should have 14 double bonds
int doubleBondCount = 0;
for (int i = 0; i < molecule.getBondCount(); i++) {
IBond bond = molecule.getBond(i);
if (bond.getOrder() == Order.DOUBLE) doubleBondCount++;
}
Assert.assertEquals(13, doubleBondCount);
}

@Test(timeout=1000)
public void testPyrrole_CustomRingFinder() throws Exception {
String smiles = "c2ccc3n([H])c1ccccc1c3(c2)";
Expand Down

0 comments on commit d9c147d

Please sign in to comment.