Skip to content

Commit

Permalink
Added test cases to check that the code runs when faced with covalent…
Browse files Browse the repository at this point in the history
…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
rajarshi committed Jun 30, 2010
1 parent 2a7ee54 commit f32e9a2
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}


}
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f32e9a2

Please sign in to comment.