Skip to content

Commit

Permalink
Should not use the SMILES parser: make the whole testing vague as SMI…
Browse files Browse the repository at this point in the history
…LES parsing is not a well defined process.

git-svn-id: https://cdk.svn.sourceforge.net/svnroot/cdk/trunk/cdk@5884 eb4e18e3-b210-0410-a6ab-dec725e4b171
  • Loading branch information
egonw committed Apr 6, 2006
1 parent 30f4772 commit 0446879
Showing 1 changed file with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
import junit.framework.TestSuite;

import org.openscience.cdk.interfaces.IAtomType;
import org.openscience.cdk.Atom;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.atomtype.HybridizationStateATMatcher;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.smiles.SmilesParser;
import org.openscience.cdk.test.CDKTestCase;
import org.openscience.cdk.tools.HydrogenAdder;
import org.openscience.cdk.tools.manipulator.AtomTypeManipulator;

/**
* Checks the functionality of the AtomType-HybridizationStateATMatcher.
*
* @cdk.module test-extra
* @cdk.module test-core
*
* @see org.openscience.cdk.atomtype.HybridizationStateATMatcher
*/
Expand All @@ -64,21 +64,30 @@ public void testHybridizationStateATMatcher() throws ClassNotFoundException, CDK
}

public void testFindMatchingAtomType_IAtomContainer_IAtom() throws ClassNotFoundException, CDKException, java.lang.Exception {
SmilesParser sp = new SmilesParser();
Molecule mol = sp.parseSmiles("C#CCC=O");
HydrogenAdder hAdder = new HydrogenAdder();
hAdder.addExplicitHydrogensToSatisfyValency(mol);
org.openscience.cdk.interfaces.IAtom atom = mol.getAtomAt(0);

HybridizationStateATMatcher atm = new HybridizationStateATMatcher();
IAtomType matched = atm.findMatchingAtomType(mol, atom);

AtomTypeManipulator.configure(atom, matched);

int hybridization = atom.getHybridization();
int thisHybridization = CDKConstants.HYBRIDIZATION_SP1;

assertEquals(thisHybridization, hybridization);
Molecule mol = new Molecule();
mol.addAtom(new Atom("C"));
mol.addAtom(new Atom("C"));
mol.addBond(1,2,3);
mol.addAtom(new Atom("C"));
mol.addBond(2,3,1);
mol.addAtom(new Atom("C"));
mol.addBond(3,4,1);
mol.addAtom(new Atom("O"));
mol.addBond(4,5,2);

HydrogenAdder hAdder = new HydrogenAdder();
hAdder.addExplicitHydrogensToSatisfyValency(mol);
org.openscience.cdk.interfaces.IAtom atom = mol.getAtomAt(0);

HybridizationStateATMatcher atm = new HybridizationStateATMatcher();
IAtomType matched = atm.findMatchingAtomType(mol, atom);

AtomTypeManipulator.configure(atom, matched);

int hybridization = atom.getHybridization();
int thisHybridization = CDKConstants.HYBRIDIZATION_SP1;

assertEquals(thisHybridization, hybridization);
//assertEquals("C", at.getSymbol());
}
}

0 comments on commit 0446879

Please sign in to comment.