Browse files

Test to make sure the SMILES parser gets the formal neighbor counts c…

…orrect

Change-Id: Ib7c4909fdeb31d1fadde46a6685b1dd20a7959f8
  • Loading branch information...
1 parent 516edbb commit 5b1654deae9eb52bca9fb42f5ce6c8a4cb75c3c2 @egonw egonw committed Feb 25, 2012
Showing with 18 additions and 3 deletions.
  1. +18 −3 src/test/org/openscience/cdk/smiles/SmilesParserTest.java
View
21 src/test/org/openscience/cdk/smiles/SmilesParserTest.java
@@ -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;
@@ -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.
*
@@ -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.

0 comments on commit 5b1654d

Please sign in to comment.