Permalink
Browse files

Added test cases to check that the code runs when faced with covalent…

…ly bonded metals. Currenly on failure is due to the presence of Pt, for which we do not have a valency in AtomValence
  • Loading branch information...
1 parent 2a7ee54 commit f32e9a27a1bd87a1d67e9bd719539dd18ed46dfc @rajarshi rajarshi committed Jun 30, 2010
@@ -3,11 +3,14 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.result.DoubleArrayResult;
+import org.openscience.cdk.smiles.SmilesParser;
import javax.vecmath.Point2d;
@@ -242,6 +245,27 @@ public void testDan64() throws Exception {
Assert.assertEquals(0.02778, ret.get(8), 0.00001);
}
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test
+ public void testCovalentMetal() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CCCC[Sn](CCCC)(CCCC)c1cc(Cl)c(Nc2nc(C)nc(N(CCC)CC3CC3)c2Cl)c(Cl)c1");
+ DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
+ Assert.assertNotNull(ret);
+ }
+
+
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test(expected = NullPointerException.class)
+ public void testCovalentPlatinum() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CC1CN[Pt]2(N1)OC(=O)C(C)P(=O)(O)O2");
+ descriptor.calculate(mol).getValue();
+ }
// @Test public void testDan277() throws CDKException {
//
// IMolecule mol = null;
@@ -3,11 +3,14 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.result.DoubleArrayResult;
+import org.openscience.cdk.smiles.SmilesParser;
import javax.vecmath.Point2d;
@@ -185,6 +188,27 @@ public void testDan64() throws Exception {
Assert.assertEquals(0.0000, ret.get(7), 0.0001);
}
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test public void testCovalentMetal() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CCCC[Sn](CCCC)(CCCC)c1cc(Cl)c(Nc2nc(C)nc(N(CCC)CC3CC3)c2Cl)c(Cl)c1");
+ DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
+ Assert.assertNotNull(ret);
+ }
+
+
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test(expected = NullPointerException.class)
+ public void testCovalentPlatinum() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CC1CN[Pt]2(N1)OC(=O)C(C)P(=O)(O)O2");
+ descriptor.calculate(mol).getValue();
+ }
+
// @Test public void testDan277() throws CDKException {
//
// IMolecule mol = null;
@@ -3,11 +3,14 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.result.DoubleArrayResult;
+import org.openscience.cdk.smiles.SmilesParser;
import javax.vecmath.Point2d;
@@ -180,4 +183,26 @@ public void testDan64() throws Exception {
Assert.assertEquals(1.6522, ret.get(5), 0.0001); // 1.7148 ?
}
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test
+ public void testCovalentMetal() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CCCC[Sn](CCCC)(CCCC)c1cc(Cl)c(Nc2nc(C)nc(N(CCC)CC3CC3)c2Cl)c(Cl)c1");
+ DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
+ Assert.assertNotNull(ret);
+ }
+
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test(expected = NullPointerException.class)
+ public void testCovalentPlatinum() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CC1CN[Pt]2(N1)OC(=O)C(C)P(=O)(O)O2");
+ descriptor.calculate(mol).getValue();
+ }
+
+
}
@@ -3,11 +3,14 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.qsar.result.DoubleArrayResult;
+import org.openscience.cdk.smiles.SmilesParser;
import javax.vecmath.Point2d;
@@ -249,6 +252,28 @@ public void testDan64() throws Exception {
Assert.assertEquals(5.5772, ret.get(8), 0.0001);
}
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test
+ public void testCovalentMetal() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CCCC[Sn](CCCC)(CCCC)c1cc(Cl)c(Nc2nc(C)nc(N(CCC)CC3CC3)c2Cl)c(Cl)c1");
+ DoubleArrayResult ret = (DoubleArrayResult) descriptor.calculate(mol).getValue();
+ Assert.assertNotNull(ret);
+ }
+
+ /**
+ * @cdk.bug 3023326
+ */
+ @Test(expected=NullPointerException.class)
+ public void testCovalentPlatinum() throws Exception {
+ SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
+ IAtomContainer mol = sp.parseSmiles("CC1CN[Pt]2(N1)OC(=O)C(C)P(=O)(O)O2");
+ descriptor.calculate(mol).getValue();
+ }
+
+
// @Test public void testDan277() throws CDKException {
//
// IMolecule molecule = null;

0 comments on commit f32e9a2

Please sign in to comment.