From: <raj...@us...> - 2007-06-27 18:38:15
|
Revision: 8440 http://svn.sourceforge.net/cdk/?rev=8440&view=rev Author: rajarshi Date: 2007-06-27 11:38:07 -0700 (Wed, 27 Jun 2007) Log Message: ----------- Added test for As atom type Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/test/atomtype/StructGenMatcherTest.java Modified: trunk/cdk/src/org/openscience/cdk/test/atomtype/StructGenMatcherTest.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/test/atomtype/StructGenMatcherTest.java 2007-06-27 18:30:52 UTC (rev 8439) +++ trunk/cdk/src/org/openscience/cdk/test/atomtype/StructGenMatcherTest.java 2007-06-27 18:38:07 UTC (rev 8440) @@ -64,7 +64,7 @@ assertNotNull(matcher); } - public void testFindMatchingAtomType_IAtomContainer_IAtom() throws ClassNotFoundException, CDKException, java.lang.Exception { + public void testFindMatchingAtomType_IAtomContainer_IAtom() throws CDKException { IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); IAtom atom = DefaultChemObjectBuilder.getInstance().newAtom("C"); atom.setHydrogenCount(4); @@ -77,7 +77,7 @@ assertEquals("C", matched.getSymbol()); } - public void testN3() throws ClassNotFoundException, CDKException, java.lang.Exception { + public void testN3() throws CDKException { Molecule mol = new Molecule(); Atom atom = new Atom("N"); atom.setHydrogenCount(3); @@ -215,5 +215,50 @@ } } + public void testLithium() throws CDKException { + IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); + IAtom atom1 = DefaultChemObjectBuilder.getInstance().newAtom("Li"); + IAtom atom2 = DefaultChemObjectBuilder.getInstance().newAtom("F"); + IBond bond = DefaultChemObjectBuilder.getInstance().newBond(atom1, atom2); + mol.addAtom(atom1); + mol.addAtom(atom2); + mol.addBond(bond); + StructGenMatcher matcher = new StructGenMatcher(); + IAtomType matched = matcher.findMatchingAtomType(mol, mol.getAtom(0)); + assertNotNull(matched); + assertEquals("Li1", matched.getAtomTypeName()); + + matched = matcher.findMatchingAtomType(mol, mol.getAtom(1)); + assertNotNull(matched); + assertEquals("F1", matched.getAtomTypeName()); + } + + public void testArsenic() throws CDKException { + IMolecule mol = DefaultChemObjectBuilder.getInstance().newMolecule(); + IAtom atom1 = DefaultChemObjectBuilder.getInstance().newAtom("As"); + atom1.setHydrogenCount(0); + mol.addAtom(atom1); + for (int i = 0; i < 3; i++) { + IAtom floruineAtom = DefaultChemObjectBuilder.getInstance().newAtom("Cl"); + mol.addAtom(floruineAtom); + IBond bond = DefaultChemObjectBuilder.getInstance().newBond(floruineAtom, atom1, 1.0); + mol.addBond(bond); + } + + StructGenMatcher matcher = new StructGenMatcher(); + IAtomType matched = matcher.findMatchingAtomType(mol, mol.getAtom(0)); + assertNotNull(matched); + assertEquals("As3", matched.getAtomTypeName()); + + for (int i = 1; i < mol.getAtomCount(); i++) { + IAtom atom = mol.getAtom(i); + matched = matcher.findMatchingAtomType(mol, atom); + assertNotNull(matched); + assertEquals("Cl1", matched.getAtomTypeName()); + } + + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |