Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unit tests for the expected behavior of bug #1294
Change-Id: I943742f9f17334610c403dd8d0d7006142b7af68
Signed-off-by: John May <john.wilkinsonmay@gmail.com>
  • Loading branch information
egonw committed Mar 25, 2013
1 parent bfb2b1b commit c3a6452
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
Expand Up @@ -196,6 +196,28 @@ public void testDetectAromaticity_IAtomContainer() throws Exception {
Assert.assertEquals(1, numberOfAromaticRings);
}

/**
* @cdk.bug 1294
*/
@Test public void testBug1294() throws Exception {
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());

IAtomContainer mol = sp.parseSmiles("C2=C1C=CC=CC1=CN2");
Assert.assertTrue("Molecule is not detected aromatic", CDKHueckelAromaticityDetector.detectAromaticity(mol));
for (IAtom atom : mol.atoms()) Assert.assertTrue(atom.getFlag(CDKConstants.ISAROMATIC));
}

/**
* @cdk.bug 1294
*/
@Test public void testBug1294_2() throws Exception {
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());

IAtomContainer mol = sp.parseSmiles("c2c1ccccc1c[nH]2");
Assert.assertTrue("Molecule is not detected aromatic", CDKHueckelAromaticityDetector.detectAromaticity(mol));
for (IAtom atom : mol.atoms()) Assert.assertTrue(atom.getFlag(CDKConstants.ISAROMATIC));
}

/**
* A unit test for JUnit The special difficulty with Azulene is that only the
* outermost larger 10-ring is aromatic according to Hueckel rule.
Expand Down
Expand Up @@ -110,6 +110,29 @@ public class CDKAtomTypeMatcherSMILESTest extends AbstractCDKAtomTypeTest {
}
}

/**
* @cdk.bug 1294
*/
@Test public void testBug1294() throws Exception {
String smiles1 = "c2c1ccccc1c[nH]2";
String smiles2 = "C2=C1C=CC=CC1=CN2";

IMolecule mol1 = smilesParser.parseSmiles(smiles1);
IMolecule mol2 = smilesParser.parseSmiles(smiles2);

Assert.assertEquals(mol1.getAtomCount(), mol2.getAtomCount());
Assert.assertEquals(mol1.getBondCount(), mol2.getBondCount());

IAtomType[] types1 = atomTypeMatcher.findMatchingAtomType(mol1);
IAtomType[] types2 = atomTypeMatcher.findMatchingAtomType(mol2);
for (int i=0; i<mol1.getAtomCount(); i++) {
Assert.assertEquals(
types1[i].getAtomTypeName(),
types2[i].getAtomTypeName()
);
}
}

/**
* @cdk.bug 3093644
*/
Expand Down

0 comments on commit c3a6452

Please sign in to comment.