From: <eg...@us...> - 2007-08-03 14:12:29
|
Revision: 8662 http://cdk.svn.sourceforge.net/cdk/?rev=8662&view=rev Author: egonw Date: 2007-08-03 07:12:20 -0700 (Fri, 03 Aug 2007) Log Message: ----------- Fixed method name according to expected naming scheme. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-08-03 13:42:33 UTC (rev 8661) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-08-03 14:12:20 UTC (rev 8662) @@ -53,7 +53,7 @@ return new JUnit4TestAdapter(CDKAtomTypeMatcherTest.class); } - @Test public void testCDKAtomTypeMatcher() throws CDKException { + @Test public void testGetInstance_IChemObjectBuilder() throws CDKException { CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance()); Assert.assertNotNull(matcher); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-10-21 08:05:46
|
Revision: 9146 http://cdk.svn.sourceforge.net/cdk/?rev=9146&view=rev Author: egonw Date: 2007-10-21 01:05:42 -0700 (Sun, 21 Oct 2007) Log Message: ----------- Added a few trickier structures for atom type perception. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-20 14:26:18 UTC (rev 9145) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-21 08:05:42 UTC (rev 9146) @@ -32,6 +32,7 @@ import org.openscience.cdk.DefaultChemObjectBuilder; import org.openscience.cdk.Molecule; import org.openscience.cdk.PseudoAtom; +import org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector; import org.openscience.cdk.atomtype.CDKAtomTypeMatcher; import org.openscience.cdk.config.AtomTypeFactory; import org.openscience.cdk.exception.CDKException; @@ -41,6 +42,8 @@ import org.openscience.cdk.interfaces.IBond; import org.openscience.cdk.interfaces.IMolecule; import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; +import org.openscience.cdk.templates.MoleculeFactory; +import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; /** * This class tests the matching of atom types defined in the @@ -774,6 +777,63 @@ assertAtomType(testedAtomTypes, "O.minus2", atm.findMatchingAtomType(mol, atom)); } + @Test public void testAzulene() throws Exception { + Molecule molecule = MoleculeFactory.makeAzulene(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test public void testIndole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "N.sp2" + }; + Molecule molecule = MoleculeFactory.makeIndole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test public void testPyrrole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "N.sp2", + "C.sp2", + "C.sp2", + "C.sp2" + }; + Molecule molecule = MoleculeFactory.makePyrrole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test public void testThiazole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "N.sp2", + "C.sp2", + "S.2", + "C.sp2" + }; + Molecule molecule = MoleculeFactory.makeThiazole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + @Test public void testStructGenMatcher() throws Exception { CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance()); Assert.assertNotNull(matcher); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-10-24 13:30:19
|
Revision: 9187 http://cdk.svn.sourceforge.net/cdk/?rev=9187&view=rev Author: egonw Date: 2007-10-24 06:30:16 -0700 (Wed, 24 Oct 2007) Log Message: ----------- Placed in correct module; fixed JavaDoc Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-23 15:50:45 UTC (rev 9186) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-24 13:30:16 UTC (rev 9187) @@ -45,9 +45,9 @@ /** * This class tests the matching of atom types defined in the - * structgen atom type list. + * CDK atom type list. * - * @cdk.module test-core + * @cdk.module test-standard */ public class CDKAtomTypeMatcherTest extends AbstractAtomTypeTest { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2007-10-24 14:01:15
|
Revision: 9189 http://cdk.svn.sourceforge.net/cdk/?rev=9189&view=rev Author: egonw Date: 2007-10-24 07:01:11 -0700 (Wed, 24 Oct 2007) Log Message: ----------- Added propyne as test. Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-24 13:31:03 UTC (rev 9188) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-24 14:01:11 UTC (rev 9189) @@ -100,6 +100,23 @@ assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } + @Test public void testPropyne() throws Exception { + IMolecule mol = new Molecule(); + IAtom atom = new Atom("C"); + IAtom atom2 = new Atom("C"); + IAtom atom3 = new Atom("C"); + mol.addAtom(atom); + mol.addAtom(atom2); + mol.addAtom(atom3); + mol.addBond(0,1,CDKConstants.BONDORDER_TRIPLE); + mol.addBond(2,1,CDKConstants.BONDORDER_SINGLE); + + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom)); + assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom2)); + assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); + } + @Test public void testFormaldehyde() throws Exception { IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <raj...@us...> - 2007-10-26 20:18:03
|
Revision: 9245 http://cdk.svn.sourceforge.net/cdk/?rev=9245&view=rev Author: rajarshi Date: 2007-10-26 13:17:54 -0700 (Fri, 26 Oct 2007) Log Message: ----------- Added support for the I+ atom type Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-26 20:11:39 UTC (rev 9244) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-10-26 20:17:54 UTC (rev 9245) @@ -20,29 +20,20 @@ */ package org.openscience.cdk.test.atomtype; -import java.util.HashMap; -import java.util.Map; - import junit.framework.JUnit4TestAdapter; - import org.junit.Assert; import org.junit.Test; -import org.openscience.cdk.Atom; -import org.openscience.cdk.CDKConstants; -import org.openscience.cdk.DefaultChemObjectBuilder; -import org.openscience.cdk.Molecule; -import org.openscience.cdk.PseudoAtom; +import org.openscience.cdk.*; import org.openscience.cdk.atomtype.CDKAtomTypeMatcher; import org.openscience.cdk.config.AtomTypeFactory; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.interfaces.IBond; -import org.openscience.cdk.interfaces.IMolecule; +import org.openscience.cdk.interfaces.*; import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; import org.openscience.cdk.templates.MoleculeFactory; +import java.util.HashMap; +import java.util.Map; + /** * This class tests the matching of atom types defined in the * CDK atom type list. @@ -57,12 +48,14 @@ return new JUnit4TestAdapter(CDKAtomTypeMatcherTest.class); } - @Test public void testGetInstance_IChemObjectBuilder() throws CDKException { + @Test + public void testGetInstance_IChemObjectBuilder() throws CDKException { CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance()); Assert.assertNotNull(matcher); } - @Test public void testFindMatchingAtomType_IAtomContainer_IAtom() throws Exception { + @Test + public void testFindMatchingAtomType_IAtomContainer_IAtom() throws Exception { IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); final int thisHybridization = CDKConstants.HYBRIDIZATION_SP3; @@ -77,7 +70,8 @@ Assert.assertEquals(thisHybridization, matched.getHybridization()); } - @Test public void testDummy() throws Exception { + @Test + public void testDummy() throws Exception { IMolecule mol = new Molecule(); IAtom atom = new PseudoAtom("R"); mol.addAtom(atom); @@ -87,123 +81,134 @@ assertAtomType(testedAtomTypes, "X", matched); } - @Test public void testEthene() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testEthene() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testPropyne() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testPropyne() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("C"); IAtom atom3 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0,1,CDKConstants.BONDORDER_TRIPLE); - mol.addBond(2,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_TRIPLE); + mol.addBond(2, 1, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); } - - @Test public void testFormaldehyde() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testFormaldehyde() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testMethanol() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testMethanol() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testHCN() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testHCN() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0,1,CDKConstants.BONDORDER_TRIPLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_TRIPLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.sp1", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testHNO2() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testHNO2() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("O"); IAtom atom3 = new Atom("O"); IAtom atom4 = new Atom("H"); - mol.addAtom(atom); atom.setFormalCharge(+1); + mol.addAtom(atom); + atom.setFormalCharge(+1); mol.addAtom(atom2); - mol.addAtom(atom3); atom3.setFormalCharge(-1); + mol.addAtom(atom3); + atom3.setFormalCharge(-1); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(0,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(0,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 3, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.plus.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom3)); } - - @Test public void testMethylAmine() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testMethylAmine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.sp3", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testMethyleneImine() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testMethyleneImine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testEthene_withHybridInfo() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testEthene_withHybridInfo() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("C"); final int thisHybridization = CDKConstants.HYBRIDIZATION_SP2; @@ -211,14 +216,15 @@ atom2.setHybridization(thisHybridization); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testS3() throws CDKException { + + @Test + public void testS3() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); IAtom o1 = DefaultChemObjectBuilder.getInstance().newAtom("O"); @@ -239,7 +245,8 @@ assertAtomType(testedAtomTypes, "S.3", matched); } - @Test public void testH2S() throws CDKException { + @Test + public void testH2S() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); IAtom h1 = DefaultChemObjectBuilder.getInstance().newAtom("H"); @@ -260,7 +267,8 @@ assertAtomType(testedAtomTypes, "S.3", matched); } - @Test public void testHS() throws CDKException { + @Test + public void testHS() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); s.setFormalCharge(-1); @@ -277,8 +285,9 @@ assertAtomType(testedAtomTypes, "S.minus", matched); } - @Test public void testDMSO() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testDMSO() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("S"); IAtom atom3 = new Atom("C"); @@ -287,9 +296,9 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -297,27 +306,29 @@ assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom4)); } - - @Test public void testAmide() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testAmide() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("C"); IAtom atom3 = new Atom("N"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "N.amide", atm.findMatchingAtomType(mol, atom3)); } - - @Test public void testAdenine() throws Exception { - IMolecule mol = MoleculeFactory.makeAdenine(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + + @Test + public void testAdenine() throws Exception { + IMolecule mol = MoleculeFactory.makeAdenine(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(0))); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(1))); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(2))); @@ -329,9 +340,10 @@ assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(8))); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(9))); } - - @Test public void testAmide2() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testAmide2() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom1 = new Atom("C"); IAtom atom2 = new Atom("N"); @@ -340,9 +352,9 @@ mol.addAtom(atom1); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(2,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(2, 3, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -350,9 +362,10 @@ assertAtomType(testedAtomTypes, "N.amide", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); } - - @Test public void testThioAcetone() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testThioAcetone() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("S"); IAtom atom2 = new Atom("C"); IAtom atom3 = new Atom("C"); @@ -361,9 +374,9 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "S.2", atm.findMatchingAtomType(mol, atom)); @@ -371,9 +384,10 @@ assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom4)); } - - @Test public void testSulphuricAcid() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testSulphuricAcid() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("S"); IAtom atom3 = new Atom("O"); @@ -384,10 +398,10 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -397,8 +411,9 @@ assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom5)); } - @Test public void testSF6() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testSF6() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("F"); IAtom atom2 = new Atom("S"); IAtom atom3 = new Atom("F"); @@ -413,19 +428,20 @@ mol.addAtom(atom5); mol.addAtom(atom6); mol.addAtom(atom7); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,5,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,6,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 5, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 6, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "S.octahedral", atm.findMatchingAtomType(mol, atom2)); } - @Test public void testPhosphate() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testPhosphate() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("O"); @@ -436,10 +452,10 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -449,8 +465,9 @@ assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom5)); } - @Test public void testAmmonia() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testAmmonia() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom2 = new Atom("N"); IAtom atom3 = new Atom("H"); @@ -462,17 +479,18 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.plus", atm.findMatchingAtomType(mol, atom2)); } - @Test public void testTMS() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testTMS() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("Si"); IAtom atom3 = new Atom("C"); @@ -483,17 +501,18 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "Si.sp3", atm.findMatchingAtomType(mol, atom2)); } - @Test public void testPhosphine() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testPhosphine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("H"); @@ -502,87 +521,94 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); } - @Test public void testDiethylPhosphine() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testDiethylPhosphine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); } - - @Test public void testPhosphorCompound() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testPhosphorCompound() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); } - @Test public void testCarbokation() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testCarbokation() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); - IAtom atom2 = new Atom("C"); atom2.setFormalCharge(+1); + IAtom atom2 = new Atom("C"); + atom2.setFormalCharge(+1); IAtom atom3 = new Atom("H"); IAtom atom4 = new Atom("H"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.plus.sp2", atm.findMatchingAtomType(mol, atom2)); } - @Test public void testHydrogen() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testHydrogen() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); mol.addAtom(atom); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "H", atm.findMatchingAtomType(mol, atom)); } - - @Test public void testHydroxyl() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testHydroxyl() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom oxygen = new Atom("O"); oxygen.setFormalCharge(-1); mol.addAtom(atom); mol.addAtom(oxygen); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "H", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, oxygen)); } - - @Test public void testHydroxonium() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testHydroxonium() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom1 = new Atom("H"); IAtom atom2 = new Atom("H"); @@ -592,16 +618,17 @@ mol.addAtom(atom1); mol.addAtom(atom2); mol.addAtom(oxygen); - mol.addBond(0,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(2,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(2, 3, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.plus", atm.findMatchingAtomType(mol, oxygen)); } - - @Test public void testPositiveCarbonyl() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testPositiveCarbonyl() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom1 = new Atom("H"); IAtom atom2 = new Atom("H"); @@ -613,17 +640,18 @@ mol.addAtom(atom2); mol.addAtom(oxygen); mol.addAtom(carbon); - mol.addBond(0,3,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - mol.addBond(2,4,CDKConstants.BONDORDER_SINGLE); - mol.addBond(3,4,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); + mol.addBond(2, 4, CDKConstants.BONDORDER_SINGLE); + mol.addBond(3, 4, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.plus.sp2", atm.findMatchingAtomType(mol, oxygen)); } - - @Test public void testProton() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testProton() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); atom.setFormalCharge(1); mol.addAtom(atom); @@ -632,7 +660,8 @@ assertAtomType(testedAtomTypes, "H.plus", atm.findMatchingAtomType(mol, atom)); } - @Test public void testHalides() throws Exception { + @Test + public void testHalides() throws Exception { IMolecule mol = new Molecule(); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); @@ -641,60 +670,82 @@ mol.addAtom(atom); assertAtomType(testedAtomTypes, "Cl.minus", atm.findMatchingAtomType(mol, atom)); - mol = new Molecule(); + mol = new Molecule(); atom = new Atom("F"); atom.setFormalCharge(-1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "F.minus", atm.findMatchingAtomType(mol, atom)); - mol = new Molecule(); + mol = new Molecule(); atom = new Atom("Br"); atom.setFormalCharge(-1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "Br.minus", atm.findMatchingAtomType(mol, atom)); - mol = new Molecule(); + mol = new Molecule(); atom = new Atom("I"); atom.setFormalCharge(-1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "I.minus", atm.findMatchingAtomType(mol, atom)); } - - @Test public void testHalogens() throws Exception { + + @Test + public void testHaloniums() throws Exception { IMolecule mol = new Molecule(); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom carbon1 = new Atom("C"); + IAtom carbon2 = new Atom("C"); + + IAtom atom = new Atom("I"); + atom.setFormalCharge(+1); + mol.addAtom(atom); + mol.addAtom(carbon1); + mol.addAtom(carbon2); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); + + assertAtomType(testedAtomTypes, "I.plus", atm.findMatchingAtomType(mol, atom)); + + } + + @Test + public void testHalogens() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom = new Atom("Cl"); IAtom hydrogen = new Atom("H"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, atom)); mol = new Molecule(); atom = new Atom("I"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "I", atm.findMatchingAtomType(mol, atom)); mol = new Molecule(); atom = new Atom("Br"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "Br", atm.findMatchingAtomType(mol, atom)); mol = new Molecule(); atom = new Atom("F"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "F", atm.findMatchingAtomType(mol, atom)); } - @Test public void testHydride() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testHydride() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); atom.setFormalCharge(-1); mol.addAtom(atom); @@ -703,19 +754,22 @@ assertAtomType(testedAtomTypes, "H.minus", atm.findMatchingAtomType(mol, atom)); } - @Test public void testAzide() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testAzide() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); - IAtom atom2 = new Atom("N"); atom2.setFormalCharge(-1); - IAtom atom3 = new Atom("N"); atom3.setFormalCharge(+1); + IAtom atom2 = new Atom("N"); + atom2.setFormalCharge(-1); + IAtom atom3 = new Atom("N"); + atom3.setFormalCharge(+1); IAtom atom4 = new Atom("N"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - mol.addBond(2,3,CDKConstants.BONDORDER_TRIPLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(2, 3, CDKConstants.BONDORDER_TRIPLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom)); @@ -723,20 +777,23 @@ assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "N.sp1", atm.findMatchingAtomType(mol, atom4)); } - - @Test public void testAzide2() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testAzide2() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("N"); - IAtom atom3 = new Atom("N"); atom3.setFormalCharge(+1); - IAtom atom4 = new Atom("N"); atom4.setFormalCharge(-1); + IAtom atom3 = new Atom("N"); + atom3.setFormalCharge(+1); + IAtom atom4 = new Atom("N"); + atom4.setFormalCharge(-1); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(2,3,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(2, 3, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom)); @@ -744,28 +801,29 @@ assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "N.minus.sp2", atm.findMatchingAtomType(mol, atom4)); } - - @Test public void testSalts() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - + + @Test + public void testSalts() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom = new Atom("Na"); atom.setFormalCharge(+1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "Na.plus", atm.findMatchingAtomType(mol, atom)); - + mol = new Molecule(); atom = new Atom("K"); atom.setFormalCharge(+1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "K.plus", atm.findMatchingAtomType(mol, atom)); - + mol = new Molecule(); atom = new Atom("Ca"); atom.setFormalCharge(+2); mol.addAtom(atom); assertAtomType(testedAtomTypes, "Ca.2plus", atm.findMatchingAtomType(mol, atom)); - + mol = new Molecule(); atom = new Atom("Mg"); atom.setFormalCharge(+2); @@ -773,40 +831,45 @@ assertAtomType(testedAtomTypes, "Mg.2plus", atm.findMatchingAtomType(mol, atom)); } - @Test public void testFerrocene() throws Exception { - IAtomContainer ferrocene = new Molecule(); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); ferrocene.getAtom(4).setFormalCharge(-1); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); ferrocene.getAtom(9).setFormalCharge(-1); - ferrocene.addAtom(new Atom("Fe")); ferrocene.getAtom(10).setFormalCharge(+2); - ferrocene.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(2,3,CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(3,4,CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(4,0,CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(5,6,CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(6,7,CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(7,8,CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(8,9,CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(0,9,CDKConstants.BONDORDER_SINGLE); + @Test + public void testFerrocene() throws Exception { + IAtomContainer ferrocene = new Molecule(); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.getAtom(4).setFormalCharge(-1); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.getAtom(9).setFormalCharge(-1); + ferrocene.addAtom(new Atom("Fe")); + ferrocene.getAtom(10).setFormalCharge(+2); + ferrocene.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(2, 3, CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(3, 4, CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(4, 0, CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(5, 6, CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(6, 7, CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(7, 8, CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(8, 9, CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(0, 9, CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(ferrocene.getBuilder()); assertAtomType(testedAtomTypes, "Fe.2plus", atm.findMatchingAtomType( - ferrocene, ferrocene.getAtom(10)) + ferrocene, ferrocene.getAtom(10)) ); assertAtomType(testedAtomTypes, "C.minus.sp2", atm.findMatchingAtomType( - ferrocene, ferrocene.getAtom(4)) + ferrocene, ferrocene.getAtom(4)) ); } - - @Test public void testPerchlorate() throws Exception { - IMolecule mol = new Molecule(); + + @Test + public void testPerchlorate() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("Cl"); IAtom atom3 = new Atom("O"); @@ -817,10 +880,10 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,3,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,4,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 4, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); @@ -830,8 +893,9 @@ assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom5)); } - @Test public void testChlorate() throws Exception { - IMolecule mol = new Molecule(); + @Test + public void testChlorate() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("Cl"); IAtom atom3 = new Atom("O"); @@ -840,9 +904,9 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1,3,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 3, CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); @@ -851,94 +915,102 @@ assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom4)); } - @Test public void testOxide() throws Exception { - IMolecule mol = new Molecule(); - IAtom atom = new Atom("O"); atom.setFormalCharge(-2); + @Test + public void testOxide() throws Exception { + IMolecule mol = new Molecule(); + IAtom atom = new Atom("O"); + atom.setFormalCharge(-2); mol.addAtom(atom); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.minus2", atm.findMatchingAtomType(mol, atom)); } - @Test public void testAzulene() throws Exception { - Molecule molecule = MoleculeFactory.makeAzulene(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } - - @Test public void testIndole() throws Exception { - String[] expectedTypes = { - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "N.planar3" - }; - Molecule molecule = MoleculeFactory.makeIndole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } - - @Test public void testPyrrole() throws Exception { - String[] expectedTypes = { - "C.sp2", - "N.planar3", - "C.sp2", - "C.sp2", - "C.sp2" - }; - Molecule molecule = MoleculeFactory.makePyrrole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } - - @Test public void testThiazole() throws Exception { - String[] expectedTypes = { - "C.sp2", - "N.sp2", - "C.sp2", - "S.planar3", - "C.sp2" - }; - Molecule molecule = MoleculeFactory.makeThiazole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } - - @Test public void testStructGenMatcher() throws Exception { + @Test + public void testAzulene() throws Exception { + Molecule molecule = MoleculeFactory.makeAzulene(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test + public void testIndole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "N.planar3" + }; + Molecule molecule = MoleculeFactory.makeIndole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test + public void testPyrrole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "N.planar3", + "C.sp2", + "C.sp2", + "C.sp2" + }; + Molecule molecule = MoleculeFactory.makePyrrole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test + public void testThiazole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "N.sp2", + "C.sp2", + "S.planar3", + "C.sp2" + }; + Molecule molecule = MoleculeFactory.makeThiazole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test + public void testStructGenMatcher() throws Exception { CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance()); Assert.assertNotNull(matcher); } - @Test public void countTestedAtomTypes() { + @Test + public void countTestedAtomTypes() { AtomTypeFactory factory = AtomTypeFactory.getInstance( "org/openscience/cdk/config/data/cdk_atomtypes.xml", - NoNotificationChemObjectBuilder.getInstance() + NoNotificationChemObjectBuilder.getInstance() ); - IAtomType[] expectedTypes = factory.getAllAtomTypes(); + IAtomType[] expectedTypes = factory.getAllAtomTypes(); if (expectedTypes.length != testedAtomTypes.size()) { String errorMessage = "Atom types not tested:"; - for (int i=0; i<expectedTypes.length; i++) { + for (int i = 0; i < expectedTypes.length; i++) { if (!testedAtomTypes.containsKey(expectedTypes[i].getAtomTypeName())) - errorMessage += " " + expectedTypes[i].getAtomTypeName(); + errorMessage += " " + expectedTypes[i].getAtomTypeName(); } - Assert.assertEquals(errorMessage, - factory.getAllAtomTypes().length, - testedAtomTypes.size() - ); + Assert.assertEquals(errorMessage, + factory.getAllAtomTypes().length, + testedAtomTypes.size() + ); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <raj...@us...> - 2007-11-06 04:31:05
|
Revision: 9381 http://cdk.svn.sourceforge.net/cdk/?rev=9381&view=rev Author: rajarshi Date: 2007-11-05 20:31:02 -0800 (Mon, 05 Nov 2007) Log Message: ----------- Got back old formatting Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-11-06 03:58:11 UTC (rev 9380) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-11-06 04:31:02 UTC (rev 9381) @@ -49,14 +49,12 @@ return new JUnit4TestAdapter(CDKAtomTypeMatcherTest.class); } - @Test - public void testGetInstance_IChemObjectBuilder() throws CDKException { + @Test public void testGetInstance_IChemObjectBuilder() throws CDKException { CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance()); Assert.assertNotNull(matcher); } - @Test - public void testFindMatchingAtomType_IAtomContainer_IAtom() throws Exception { + @Test public void testFindMatchingAtomType_IAtomContainer_IAtom() throws Exception { IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); final IAtomType.Hybridization thisHybridization = IAtomType.Hybridization.SP3; @@ -71,8 +69,7 @@ Assert.assertEquals(thisHybridization, matched.getHybridization()); } - @Test - public void testDummy() throws Exception { + @Test public void testDummy() throws Exception { IMolecule mol = new Molecule(); IAtom atom = new PseudoAtom("R"); mol.addAtom(atom); @@ -82,134 +79,123 @@ assertAtomType(testedAtomTypes, "X", matched); } - @Test - public void testEthene() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testEthene() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testPropyne() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testPropyne() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("C"); IAtom atom3 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_TRIPLE); - mol.addBond(2, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_TRIPLE); + mol.addBond(2,1,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); } - - @Test - public void testFormaldehyde() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testFormaldehyde() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testMethanol() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testMethanol() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testHCN() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testHCN() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_TRIPLE); + mol.addBond(0,1,CDKConstants.BONDORDER_TRIPLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.sp1", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testHNO2() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testHNO2() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("O"); IAtom atom3 = new Atom("O"); IAtom atom4 = new Atom("H"); - mol.addAtom(atom); - atom.setFormalCharge(+1); + mol.addAtom(atom); atom.setFormalCharge(+1); mol.addAtom(atom2); - mol.addAtom(atom3); - atom3.setFormalCharge(-1); + mol.addAtom(atom3); atom3.setFormalCharge(-1); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(0, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,3,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.plus.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom3)); } - - @Test - public void testMethylAmine() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testMethylAmine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.sp3", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testMethyleneImine() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testMethyleneImine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("N"); IAtom atom2 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testEthene_withHybridInfo() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testEthene_withHybridInfo() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("C"); final IAtomType.Hybridization thisHybridization = IAtomType.Hybridization.SP2; @@ -217,15 +203,14 @@ atom2.setHybridization(thisHybridization); mol.addAtom(atom); mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testS3() throws CDKException { + + @Test public void testS3() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); IAtom o1 = DefaultChemObjectBuilder.getInstance().newAtom("O"); @@ -246,8 +231,7 @@ assertAtomType(testedAtomTypes, "S.3", matched); } - @Test - public void testH2S() throws CDKException { + @Test public void testH2S() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); IAtom h1 = DefaultChemObjectBuilder.getInstance().newAtom("H"); @@ -268,8 +252,7 @@ assertAtomType(testedAtomTypes, "S.3", matched); } - @Test - public void testHS() throws CDKException { + @Test public void testHS() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); s.setFormalCharge(-1); @@ -286,9 +269,8 @@ assertAtomType(testedAtomTypes, "S.minus", matched); } - @Test - public void testDMSO() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testDMSO() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("S"); IAtom atom3 = new Atom("C"); @@ -297,9 +279,9 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -307,29 +289,27 @@ assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom4)); } - - @Test - public void testAmide() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testAmide() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("C"); IAtom atom3 = new Atom("N"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "N.amide", atm.findMatchingAtomType(mol, atom3)); } - - @Test - public void testAdenine() throws Exception { - IMolecule mol = MoleculeFactory.makeAdenine(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + + @Test public void testAdenine() throws Exception { + IMolecule mol = MoleculeFactory.makeAdenine(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(0))); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(1))); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(2))); @@ -341,10 +321,9 @@ assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(8))); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(9))); } - - @Test - public void testAmide2() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testAmide2() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom1 = new Atom("C"); IAtom atom2 = new Atom("N"); @@ -353,9 +332,9 @@ mol.addAtom(atom1); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(2, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(2,3,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -363,10 +342,9 @@ assertAtomType(testedAtomTypes, "N.amide", atm.findMatchingAtomType(mol, atom2)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); } - - @Test - public void testThioAcetone() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testThioAcetone() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("S"); IAtom atom2 = new Atom("C"); IAtom atom3 = new Atom("C"); @@ -375,9 +353,9 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "S.2", atm.findMatchingAtomType(mol, atom)); @@ -385,10 +363,9 @@ assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom4)); } - - @Test - public void testSulphuricAcid() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testSulphuricAcid() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("S"); IAtom atom3 = new Atom("O"); @@ -399,10 +376,10 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -412,9 +389,8 @@ assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom5)); } - @Test - public void testSF6() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testSF6() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("F"); IAtom atom2 = new Atom("S"); IAtom atom3 = new Atom("F"); @@ -429,20 +405,19 @@ mol.addAtom(atom5); mol.addAtom(atom6); mol.addAtom(atom7); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 5, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 6, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,5,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,6,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "S.octahedral", atm.findMatchingAtomType(mol, atom2)); } - @Test - public void testPhosphate() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testPhosphate() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("O"); @@ -453,10 +428,10 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); @@ -466,9 +441,8 @@ assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom5)); } - @Test - public void testAmmonia() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testAmmonia() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom2 = new Atom("N"); IAtom atom3 = new Atom("H"); @@ -480,18 +454,17 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "N.plus", atm.findMatchingAtomType(mol, atom2)); } - @Test - public void testTMS() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testTMS() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("Si"); IAtom atom3 = new Atom("C"); @@ -502,18 +475,17 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "Si.sp3", atm.findMatchingAtomType(mol, atom2)); } - @Test - public void testPhosphine() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testPhosphine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("H"); @@ -522,94 +494,87 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); } - @Test - public void testDiethylPhosphine() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testDiethylPhosphine() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); } - - @Test - public void testPhosphorCompound() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testPhosphorCompound() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("P"); IAtom atom3 = new Atom("C"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); } - @Test - public void testCarbokation() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testCarbokation() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); - IAtom atom2 = new Atom("C"); - atom2.setFormalCharge(+1); + IAtom atom2 = new Atom("C"); atom2.setFormalCharge(+1); IAtom atom3 = new Atom("H"); IAtom atom4 = new Atom("H"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.plus.planar", atm.findMatchingAtomType(mol, atom2)); } - @Test - public void testHydrogen() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testHydrogen() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); mol.addAtom(atom); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "H", atm.findMatchingAtomType(mol, atom)); } - - @Test - public void testHydroxyl() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testHydroxyl() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom oxygen = new Atom("O"); oxygen.setFormalCharge(-1); mol.addAtom(atom); mol.addAtom(oxygen); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "H", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, oxygen)); } - - @Test - public void testHydroxonium() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testHydroxonium() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom1 = new Atom("H"); IAtom atom2 = new Atom("H"); @@ -619,17 +584,16 @@ mol.addAtom(atom1); mol.addAtom(atom2); mol.addAtom(oxygen); - mol.addBond(0, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(2, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(2,3,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.plus", atm.findMatchingAtomType(mol, oxygen)); } - - @Test - public void testPositiveCarbonyl() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testPositiveCarbonyl() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); IAtom atom1 = new Atom("H"); IAtom atom2 = new Atom("H"); @@ -641,18 +605,17 @@ mol.addAtom(atom2); mol.addAtom(oxygen); mol.addAtom(carbon); - mol.addBond(0, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 4, CDKConstants.BONDORDER_SINGLE); - mol.addBond(2, 4, CDKConstants.BONDORDER_SINGLE); - mol.addBond(3, 4, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); + mol.addBond(2,4,CDKConstants.BONDORDER_SINGLE); + mol.addBond(3,4,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.plus.sp2", atm.findMatchingAtomType(mol, oxygen)); } - - @Test - public void testProton() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testProton() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); atom.setFormalCharge(1); mol.addAtom(atom); @@ -661,8 +624,7 @@ assertAtomType(testedAtomTypes, "H.plus", atm.findMatchingAtomType(mol, atom)); } - @Test - public void testHalides() throws Exception { + @Test public void testHalides() throws Exception { IMolecule mol = new Molecule(); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); @@ -671,27 +633,26 @@ mol.addAtom(atom); assertAtomType(testedAtomTypes, "Cl.minus", atm.findMatchingAtomType(mol, atom)); - mol = new Molecule(); + mol = new Molecule(); atom = new Atom("F"); atom.setFormalCharge(-1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "F.minus", atm.findMatchingAtomType(mol, atom)); - mol = new Molecule(); + mol = new Molecule(); atom = new Atom("Br"); atom.setFormalCharge(-1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "Br.minus", atm.findMatchingAtomType(mol, atom)); - mol = new Molecule(); + mol = new Molecule(); atom = new Atom("I"); atom.setFormalCharge(-1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "I.minus", atm.findMatchingAtomType(mol, atom)); } - - @Test - public void testHalogens() throws Exception { + + @Test public void testHalogens() throws Exception { IMolecule mol = new Molecule(); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); @@ -699,34 +660,33 @@ IAtom hydrogen = new Atom("H"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, atom)); mol = new Molecule(); atom = new Atom("I"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "I", atm.findMatchingAtomType(mol, atom)); mol = new Molecule(); atom = new Atom("Br"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "Br", atm.findMatchingAtomType(mol, atom)); mol = new Molecule(); atom = new Atom("F"); mol.addAtom(atom); mol.addAtom(hydrogen); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "F", atm.findMatchingAtomType(mol, atom)); } - @Test - public void testHydride() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testHydride() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); atom.setFormalCharge(-1); mol.addAtom(atom); @@ -735,22 +695,19 @@ assertAtomType(testedAtomTypes, "H.minus", atm.findMatchingAtomType(mol, atom)); } - @Test - public void testAzide() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testAzide() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); - IAtom atom2 = new Atom("N"); - atom2.setFormalCharge(-1); - IAtom atom3 = new Atom("N"); - atom3.setFormalCharge(+1); + IAtom atom2 = new Atom("N"); atom2.setFormalCharge(-1); + IAtom atom3 = new Atom("N"); atom3.setFormalCharge(+1); IAtom atom4 = new Atom("N"); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(2, 3, CDKConstants.BONDORDER_TRIPLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(2,3,CDKConstants.BONDORDER_TRIPLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom)); @@ -758,23 +715,20 @@ assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "N.sp1", atm.findMatchingAtomType(mol, atom4)); } - - @Test - public void testAzide2() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testAzide2() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("C"); IAtom atom2 = new Atom("N"); - IAtom atom3 = new Atom("N"); - atom3.setFormalCharge(+1); - IAtom atom4 = new Atom("N"); - atom4.setFormalCharge(-1); + IAtom atom3 = new Atom("N"); atom3.setFormalCharge(+1); + IAtom atom4 = new Atom("N"); atom4.setFormalCharge(-1); mol.addAtom(atom); mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(2, 3, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(2,3,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom)); @@ -782,12 +736,11 @@ assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom3)); assertAtomType(testedAtomTypes, "N.minus.sp2", atm.findMatchingAtomType(mol, atom4)); } - - @Test - public void testMercuryComplex() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - + + @Test public void testMercuryComplex() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom = new Atom("Hg"); atom.setFormalCharge(-1); IAtom atom1 = new Atom("O"); @@ -800,19 +753,18 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(2, 3, CDKConstants.BONDORDER_SINGLE); - mol.addBond(3, 4, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(4, 0, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(2,3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(3,4, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(4,0, CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "Hg.minus", atm.findMatchingAtomType(mol, atom)); } - - @Test - public void testPoloniumComplex() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - + + @Test public void testPoloniumComplex() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom = new Atom("O"); IAtom atom1 = new Atom("Po"); IAtom atom2 = new Atom("C"); @@ -821,34 +773,33 @@ mol.addAtom(atom1); mol.addAtom(atom2); mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addBond(2, 3, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0,1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2, CDKConstants.BONDORDER_SINGLE); + mol.addBond(2,3, CDKConstants.BONDORDER_SINGLE); assertAtomType(testedAtomTypes, "Po", atm.findMatchingAtomType(mol, atom1)); } - - @Test - public void testSalts() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - + + @Test public void testSalts() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom = new Atom("Na"); atom.setFormalCharge(+1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "Na.plus", atm.findMatchingAtomType(mol, atom)); - + mol = new Molecule(); atom = new Atom("K"); atom.setFormalCharge(+1); mol.addAtom(atom); assertAtomType(testedAtomTypes, "K.plus", atm.findMatchingAtomType(mol, atom)); - + mol = new Molecule(); atom = new Atom("Ca"); atom.setFormalCharge(+2); mol.addAtom(atom); assertAtomType(testedAtomTypes, "Ca.2plus", atm.findMatchingAtomType(mol, atom)); - + mol = new Molecule(); atom = new Atom("Mg"); atom.setFormalCharge(+2); @@ -862,64 +813,58 @@ assertAtomType(testedAtomTypes, "Ni.2plus", atm.findMatchingAtomType(mol, atom)); } - @Test - public void testFerrocene() throws Exception { - IAtomContainer ferrocene = new Molecule(); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.getAtom(4).setFormalCharge(-1); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.addAtom(new Atom("C")); - ferrocene.getAtom(9).setFormalCharge(-1); - ferrocene.addAtom(new Atom("Fe")); - ferrocene.getAtom(10).setFormalCharge(+2); - ferrocene.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(2, 3, CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(3, 4, CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(4, 0, CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(5, 6, CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(6, 7, CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(7, 8, CDKConstants.BONDORDER_DOUBLE); - ferrocene.addBond(8, 9, CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(0, 9, CDKConstants.BONDORDER_SINGLE); + @Test public void testFerrocene() throws Exception { + IAtomContainer ferrocene = new Molecule(); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); ferrocene.getAtom(4).setFormalCharge(-1); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); + ferrocene.addAtom(new Atom("C")); ferrocene.getAtom(9).setFormalCharge(-1); + ferrocene.addAtom(new Atom("Fe")); ferrocene.getAtom(10).setFormalCharge(+2); + ferrocene.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(2,3,CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(3,4,CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(4,0,CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(5,6,CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(6,7,CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(7,8,CDKConstants.BONDORDER_DOUBLE); + ferrocene.addBond(8,9,CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(0,9,CDKConstants.BONDORDER_SINGLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(ferrocene.getBuilder()); assertAtomType(testedAtomTypes, "Fe.2plus", atm.findMatchingAtomType( - ferrocene, ferrocene.getAtom(10)) + ferrocene, ferrocene.getAtom(10)) ); assertAtomType(testedAtomTypes, "C.minus.planar", atm.findMatchingAtomType( - ferrocene, ferrocene.getAtom(4)) + ferrocene, ferrocene.getAtom(4)) ); } - @Test - public void testFuran() throws Exception { - IAtomContainer furan = new Molecule(); - furan.addAtom(new Atom("C")); - furan.addAtom(new Atom("C")); - furan.addAtom(new Atom("C")); - furan.addAtom(new Atom("C")); - furan.addAtom(new Atom("O")); - furan.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - furan.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - furan.addBond(2, 3, CDKConstants.BONDORDER_DOUBLE); - furan.addBond(3, 4, CDKConstants.BONDORDER_SINGLE); - furan.addBond(4, 0, CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(furan.getBuilder()); - assertAtomType(testedAtomTypes, "O.planar3", atm.findMatchingAtomType( - furan, furan.getAtom(4)) - ); + @Test public void testFuran() throws Exception { + IAtomContainer furan = new Molecule(); + furan.addAtom(new Atom("C")); + furan.addAtom(new Atom("C")); + furan.addAtom(new Atom("C")); + furan.addAtom(new Atom("C")); + furan.addAtom(new Atom("O")); + furan.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + furan.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + furan.addBond(2,3,CDKConstants.BONDORDER_DOUBLE); + furan.addBond(3,4,CDKConstants.BONDORDER_SINGLE); + furan.addBond(4,0,CDKConstants.BONDORDER_SINGLE); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(furan.getBuilder()); + assertAtomType(testedAtomTypes, "O.planar3", atm.findMatchingAtomType( + furan, furan.getAtom(4)) + ); } - - @Test - public void testPerchlorate() throws Exception { - IMolecule mol = new Molecule(); + + @Test public void testPerchlorate() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("Cl"); IAtom atom3 = new Atom("O"); @@ -930,10 +875,10 @@ mol.addAtom(atom3); mol.addAtom(atom4); mol.addAtom(atom5); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 4, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,3,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,4,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); @@ -943,9 +888,8 @@ assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom5)); } - @Test - public void testChlorate() throws Exception { - IMolecule mol = new Molecule(); + @Test public void testChlorate() throws Exception { + IMolecule mol = new Molecule(); IAtom atom = new Atom("O"); IAtom atom2 = new Atom("Cl"); IAtom atom3 = new Atom("O"); @@ -954,9 +898,9 @@ mol.addAtom(atom2); mol.addAtom(atom3); mol.addAtom(atom4); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 3, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,3,CDKConstants.BONDORDER_DOUBLE); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); @@ -965,221 +909,195 @@ assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom4)); } - @Test - public void testOxide() throws Exception { - IMolecule mol = new Molecule(); - IAtom atom = new Atom("O"); - atom.setFormalCharge(-2); + @Test public void testOxide() throws Exception { + IMolecule mol = new Molecule(); + IAtom atom = new Atom("O"); atom.setFormalCharge(-2); mol.addAtom(atom); CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); assertAtomType(testedAtomTypes, "O.minus2", atm.findMatchingAtomType(mol, atom)); } - @Test - public void testAzulene() throws Exception { - Molecule molecule = MoleculeFactory.makeAzulene(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } + @Test public void testAzulene() throws Exception { + Molecule molecule = MoleculeFactory.makeAzulene(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test public void testIndole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "N.planar3" + }; + Molecule molecule = MoleculeFactory.makeIndole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test public void testPyrrole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "N.planar3", + "C.sp2", + "C.sp2", + "C.sp2" + }; + Molecule molecule = MoleculeFactory.makePyrrole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test public void testThiazole() throws Exception { + String[] expectedTypes = { + "C.sp2", + "N.sp2", + "C.sp2", + "S.planar3", + "C.sp2" + }; + Molecule molecule = MoleculeFactory.makeThiazole(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } - @Test - public void testIndole() throws Exception { - String[] expectedTypes = { - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "C.sp2", - "N.planar3" - }; - Molecule molecule = MoleculeFactory.makeIndole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } + @Test public void testHaloniums() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - @Test - public void testPyrrole() throws Exception { - String[] expectedTypes = { - "C.sp2", - "N.planar3", - "C.sp2", - "C.sp2", - "C.sp2" - }; - Molecule molecule = MoleculeFactory.makePyrrole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } + IAtom carbon1 = new Atom("C"); + IAtom carbon2 = new Atom("C"); - @Test - public void testThiazole() throws Exception { - String[] expectedTypes = { - "C.sp2", - "N.sp2", - "C.sp2", - "S.planar3", - "C.sp2" - }; - Molecule molecule = MoleculeFactory.makeThiazole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } + IAtom atom = new Atom("I"); + atom.setFormalCharge(+1); + mol.addAtom(atom); + mol.addAtom(carbon1); + mol.addAtom(carbon2); + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - @Test - public void testPiperidine() throws Exception { - Molecule molecule = MoleculeFactory.makePiperidine(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - String[] expectedTypes = { - "N.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3" - }; - for (int f = 0; f < molecule.getAtomCount() - 1; f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } - } + assertAtomType(testedAtomTypes, "I.plus", atm.findMatchingAtomType(mol, atom)); - @Test - public void testHaloniums() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - - IAtom carbon1 = new Atom("C"); - IAtom carbon2 = new Atom("C"); - - IAtom atom = new Atom("I"); - atom.setFormalCharge(+1); - mol.addAtom(atom); - mol.addAtom(carbon1); - mol.addAtom(carbon2); - mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); - mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - - assertAtomType(testedAtomTypes, "I.plus", atm.findMatchingAtomType(mol, atom)); - } + + @Test public void testRearrangementCarbokation() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - @Test - public void testRearrangementCarbokation() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom carbon1 = new Atom("C"); + carbon1.setFormalCharge(+1); + IAtom carbon2 = new Atom("C"); + IAtom carbon3 = new Atom("C"); - IAtom carbon1 = new Atom("C"); - carbon1.setFormalCharge(+1); - IAtom carbon2 = new Atom("C"); - IAtom carbon3 = new Atom("C"); + mol.addAtom(carbon1); + mol.addAtom(carbon2); + mol.addAtom(carbon3); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - mol.addAtom(carbon1); - mol.addAtom(carbon2); - mol.addAtom(carbon3); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - - assertAtomType(testedAtomTypes, "C.plus.sp2", atm.findMatchingAtomType(mol, carbon1)); + assertAtomType(testedAtomTypes, "C.plus.sp2", atm.findMatchingAtomType(mol, carbon1)); } + + @Test public void testChargedSpecies() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - @Test - public void testChargedSpecies() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom1 = new Atom("C"); + atom1.setFormalCharge(-1); + IAtom atom2 = new Atom("O"); + atom2.setFormalCharge(+1); + - IAtom atom1 = new Atom("C"); - atom1.setFormalCharge(-1); - IAtom atom2 = new Atom("O"); - atom2.setFormalCharge(+1); + mol.addAtom(atom1); + mol.addAtom(atom2); + mol.addBond(0, 1, CDKConstants.BONDORDER_TRIPLE); - - mol.addAtom(atom1); - mol.addAtom(atom2); - mol.addBond(0, 1, CDKConstants.BONDORDER_TRIPLE); - - assertAtomType(testedAtomTypes, "C.minus.sp1", atm.findMatchingAtomType(mol, atom1)); + assertAtomType(testedAtomTypes, "C.minus.sp1", atm.findMatchingAtomType(mol, atom1)); } + +// [O+]=C-[C-] + @Test public void testChargedSpecies2() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - // [O+]=C-[C-] - @Test - public void testChargedSpecies2() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom1 = new Atom("O"); + atom1.setFormalCharge(1); + IAtom atom2 = new Atom("C"); + IAtom atom3 = new Atom("C"); + atom3.setFormalCharge(-1); - IAtom atom1 = new Atom("O"); - atom1.setFormalCharge(1); - IAtom atom2 = new Atom("C"); - IAtom atom3 = new Atom("C"); - atom3.setFormalCharge(-1); + mol.addAtom(atom1); + mol.addAtom(atom2); + mol.addAtom(atom3); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - mol.addAtom(atom1); - mol.addAtom(atom2); - mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - - assertAtomType(testedAtomTypes, "C.minus.sp3", atm.findMatchingAtomType(mol, atom3)); + assertAtomType(testedAtomTypes, "C.minus.sp3", atm.findMatchingAtomType(mol, atom3)); } + +// [C-]=C-C + @Test public void testChargedSpecies3() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - // [C-]=C-C - @Test - public void testChargedSpecies3() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + IAtom atom1 = new Atom("C"); + atom1.setFormalCharge(-1); + IAtom atom2 = new Atom("C"); + IAtom atom3 = new Atom("C"); - IAtom atom1 = new Atom("C"); - atom1.setFormalCharge(-1); - IAtom atom2 = new Atom("C"); - IAtom atom3 = new Atom("C"); + mol.addAtom(atom1); + mol.addAtom(atom2); + mol.addAtom(atom3); + mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); + mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - mol.addAtom(atom1); - mol.addAtom(atom2); - mol.addAtom(atom3); - mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); - mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - - assertAtomType(testedAtomTypes, "C.minus.sp2", atm.findMatchingAtomType(mol, atom1)); + assertAtomType(testedAtomTypes, "C.minus.sp2", atm.findMatchingAtomType(mol, atom1)); } + + @Test public void testNobleGases() throws Exception { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - @Test - public void testNobleGases() throws Exception { - IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - - mol.addAtom(new Atom("He")); - assertAtomType(testedAtomTypes, "He", atm.findMatchingAtomType(mol, mol.getAtom(0))); + mol.addAtom(new Atom("He")); + assertAtomType(testedAtomTypes, "He", atm.findMatchingAtomType(mol, mol.getAtom(0))); } - - @Test - public void testStructGenMatcher() throws Exception { + + @Test public void testStructGenMatcher() throws Exception { CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(DefaultChemObjectBuilder.getInstance()); Assert.assertNotNull(matcher); } - @Test - public void countTestedAtomTypes() { + @Test public void countTestedAtomTypes() { AtomTypeFactory factory = AtomTypeFactory.getInstance( "org/openscience/cdk/config/data/cdk_atomtypes.xml", - NoNotificationChemObjectBuilder.getInstance() + NoNotificationChemObjectBuilder.getInstance() ); - IAtomType[] expectedTypes = factory.getAllAtomTypes(); + IAtomType[] expectedTypes = factory.getAllAtomTypes(); if (expectedTypes.length != testedAtomTypes.size()) { String errorMessage = "Atom types not tested:"; - for (int i = 0; i < expectedTypes.length; i++) { + for (int i=0; i<expectedTypes.length; i++) { if (!testedAtomTypes.containsKey(expectedTypes[i].getAtomTypeName())) - errorMessage += " " + expectedTypes[i].getAtomTypeName(); + errorMessage += " " + expectedTypes[i].getAtomTypeName(); } - Assert.assertEquals(errorMessage, - factory.getAllAtomTypes().length, - testedAtomTypes.size() - ); + Assert.assertEquals(errorMessage, + factory.getAllAtomTypes().length, + testedAtomTypes.size() + ); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <raj...@us...> - 2007-11-06 04:32:22
|
Revision: 9382 http://cdk.svn.sourceforge.net/cdk/?rev=9382&view=rev Author: rajarshi Date: 2007-11-05 20:32:21 -0800 (Mon, 05 Nov 2007) Log Message: ----------- Added test cases for piperidine and oxane - bot the heteroatoms should be sp3 (?) but are detected as planar3 Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-11-06 04:31:02 UTC (rev 9381) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2007-11-06 04:32:21 UTC (rev 9382) @@ -209,7 +209,31 @@ assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom)); assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); } - + + @Test + public void testPiperidine() throws Exception { + Molecule molecule = MoleculeFactory.makePiperidine(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + String[] expectedTypes = { + "N.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3" + }; + for (int f = 0; f < molecule.getAtomCount() - 1; f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + + @Test + public void testTetrahydropyran() throws Exception { + Molecule molecule = MoleculeFactory.makeTetrahydropyran(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); + String[] expectedTypes = { + "O.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3" + }; + for (int f = 0; f < molecule.getAtomCount(); f++) { + assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); + } + } + @Test public void testS3() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <raj...@us...> - 2008-01-03 03:41:09
|
Revision: 9816 http://cdk.svn.sourceforge.net/cdk/?rev=9816&view=rev Author: rajarshi Date: 2008-01-02 19:41:05 -0800 (Wed, 02 Jan 2008) Log Message: ----------- Updated to add a test for the carbon and nitrogen in isonitrile (charge separated form) Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-01-02 22:31:08 UTC (rev 9815) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-01-03 03:41:05 UTC (rev 9816) @@ -21,31 +21,21 @@ */ package org.openscience.cdk.test.atomtype; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - import junit.framework.JUnit4TestAdapter; - import org.junit.Assert; import org.junit.Test; -import org.openscience.cdk.Atom; -import org.openscience.cdk.Bond; -import org.openscience.cdk.CDKConstants; -import org.openscience.cdk.DefaultChemObjectBuilder; -import org.openscience.cdk.Molecule; -import org.openscience.cdk.PseudoAtom; +import org.openscience.cdk.*; import org.openscience.cdk.atomtype.CDKAtomTypeMatcher; import org.openscience.cdk.config.AtomTypeFactory; import org.openscience.cdk.exception.CDKException; -import org.openscience.cdk.interfaces.IAtom; -import org.openscience.cdk.interfaces.IAtomContainer; -import org.openscience.cdk.interfaces.IAtomType; -import org.openscience.cdk.interfaces.IBond; -import org.openscience.cdk.interfaces.IMolecule; +import org.openscience.cdk.interfaces.*; import org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder; import org.openscience.cdk.templates.MoleculeFactory; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + /** * This class tests the matching of atom types defined in the * CDK atom type list. @@ -1268,6 +1258,30 @@ assertAtomType(testedAtomTypes, "C.minus.sp2", atm.findMatchingAtomType(mol, atom1)); } + + // [C-]#[N+]C + @Test public void testIsonitrile() throws CDKException { + IMolecule mol = new Molecule(); + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + + IAtom atom1 = new Atom("C"); + IAtom atom2 = new Atom("N"); + atom2.setFormalCharge(1); + IAtom atom3 = new Atom("C"); + atom3.setFormalCharge(-1); + + mol.addAtom(atom1); + mol.addAtom(atom2); + mol.addAtom(atom3); + + mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); + mol.addBond(1, 2, CDKConstants.BONDORDER_TRIPLE); + + assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom1)); + assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom2)); + assertAtomType(testedAtomTypes, "C.minus.sp1", atm.findMatchingAtomType(mol, atom3)); + + } @Test public void testNobleGases() throws Exception { IMolecule mol = new Molecule(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2008-02-02 10:54:34
|
Revision: 9991 http://cdk.svn.sourceforge.net/cdk/?rev=9991&view=rev Author: egonw Date: 2008-02-02 02:54:27 -0800 (Sat, 02 Feb 2008) Log Message: ----------- Added test for C.plus.sp2 without explicit hydrogens... Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-01 17:12:18 UTC (rev 9990) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-02 10:54:27 UTC (rev 9991) @@ -724,6 +724,15 @@ assertAtomType(testedAtomTypes, "C.plus.planar", atm.findMatchingAtomType(mol, atom2)); } + @Test public void testCarbokation_implicitHydrogen() throws Exception { + IMolecule mol = new Molecule(); + IAtom atom2 = new Atom("C"); atom2.setFormalCharge(+1); + mol.addAtom(atom2); + + CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); + assertAtomType(testedAtomTypes, "C.plus.sp2", atm.findMatchingAtomType(mol, atom2)); + } + @Test public void testHydrogen() throws Exception { IMolecule mol = new Molecule(); IAtom atom = new Atom("H"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2008-02-11 07:24:33
|
Revision: 10051 http://cdk.svn.sourceforge.net/cdk/?rev=10051&view=rev Author: egonw Date: 2008-02-10 23:24:26 -0800 (Sun, 10 Feb 2008) Log Message: ----------- More testing that perception before and after atom type property assignments are the same Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-11 05:22:34 UTC (rev 10050) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-11 07:24:26 UTC (rev 10051) @@ -181,9 +181,8 @@ mol.addAtom(atom2); mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"O.sp2", "C.sp2"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testMethanol() throws Exception { @@ -194,9 +193,8 @@ mol.addAtom(atom2); mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"O.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testLithiumMethanoxide() throws Exception { @@ -210,10 +208,8 @@ mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); mol.addBond(0,2,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "Li", atm.findMatchingAtomType(mol, atom3)); + String[] expectedTypes = {"O.sp3", "C.sp3", "Li"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHCN() throws Exception { @@ -224,9 +220,8 @@ mol.addAtom(atom2); mol.addBond(0,1,CDKConstants.BONDORDER_TRIPLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "N.sp1", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"N.sp1", "C.sp"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHNO2() throws Exception { @@ -243,10 +238,8 @@ mol.addBond(0,2,CDKConstants.BONDORDER_SINGLE); mol.addBond(0,3,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "N.plus.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom3)); + String[] expectedTypes = {"N.plus.sp2", "O.sp2", "O.minus", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testMethylAmine() throws Exception { @@ -257,9 +250,8 @@ mol.addAtom(atom2); mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "N.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"N.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testMethyleneImine() throws Exception { @@ -270,9 +262,8 @@ mol.addAtom(atom2); mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "N.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"N.sp2", "C.sp2"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testEthene_withHybridInfo() throws Exception { @@ -286,33 +277,22 @@ mol.addAtom(atom2); mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"C.sp2", "C.sp2"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testPiperidine() throws Exception { Molecule molecule = MoleculeFactory.makePiperidine(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - String[] expectedTypes = { - "N.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3" - }; - for (int f = 0; f < molecule.getAtomCount() - 1; f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + String[] expectedTypes = {"N.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testTetrahydropyran() throws Exception { Molecule molecule = MoleculeFactory.makeTetrahydropyran(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - String[] expectedTypes = { - "O.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3" - }; - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + String[] expectedTypes = {"O.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testS3() throws CDKException { @@ -331,9 +311,8 @@ mol.addBond(b1); mol.addBond(b2); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(0)); - assertAtomType(testedAtomTypes, "S.3", matched); + String[] expectedTypes = {"S.3", "O.sp2", "O.sp2"}; // FIXME: compare with H2S... something not correct + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testH2S() throws CDKException { @@ -352,9 +331,8 @@ mol.addBond(b1); mol.addBond(b2); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(0)); - assertAtomType(testedAtomTypes, "S.3", matched); + String[] expectedTypes = {"S.3", "H", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testH2S_Hybridization() throws CDKException { @@ -362,9 +340,8 @@ IAtom s = DefaultChemObjectBuilder.getInstance().newAtom("S"); s.setHybridization(Hybridization.SP3); mol.addAtom(s); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(0)); - assertAtomType(testedAtomTypes, "S.3", matched); + String[] expectedTypes = {"S.3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHS() throws CDKException { @@ -379,9 +356,8 @@ mol.addAtom(h1); mol.addBond(b1); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - IAtomType matched = atm.findMatchingAtomType(mol, mol.getAtom(0)); - assertAtomType(testedAtomTypes, "S.minus", matched); + String[] expectedTypes = {"S.minus", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testDMSO() throws Exception { @@ -398,11 +374,8 @@ mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "S.inyl", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom4)); + String[] expectedTypes = {"O.sp2", "S.inyl", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testAmide() throws Exception { @@ -416,25 +389,16 @@ mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "N.amide", atm.findMatchingAtomType(mol, atom3)); + String[] expectedTypes = {"O.sp2", "C.sp2", "N.amide"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testAdenine() throws Exception { IMolecule mol = MoleculeFactory.makeAdenine(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(0))); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(1))); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(2))); - assertAtomType(testedAtomTypes, "N.sp2", atm.findMatchingAtomType(mol, mol.getAtom(3))); - assertAtomType(testedAtomTypes, "N.sp2", atm.findMatchingAtomType(mol, mol.getAtom(4))); - assertAtomType(testedAtomTypes, "N.planar3", atm.findMatchingAtomType(mol, mol.getAtom(5))); - assertAtomType(testedAtomTypes, "N.sp2", atm.findMatchingAtomType(mol, mol.getAtom(6))); - assertAtomType(testedAtomTypes, "N.sp3", atm.findMatchingAtomType(mol, mol.getAtom(7))); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(8))); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, mol.getAtom(9))); + String[] expectedTypes = {"C.sp2", "C.sp2", "C.sp2", "N.sp2", "N.sp2", "N.planar3", + "N.sp2", "N.sp2", "C.sp2", "C.sp2" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testAmide2() throws Exception { @@ -451,11 +415,8 @@ mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); mol.addBond(2,3,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom1)); - assertAtomType(testedAtomTypes, "N.amide", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); + String[] expectedTypes = {"O.sp2", "C.sp2", "N.amide", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testThioAcetone() throws Exception { @@ -472,11 +433,8 @@ mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "S.2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom4)); + String[] expectedTypes = {"S.2", "C.sp2", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testSulphuricAcid() throws Exception { @@ -496,12 +454,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "S.onyl", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom4)); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom5)); + String[] expectedTypes = {"O.sp2", "S.onyl", "O.sp2", "O.sp3", "O.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testSulphuricAcid_Charged() throws Exception { @@ -521,12 +475,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "S.onyl.charged", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom4)); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom5)); + String[] expectedTypes = {"O.minus", "S.onyl.charged", "O.minus", "O.sp3", "O.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testSF6() throws Exception { @@ -552,8 +502,8 @@ mol.addBond(1,5,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,6,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "S.octahedral", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"F", "S.octahedral", "F", "F", "F", "F", "F"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testPhosphate() throws Exception { @@ -573,12 +523,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "P.ate", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom4)); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom5)); + String[] expectedTypes = {"O.sp2", "P.ate", "O.sp3", "O.sp3", "O.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testAmmonia() throws Exception { @@ -599,8 +545,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "N.plus", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"H", "N.plus", "H", "H", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testTMS() throws Exception { @@ -620,8 +566,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "Si.sp3", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"C.sp3", "Si.sp3", "C.sp3", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testTinCompound() throws Exception { @@ -641,8 +587,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "Sn.sp3", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"C.sp3", "Sn.sp3", "C.sp3", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testArsenicPlus() throws Exception { @@ -662,8 +608,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "As.plus", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"C.sp3", "As.plus", "C.sp3", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testPhosphine() throws Exception { @@ -680,8 +626,8 @@ mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"H", "P.ine", "H", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testDiethylPhosphine() throws Exception { @@ -695,8 +641,8 @@ mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"C.sp3", "P.ine", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testPhosphorCompound() throws Exception { @@ -710,8 +656,8 @@ mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "P.ine", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"C.sp2", "P.ine", "C.sp3"}; // FIXME: compare with previous test... can't both be P.ine... + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testCarbokation() throws Exception { @@ -728,8 +674,8 @@ mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "C.plus.planar", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"H", "C.plus.planar", "H", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testCarbokation_implicitHydrogen() throws Exception { @@ -737,8 +683,8 @@ IAtom atom2 = new Atom("C"); atom2.setFormalCharge(+1); mol.addAtom(atom2); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "C.plus.sp2", atm.findMatchingAtomType(mol, atom2)); + String[] expectedTypes = {"C.plus.sp2"}; // FIXME: compare with previous test... same compound! + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHydrogen() throws Exception { @@ -746,8 +692,8 @@ IAtom atom = new Atom("H"); mol.addAtom(atom); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "H", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = {"H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHydroxyl() throws Exception { @@ -759,9 +705,8 @@ mol.addAtom(oxygen); mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "H", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, oxygen)); + String[] expectedTypes = {"H", "O.minus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHydroxonium() throws Exception { @@ -779,8 +724,8 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(2,3,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.plus", atm.findMatchingAtomType(mol, oxygen)); + String[] expectedTypes = {"H", "H", "H", "O.plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testPositiveCarbonyl() throws Exception { @@ -801,8 +746,8 @@ mol.addBond(2,4,CDKConstants.BONDORDER_SINGLE); mol.addBond(3,4,CDKConstants.BONDORDER_DOUBLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.plus.sp2", atm.findMatchingAtomType(mol, oxygen)); + String[] expectedTypes = {"H", "H", "H", "O.plus.sp2", "C.sp2"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testProton() throws Exception { @@ -811,8 +756,8 @@ atom.setFormalCharge(1); mol.addAtom(atom); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "H.plus", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = {"H.plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHalides() throws Exception { @@ -822,25 +767,29 @@ IAtom atom = new Atom("Cl"); atom.setFormalCharge(-1); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "Cl.minus", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = {"Cl.minus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("F"); atom.setFormalCharge(-1); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "F.minus", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"F.minus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("Br"); atom.setFormalCharge(-1); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "Br.minus", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"Br.minus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("I"); atom.setFormalCharge(-1); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "I.minus", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"I.minus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHalogens() throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2008-02-11 18:45:31
|
Revision: 10060 http://cdk.svn.sourceforge.net/cdk/?rev=10060&view=rev Author: egonw Date: 2008-02-11 10:44:16 -0800 (Mon, 11 Feb 2008) Log Message: ----------- All tests now do atom type perception before and after assigning atom type props Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-11 16:17:59 UTC (rev 10059) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-11 18:44:16 UTC (rev 10060) @@ -762,7 +762,6 @@ @Test public void testHalides() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom = new Atom("Cl"); atom.setFormalCharge(-1); @@ -794,35 +793,38 @@ @Test public void testHalogens() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom = new Atom("Cl"); IAtom hydrogen = new Atom("H"); mol.addAtom(atom); mol.addAtom(hydrogen); mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = new String[]{"Cl", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("I"); mol.addAtom(atom); mol.addAtom(hydrogen); mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "I", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"I", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("Br"); mol.addAtom(atom); mol.addAtom(hydrogen); mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "Br", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"Br", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("F"); mol.addAtom(atom); mol.addAtom(hydrogen); mol.addBond(0,1,CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "F", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"F", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testHydride() throws Exception { @@ -831,8 +833,8 @@ atom.setFormalCharge(-1); mol.addAtom(atom); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "H.minus", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = new String[]{"H.minus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testAzide() throws Exception { @@ -849,11 +851,8 @@ mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); mol.addBond(2,3,CDKConstants.BONDORDER_TRIPLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "N.minus.sp3", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "N.sp1", atm.findMatchingAtomType(mol, atom4)); + String[] expectedTypes = new String[]{"C.sp3", "N.minus.sp3", "N.plus.sp1", "N.sp1"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testAzide2() throws Exception { @@ -870,16 +869,12 @@ mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); mol.addBond(2,3,CDKConstants.BONDORDER_DOUBLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "N.sp2", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "N.minus.sp2", atm.findMatchingAtomType(mol, atom4)); + String[] expectedTypes = new String[]{"C.sp3", "N.sp2", "N.plus.sp1", "N.minus.sp2"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testMercuryComplex() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom = new Atom("Hg"); atom.setFormalCharge(-1); @@ -898,12 +893,12 @@ mol.addBond(2,3, CDKConstants.BONDORDER_SINGLE); mol.addBond(3,4, CDKConstants.BONDORDER_DOUBLE); mol.addBond(4,0, CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "Hg.minus", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = new String[]{"Hg.minus", "O.plus.sp2", "C.sp2", "C.sp2", "N.sp2"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testPoloniumComplex() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom = new Atom("O"); IAtom atom1 = new Atom("Po"); @@ -916,41 +911,46 @@ mol.addBond(0,1, CDKConstants.BONDORDER_SINGLE); mol.addBond(1,2, CDKConstants.BONDORDER_SINGLE); mol.addBond(2,3, CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "Po", atm.findMatchingAtomType(mol, atom1)); + String[] expectedTypes = new String[]{"O.sp3", "Po", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testSalts() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom = new Atom("Na"); atom.setFormalCharge(+1); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "Na.plus", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = new String[]{"Na.plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("K"); atom.setFormalCharge(+1); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "K.plus", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"K.plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("Ca"); atom.setFormalCharge(+2); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "Ca.2plus", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"Ca.2plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); mol = new Molecule(); atom = new Atom("Mg"); atom.setFormalCharge(+2); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "Mg.2plus", atm.findMatchingAtomType(mol, atom)); - + expectedTypes = new String[]{"Mg.2plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); + mol = new Molecule(); atom = new Atom("Ni"); atom.setFormalCharge(+2); mol.addAtom(atom); - assertAtomType(testedAtomTypes, "Ni.2plus", atm.findMatchingAtomType(mol, atom)); + expectedTypes = new String[]{"Ni.2plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testFerrocene() throws Exception { @@ -976,13 +976,13 @@ ferrocene.addBond(7,8,CDKConstants.BONDORDER_DOUBLE); ferrocene.addBond(8,9,CDKConstants.BONDORDER_SINGLE); ferrocene.addBond(0,9,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(ferrocene.getBuilder()); - assertAtomType(testedAtomTypes, "Fe.2plus", atm.findMatchingAtomType( - ferrocene, ferrocene.getAtom(10)) - ); - assertAtomType(testedAtomTypes, "C.minus.planar", atm.findMatchingAtomType( - ferrocene, ferrocene.getAtom(4)) - ); + + String[] expectedTypes = new String[]{ + "C.sp2","C.sp2","C.sp2","C.sp2","C.minus.planar", + "C.sp2","C.sp2","C.sp2","C.sp2","C.minus.planar", + "Fe.2plus" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, ferrocene); } @Test public void testFuran() throws Exception { @@ -997,10 +997,10 @@ furan.addBond(2,3,CDKConstants.BONDORDER_DOUBLE); furan.addBond(3,4,CDKConstants.BONDORDER_SINGLE); furan.addBond(4,0,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(furan.getBuilder()); - assertAtomType(testedAtomTypes, "O.planar3", atm.findMatchingAtomType( - furan, furan.getAtom(4)) - ); + String[] expectedTypes = new String[]{ + "C.sp2","C.sp2","C.sp2","C.sp2","O.planar3" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, furan); } @Test public void testPerchlorate() throws Exception { @@ -1020,12 +1020,10 @@ mol.addBond(1,3,CDKConstants.BONDORDER_DOUBLE); mol.addBond(1,4,CDKConstants.BONDORDER_DOUBLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "Cl.perchlorate", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom4)); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom5)); + String[] expectedTypes = new String[]{ + "O.sp3", "Cl.perchlorate", "O.sp2", "O.sp2", "O.sp2" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testPerchlorate_ChargedBonds() throws Exception { @@ -1045,12 +1043,10 @@ mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "Cl.perchlorate.charged", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom4)); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, atom5)); + String[] expectedTypes = new String[]{ + "O.sp3", "Cl.perchlorate.charged", "O.minus", "O.minus", "O.minus" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testChlorate() throws Exception { @@ -1067,11 +1063,10 @@ mol.addBond(1,2,CDKConstants.BONDORDER_DOUBLE); mol.addBond(1,3,CDKConstants.BONDORDER_DOUBLE); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.sp3", atm.findMatchingAtomType(mol, atom)); - assertAtomType(testedAtomTypes, "Cl.chlorate", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom3)); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, atom4)); + String[] expectedTypes = new String[]{ + "O.sp3", "Cl.chlorate", "O.sp2", "O.sp2" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testOxide() throws Exception { @@ -1079,16 +1074,17 @@ IAtom atom = new Atom("O"); atom.setFormalCharge(-2); mol.addAtom(atom); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - assertAtomType(testedAtomTypes, "O.minus2", atm.findMatchingAtomType(mol, atom)); + String[] expectedTypes = new String[]{"O.minus2"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testAzulene() throws Exception { Molecule molecule = MoleculeFactory.makeAzulene(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, "C.sp2", atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + String[] expectedTypes = new String[]{ + "C.sp2", "C.sp2", "C.sp2", "C.sp2", "C.sp2", + "C.sp2", "C.sp2", "C.sp2", "C.sp2", "C.sp2" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testIndole() throws Exception { @@ -1104,10 +1100,7 @@ "N.planar3" }; Molecule molecule = MoleculeFactory.makeIndole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testPyrrole() throws Exception { @@ -1119,10 +1112,7 @@ "C.sp2" }; Molecule molecule = MoleculeFactory.makePyrrole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testPyridine() throws Exception { @@ -1135,10 +1125,7 @@ "C.sp2" }; Molecule molecule = MoleculeFactory.makePyridine(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } /** @@ -1156,10 +1143,7 @@ Molecule molecule = MoleculeFactory.makePyridine(); molecule.getAtom(4).setSymbol("S"); molecule.getAtom(4).setFormalCharge(+1); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testPyridineOxide() throws Exception { @@ -1173,10 +1157,7 @@ "O.minus" }; Molecule molecule = MoleculeFactory.makePyridineOxide(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testPyridineOxide_SP2() throws Exception { @@ -1195,10 +1176,7 @@ for (int i=0; i<6; i++) { molecule.getAtom(i).setHybridization(IAtomType.Hybridization.SP2); } - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testThiazole() throws Exception { @@ -1210,15 +1188,11 @@ "C.sp2" }; Molecule molecule = MoleculeFactory.makeThiazole(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); - for (int f = 0; f < molecule.getAtomCount(); f++) { - assertAtomType(testedAtomTypes, expectedTypes[f], atm.findMatchingAtomType(molecule, molecule.getAtom(f))); - } + assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } @Test public void testHaloniums() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom carbon1 = new Atom("C"); IAtom carbon2 = new Atom("C"); @@ -1231,13 +1205,12 @@ mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "I.plus", atm.findMatchingAtomType(mol, atom)); - + String[] expectedTypes = {"I.plus", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testRearrangementCarbokation() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom carbon1 = new Atom("C"); carbon1.setFormalCharge(+1); @@ -1250,30 +1223,29 @@ mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); mol.addBond(1, 2, CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "C.plus.sp2", atm.findMatchingAtomType(mol, carbon1)); + String[] expectedTypes = {"C.plus.sp2", "C.sp2", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testChargedSpecies() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom1 = new Atom("C"); atom1.setFormalCharge(-1); IAtom atom2 = new Atom("O"); atom2.setFormalCharge(+1); - mol.addAtom(atom1); mol.addAtom(atom2); mol.addBond(0, 1, CDKConstants.BONDORDER_TRIPLE); - assertAtomType(testedAtomTypes, "C.minus.sp1", atm.findMatchingAtomType(mol, atom1)); + String[] expectedTypes = {"C.minus.sp1", "O.plus.sp1"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } // [O+]=C-[C-] @Test public void testChargedSpecies2() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom1 = new Atom("O"); atom1.setFormalCharge(1); @@ -1287,13 +1259,13 @@ mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "C.minus.sp3", atm.findMatchingAtomType(mol, atom3)); + String[] expectedTypes = {"O.plus.sp2", "C.sp2", "C.minus.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } // [C-]=C-C @Test public void testChargedSpecies3() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom1 = new Atom("C"); atom1.setFormalCharge(-1); @@ -1306,13 +1278,13 @@ mol.addBond(0, 1, CDKConstants.BONDORDER_DOUBLE); mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "C.minus.sp2", atm.findMatchingAtomType(mol, atom1)); + String[] expectedTypes = {"C.minus.sp2", "C.sp2", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } // [C-]#[N+]C @Test public void testIsonitrile() throws CDKException { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); IAtom atom1 = new Atom("C"); IAtom atom2 = new Atom("N"); @@ -1327,47 +1299,40 @@ mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); mol.addBond(1, 2, CDKConstants.BONDORDER_TRIPLE); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, atom1)); - assertAtomType(testedAtomTypes, "N.plus.sp1", atm.findMatchingAtomType(mol, atom2)); - assertAtomType(testedAtomTypes, "C.minus.sp1", atm.findMatchingAtomType(mol, atom3)); - + String[] expectedTypes = {"C.sp3", "N.plus.sp1", "C.minus.sp1"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testNobleGases() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); mol.addAtom(new Atom("He")); - assertAtomType(testedAtomTypes, "He", atm.findMatchingAtomType(mol, mol.getAtom(0))); + String[] expectedTypes = {"He"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testZincChloride() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - mol.addAtom(new Atom("Zn")); mol.addAtom(new Atom("Cl")); mol.addAtom(new Atom("Cl")); mol.addBond(0, 1, CDKConstants.BONDORDER_SINGLE); mol.addBond(0, 2, CDKConstants.BONDORDER_SINGLE); - assertAtomType(testedAtomTypes, "Zn", atm.findMatchingAtomType(mol, mol.getAtom(0))); - assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, mol.getAtom(1))); - assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, mol.getAtom(2))); + String[] expectedTypes = {"Zn", "Cl", "Cl"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testZinc() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - mol.addAtom(new Atom("Zn")); mol.getAtom(0).setFormalCharge(+2); - assertAtomType(testedAtomTypes, "Zn.2plus", atm.findMatchingAtomType(mol, mol.getAtom(0))); + String[] expectedTypes = {"Zn.2plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testScandium() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); mol.addAtom(new Atom("Sc")); mol.getAtom(0).setFormalCharge(-3); mol.addAtom(new Atom("O")); mol.addBond(0,1,IBond.Order.SINGLE); mol.addAtom(new Atom("H")); mol.addBond(1,2,IBond.Order.SINGLE); @@ -1382,25 +1347,14 @@ mol.addAtom(new Atom("O")); mol.addBond(0,11,IBond.Order.SINGLE); mol.addAtom(new Atom("H")); mol.addBond(11,12,IBond.Order.SINGLE); - assertAtomType( - testedAtomTypes, "Sc.3minus", - atm.findMatchingAtomType(mol, mol.getAtom(0)) - ); - for (int i=0; i<6; i++) { - assertAtomType( - testedAtomTypes, "O.sp3", - atm.findMatchingAtomType(mol, mol.getAtom(1+(i*2))) - ); - assertAtomType( - testedAtomTypes, "H", - atm.findMatchingAtomType(mol, mol.getAtom(2+(i*2))) - ); - } + String[] expectedTypes = {"Sc.3minus", "O.sp3", "H", "O.sp3", "H", + "O.sp3", "H", "O.sp3", "H", "O.sp3", "H", "O.sp3", "H" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testVanadium() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); mol.addAtom(new Atom("V")); mol.getAtom(0).setFormalCharge(-3); mol.addAtom(new Atom("C")); mol.addBond(0,1,IBond.Order.SINGLE); mol.addAtom(new Atom("N")); mol.addBond(1,2,IBond.Order.TRIPLE); @@ -1415,25 +1369,14 @@ mol.addAtom(new Atom("C")); mol.addBond(0,11,IBond.Order.SINGLE); mol.addAtom(new Atom("N")); mol.addBond(11,12,IBond.Order.TRIPLE); - assertAtomType( - testedAtomTypes, "V.3minus", - atm.findMatchingAtomType(mol, mol.getAtom(0)) - ); - for (int i=0; i<6; i++) { - assertAtomType( - testedAtomTypes, "C.sp", - atm.findMatchingAtomType(mol, mol.getAtom(1+(i*2))) - ); - assertAtomType( - testedAtomTypes, "N.sp1", - atm.findMatchingAtomType(mol, mol.getAtom(2+(i*2))) - ); - } + String[] expectedTypes = {"V.3minus", "C.sp", "N.sp1", "C.sp", "N.sp1", + "C.sp", "N.sp1", "C.sp", "N.sp1", "C.sp", "N.sp1", "C.sp", "N.sp1" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testTitanium() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); mol.addAtom(new Atom("Ti")); mol.getAtom(0).setFormalCharge(-3); mol.addAtom(new Atom("C")); mol.addBond(0,1,IBond.Order.SINGLE); mol.addAtom(new Atom("N")); mol.addBond(1,2,IBond.Order.TRIPLE); @@ -1448,26 +1391,14 @@ mol.addAtom(new Atom("C")); mol.addBond(0,11,IBond.Order.SINGLE); mol.addAtom(new Atom("N")); mol.addBond(11,12,IBond.Order.TRIPLE); - assertAtomType( - testedAtomTypes, "Ti.3minus", - atm.findMatchingAtomType(mol, mol.getAtom(0)) - ); - for (int i=0; i<6; i++) { - assertAtomType( - testedAtomTypes, "C.sp", - atm.findMatchingAtomType(mol, mol.getAtom(1+(i*2))) - ); - assertAtomType( - testedAtomTypes, "N.sp1", - atm.findMatchingAtomType(mol, mol.getAtom(2+(i*2))) - ); - } + String[] expectedTypes = {"Ti.3minus", "C.sp", "N.sp1", "C.sp", "N.sp1", + "C.sp", "N.sp1", "C.sp", "N.sp1", "C.sp", "N.sp1", "C.sp", "N.sp1" + }; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testBoronTetraFluoride() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - mol.addAtom(new Atom("B")); mol.getAtom(0).setFormalCharge(-1); mol.addAtom(new Atom("F")); mol.addAtom(new Atom("F")); @@ -1478,13 +1409,12 @@ mol.addBond(0,3,IBond.Order.SINGLE); mol.addBond(0,4,IBond.Order.SINGLE); - assertAtomType(testedAtomTypes, "B.minus", atm.findMatchingAtomType(mol, mol.getAtom(0))); + String[] expectedTypes = {"B.minus", "F", "F", "F", "F"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testBerylliumTetraFluoride() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - mol.addAtom(new Atom("Be")); mol.getAtom(0).setFormalCharge(-2); mol.addAtom(new Atom("F")); mol.addAtom(new Atom("F")); @@ -1495,13 +1425,12 @@ mol.addBond(0,3,IBond.Order.SINGLE); mol.addBond(0,4,IBond.Order.SINGLE); - assertAtomType(testedAtomTypes, "Be.2minus", atm.findMatchingAtomType(mol, mol.getAtom(0))); + String[] expectedTypes = {"Be.2minus", "F", "F", "F", "F"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testBoron() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - mol.addAtom(new Atom("B")); mol.addAtom(new Atom("H")); mol.addAtom(new Atom("H")); @@ -1510,36 +1439,30 @@ mol.addBond(0,2,IBond.Order.SINGLE); mol.addBond(0,3,IBond.Order.SINGLE); - assertAtomType(testedAtomTypes, "B", atm.findMatchingAtomType(mol, mol.getAtom(0))); - + String[] expectedTypes = {"B", "H", "H", "H"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testCarbonMonoxide() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - mol.addAtom(new Atom("C")); mol.getAtom(0).setFormalCharge(-1); mol.addAtom(new Atom("O")); mol.getAtom(1).setFormalCharge(1); mol.addBond(0,1,IBond.Order.TRIPLE); - assertAtomType(testedAtomTypes, "C.minus.sp1", atm.findMatchingAtomType(mol, mol.getAtom(0))); - assertAtomType(testedAtomTypes, "O.plus.sp1", atm.findMatchingAtomType(mol, mol.getAtom(1))); + String[] expectedTypes = {"C.minus.sp1", "O.plus.sp1"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testTitaniumFourCoordinate() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); mol.addAtom(new Atom("Ti")); mol.addAtom(new Atom("Cl")); mol.addBond(0,1,IBond.Order.SINGLE); mol.addAtom(new Atom("Cl")); mol.addBond(0,2,IBond.Order.SINGLE); mol.addAtom(new Atom("Cl")); mol.addBond(0,3,IBond.Order.SINGLE); mol.addAtom(new Atom("Cl")); mol.addBond(0,4,IBond.Order.SINGLE); - assertAtomType(testedAtomTypes, "Ti.sp3", atm.findMatchingAtomType(mol, mol.getAtom(0))); - assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, mol.getAtom(1))); - assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, mol.getAtom(2))); - assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, mol.getAtom(3))); - assertAtomType(testedAtomTypes, "Cl", atm.findMatchingAtomType(mol, mol.getAtom(4))); + String[] expectedTypes = {"Ti.sp3", "Cl", "Cl", "Cl", "Cl"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } /** @@ -1547,8 +1470,6 @@ */ @Test public void bug1872969() throws Exception { IMolecule mol = new Molecule(); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - mol.addAtom(new Atom("C")); mol.addAtom(new Atom("S")); mol.addAtom(new Atom("O")); @@ -1560,12 +1481,8 @@ mol.addBond(1,3, IBond.Order.DOUBLE); mol.addBond(1,4, IBond.Order.SINGLE); - assertAtomType(testedAtomTypes, "C.sp3", atm.findMatchingAtomType(mol, mol.getAtom(0))); - assertAtomType(testedAtomTypes, "S.onyl", atm.findMatchingAtomType(mol, mol.getAtom(1))); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, mol.getAtom(2))); - assertAtomType(testedAtomTypes, "O.sp2", atm.findMatchingAtomType(mol, mol.getAtom(3))); - assertAtomType(testedAtomTypes, "O.minus", atm.findMatchingAtomType(mol, mol.getAtom(4))); - assertAtomType(testedAtomTypes, "Na.plus", atm.findMatchingAtomType(mol, mol.getAtom(5))); + String[] expectedTypes = {"C.sp3", "S.only", "O.sp2", "O.sp2", "O.minus", "Na.plus"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2008-02-12 21:01:00
|
Revision: 10076 http://cdk.svn.sourceforge.net/cdk/?rev=10076&view=rev Author: egonw Date: 2008-02-12 13:00:11 -0800 (Tue, 12 Feb 2008) Log Message: ----------- Fixed typo in commit 10051 for testAdenine where I accidentally changed N.sp3 into N.sp2; misbonding in ferrocene; typo in sulphur atom type Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-12 20:58:27 UTC (rev 10075) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-12 21:00:11 UTC (rev 10076) @@ -396,7 +396,7 @@ @Test public void testAdenine() throws Exception { IMolecule mol = MoleculeFactory.makeAdenine(); String[] expectedTypes = {"C.sp2", "C.sp2", "C.sp2", "N.sp2", "N.sp2", "N.planar3", - "N.sp2", "N.sp2", "C.sp2", "C.sp2" + "N.sp2", "N.sp3", "C.sp2", "C.sp2" }; assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @@ -975,7 +975,7 @@ ferrocene.addBond(6,7,CDKConstants.BONDORDER_SINGLE); ferrocene.addBond(7,8,CDKConstants.BONDORDER_DOUBLE); ferrocene.addBond(8,9,CDKConstants.BONDORDER_SINGLE); - ferrocene.addBond(0,9,CDKConstants.BONDORDER_SINGLE); + ferrocene.addBond(9,5,CDKConstants.BONDORDER_SINGLE); String[] expectedTypes = new String[]{ "C.sp2","C.sp2","C.sp2","C.sp2","C.minus.planar", @@ -1481,7 +1481,7 @@ mol.addBond(1,3, IBond.Order.DOUBLE); mol.addBond(1,4, IBond.Order.SINGLE); - String[] expectedTypes = {"C.sp3", "S.only", "O.sp2", "O.sp2", "O.minus", "Na.plus"}; + String[] expectedTypes = {"C.sp3", "S.onyl", "O.sp2", "O.sp2", "O.minus", "Na.plus"}; assertAtomTypes(testedAtomTypes, expectedTypes, mol); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2008-02-16 06:26:38
|
Revision: 10118 http://cdk.svn.sourceforge.net/cdk/?rev=10118&view=rev Author: egonw Date: 2008-02-15 22:26:36 -0800 (Fri, 15 Feb 2008) Log Message: ----------- Added test for pyridine Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-16 06:26:02 UTC (rev 10117) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-16 06:26:36 UTC (rev 10118) @@ -1128,6 +1128,31 @@ assertAtomTypes(testedAtomTypes, expectedTypes, molecule); } + @Test public void testPyridineDirect() throws Exception { + String[] expectedTypes = { + "N.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2", + "C.sp2" + }; + IMolecule mol = new Molecule(); + mol.addAtom(new Atom("N")); + mol.addAtom(new Atom("C")); + mol.addBond(0,1,IBond.Order.SINGLE); + mol.addAtom(new Atom("C")); + mol.addBond(1,2,IBond.Order.DOUBLE); + mol.addAtom(new Atom("C")); + mol.addBond(2,3,IBond.Order.SINGLE); + mol.addAtom(new Atom("C")); + mol.addBond(3,4,IBond.Order.DOUBLE); + mol.addAtom(new Atom("C")); + mol.addBond(4,5,IBond.Order.SINGLE); + mol.addBond(0,5,IBond.Order.DOUBLE); + assertAtomTypes(testedAtomTypes, expectedTypes, mol); + } + /** * @cdk.bug 1879589 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2008-02-16 14:07:45
|
Revision: 10127 http://cdk.svn.sourceforge.net/cdk/?rev=10127&view=rev Author: egonw Date: 2008-02-16 06:07:41 -0800 (Sat, 16 Feb 2008) Log Message: ----------- Test also after AT prop setting Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-16 13:30:17 UTC (rev 10126) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/CDKAtomTypeMatcherTest.java 2008-02-16 14:07:41 UTC (rev 10127) @@ -82,12 +82,8 @@ atom.setHybridization(thisHybridization); mol.addAtom(atom); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - IAtomType matched = atm.findMatchingAtomType(mol, atom); - Assert.assertNotNull(matched); - assertAtomType(testedAtomTypes, "C.sp3", matched); - - Assert.assertEquals(thisHybridization, matched.getHybridization()); + String[] expectedTypes = {"C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testDummy() throws Exception { @@ -95,9 +91,8 @@ IAtom atom = new PseudoAtom("R"); mol.addAtom(atom); - CDKAtomTypeMatcher atm = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); - IAtomType matched = atm.findMatchingAtomType(mol, atom); - assertAtomType(testedAtomTypes, "X", matched); + String[] expectedTypes = {"X"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); } @Test public void testEthene() throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |