From: <ma...@us...> - 2006-10-02 19:10:06
|
Revision: 7083 http://svn.sourceforge.net/cdk/?rev=7083&view=rev Author: martitm Date: 2006-10-02 12:09:54 -0700 (Mon, 02 Oct 2006) Log Message: ----------- added testAddRemoveHydrogens method- adds hydrogens to a molecule then removes them and checks if hydrogen counts are zero. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/tools/manipulator/AtomContainerManipulatorTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/tools/manipulator/AtomContainerManipulatorTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/tools/manipulator/AtomContainerManipulatorTest.java 2006-10-02 18:46:25 UTC (rev 7082) +++ trunk/cdk/src/org/openscience/cdk/test/tools/manipulator/AtomContainerManipulatorTest.java 2006-10-02 19:09:54 UTC (rev 7083) @@ -39,6 +39,7 @@ import org.openscience.cdk.smiles.SmilesParser; import org.openscience.cdk.templates.MoleculeFactory; import org.openscience.cdk.test.CDKTestCase; +import org.openscience.cdk.tools.HydrogenAdder; import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; /** @@ -109,6 +110,31 @@ assertTrue(ac.getFlag(5)); } + public void testAddRemoveHydrogens() { + + SmilesParser parser = new SmilesParser(); + HydrogenAdder hydrogenAdder = null; + + try { + + Molecule mol = parser.parseSmiles("c1ccccc1"); + + hydrogenAdder = new HydrogenAdder( + "org.openscience.cdk.tools.ValencyChecker"); + + hydrogenAdder.addExplicitHydrogensToSatisfyValency(mol); + + mol = (Molecule) AtomContainerManipulator.removeHydrogens(mol); + + assertEquals(0, mol.getAtom(0).getHydrogenCount()); + assertEquals(0, AtomContainerManipulator.getTotalHydrogenCount(mol)); + + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + /** * Test removeHydrogens for B2H6, which contains two multiply bonded H. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |