From bb5ffe198662dff7831843660473a6b99213225a Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Fri, 27 Aug 2010 15:10:33 +0200 Subject: [PATCH] Unit tests for SMILES parsing bugs reported in #3048501 Signed-off-by: Rajarshi Guha --- .../cdk/smiles/SmilesParserTest.java | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/test/org/openscience/cdk/smiles/SmilesParserTest.java b/src/test/org/openscience/cdk/smiles/SmilesParserTest.java index 9a9976783aa..1e0c12bc280 100644 --- a/src/test/org/openscience/cdk/smiles/SmilesParserTest.java +++ b/src/test/org/openscience/cdk/smiles/SmilesParserTest.java @@ -1849,6 +1849,77 @@ public void testPyrolle() throws InvalidSmilesException{ } } + /** + * @cdk.bug 3048501 + */ + @Test + public void testAromaticSeParsing() throws InvalidSmilesException{ + SmilesParser p = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IMolecule mol = p.parseSmiles("c1cc2cccnc2[se]1"); + for (IAtom atom : mol.atoms()) { + Assert.assertTrue(atom.getFlag(CDKConstants.ISAROMATIC)); + } + } + + /** + * @cdk.bug 3048501 + */ + @Test + public void testCeParsing() throws InvalidSmilesException{ + SmilesParser p = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IMolecule mol = p.parseSmiles("Cl[Ce](Cl)Cl"); + Assert.assertEquals("Ce", mol.getAtom(1).getSymbol()); + } + + /** + * @cdk.bug 3048501 + */ + @Test + public void testErParsing() throws InvalidSmilesException{ + SmilesParser p = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IMolecule mol = p.parseSmiles("Cl[Er](Cl)Cl"); + Assert.assertEquals("Er", mol.getAtom(1).getSymbol()); + } + + /** + * @cdk.bug 3048501 + */ + @Test + public void testGdParsing() throws InvalidSmilesException{ + SmilesParser p = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IMolecule mol = p.parseSmiles("Cl[Gd](Cl)Cl"); + Assert.assertEquals("Gd", mol.getAtom(1).getSymbol()); + } + + /** + * @cdk.bug 3048501 + */ + @Test + public void testSmParsing() throws InvalidSmilesException{ + SmilesParser p = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IMolecule mol = p.parseSmiles("Cl[Sm](Cl)Cl"); + Assert.assertEquals("Sm", mol.getAtom(1).getSymbol()); + } + + /** + * @cdk.bug 3048501 + */ + @Test + public void testLaParsing() throws InvalidSmilesException{ + SmilesParser p = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IMolecule mol = p.parseSmiles("[Cl-].[Cl-].[Cl-].[La+3]"); + Assert.assertEquals("La", mol.getAtom(3).getSymbol()); + } + + /** + * @cdk.bug 3048501 + */ + @Test + public void testAcParsing() throws InvalidSmilesException{ + SmilesParser p = new SmilesParser(DefaultChemObjectBuilder.getInstance()); + IMolecule mol = p.parseSmiles("[255Ac]"); + Assert.assertEquals("Ac", mol.getAtom(0).getSymbol()); + } /** * @cdk.bug 2976054 * @throws InvalidSmilesException