Skip to content

Commit

Permalink
Unit test for bug #3040273.
Browse files Browse the repository at this point in the history
This unit test works and shows the error on the SMILES Generator code.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
Saravanaraj authored and egonw committed Sep 7, 2010
1 parent e8cec0f commit 3bf8397
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/test/org/openscience/cdk/smiles/SmilesGeneratorTest.java
Expand Up @@ -34,6 +34,7 @@
import org.junit.Test;
import org.openscience.cdk.Atom;
import org.openscience.cdk.AtomContainer;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.CDKTestCase;
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.DefaultChemObjectBuilder;
Expand All @@ -57,9 +58,10 @@
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.io.CMLReader;
import org.openscience.cdk.io.CMLWriter;
import org.openscience.cdk.io.IChemObjectReader.Mode;
import org.openscience.cdk.io.MDLReader;
import org.openscience.cdk.io.MDLV2000Reader;
import org.openscience.cdk.io.IChemObjectReader.Mode;
import org.openscience.cdk.isomorphism.UniversalIsomorphismTester;
import org.openscience.cdk.layout.HydrogenPlacer;
import org.openscience.cdk.layout.StructureDiagramGenerator;
import org.openscience.cdk.templates.MoleculeFactory;
Expand Down Expand Up @@ -939,6 +941,24 @@ public void testCanSmiWithConfiguredAtoms() throws CDKException, IOException {
Assert.assertTrue("The two canonical SMILES should match",o1.equals(o2));
}

/**
* @cdk.bug 3040273
*/
@Test
public void testBug3040273() throws Exception {
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
String testSmiles = "C1(C(C(C(C(C1Br)Br)Br)Br)Br)Br";
IAtomContainer mol = sp.parseSmiles(testSmiles);
IsotopeFactory fact = IsotopeFactory.getInstance(DefaultChemObjectBuilder.getInstance());
fact.configureAtoms(mol);
SmilesGenerator sg = new SmilesGenerator();
String smiles = sg.createSMILES((IMolecule) mol);
System.out.println(smiles);
IAtomContainer mol2 = sp.parseSmiles(smiles);
Assert.assertTrue(UniversalIsomorphismTester.isIsomorph(mol, mol2));
}


@Test public void testCreateSMILESWithoutCheckForMultipleMolecules_withDetectAromaticity() throws CDKException{
IMolecule benzene = MoleculeFactory.makeBenzene();
SmilesGenerator sg = new SmilesGenerator(false);
Expand Down

0 comments on commit 3bf8397

Please sign in to comment.