Skip to content

Commit

Permalink
Test to make sure the SMILES parser gets the formal neighbor counts c…
Browse files Browse the repository at this point in the history
…orrect

Change-Id: Ib7c4909fdeb31d1fadde46a6685b1dd20a7959f8
  • Loading branch information
egonw committed Feb 25, 2012
1 parent 516edbb commit 5b1654d
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/test/org/openscience/cdk/smiles/SmilesParserTest.java
Expand Up @@ -20,6 +20,9 @@
*/
package org.openscience.cdk.smiles;

import java.util.Iterator;
import java.util.List;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Ignore;
Expand Down Expand Up @@ -54,9 +57,6 @@
import org.openscience.cdk.tools.manipulator.AtomTypeManipulator;
import org.openscience.cdk.tools.manipulator.BondManipulator;

import java.util.Iterator;
import java.util.List;

/**
* Please see the test.gui package for visual feedback on tests.
*
Expand Down Expand Up @@ -2309,6 +2309,21 @@ public void testAromaticBoron() throws CDKException {
Assert.assertNotNull(mol);
}

@Test
public void testFormalNeighborBount() throws CDKException, CloneNotSupportedException {
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IMolecule mol = sp.parseSmiles("Oc1ccc(O)cc1");
Assert.assertEquals("O.sp3", mol.getAtom(0).getAtomTypeName());
Assert.assertEquals(2, mol.getAtom(0).getFormalNeighbourCount().intValue());
Assert.assertEquals("C.sp2", mol.getAtom(1).getAtomTypeName());
Assert.assertEquals(3, mol.getAtom(1).getFormalNeighbourCount().intValue());
IMolecule clone = (IMolecule)mol.clone();
Assert.assertEquals("O.sp3", clone.getAtom(0).getAtomTypeName());
Assert.assertEquals(2, clone.getAtom(0).getFormalNeighbourCount().intValue());
Assert.assertEquals("C.sp2", clone.getAtom(1).getAtomTypeName());
Assert.assertEquals(3, clone.getAtom(1).getFormalNeighbourCount().intValue());
}

/**
* Counts aromatic atoms in a molecule.
* @param mol molecule for which to count aromatic atoms.
Expand Down

0 comments on commit 5b1654d

Please sign in to comment.