1 /* Copyright (C) 2007  Egon Willighagen <egonw@users.sf.net>
2  *
3  * Contact: cdk-devel@lists.sourceforge.net
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation; either version 2.1
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 package org.openscience.cdk.qsar.descriptors.molecular;
20 
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.openscience.cdk.DefaultChemObjectBuilder;
25 import org.openscience.cdk.interfaces.IAtomContainer;
26 import org.openscience.cdk.qsar.result.DoubleResult;
27 import org.openscience.cdk.smiles.SmilesParser;
28 
29 import static org.hamcrest.Matchers.closeTo;
30 
31 /**
32  * TestSuite for the VAdjMaDescriptor.
33  *
34  * @cdk.module test-qsarmolecular
35  */
36 public class VAdjMaDescriptorTest extends MolecularDescriptorTest {
37 
38     @Before
setUp()39     public void setUp() throws Exception {
40         setDescriptor(VAdjMaDescriptor.class);
41     }
42 
ignoreCalculate_IAtomContainer()43     public void ignoreCalculate_IAtomContainer() {
44         Assert.fail("Not tested");
45     }
46 
47     @Test
testCyclic()48     public void testCyclic() throws Exception {
49         SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
50         IAtomContainer mol = sp.parseSmiles("C1CCC2CCCCC2C1");
51         Assert.assertThat(((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), closeTo(4.459, 0.001));
52     }
53 
54     @Test
testLinear()55     public void testLinear() throws Exception {
56         SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
57         IAtomContainer mol = sp.parseSmiles("CCCCCCCCCC");
58         Assert.assertThat(((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), closeTo(4.17, 0.001));
59     }
60 
61     @Test
testCompound()62     public void testCompound() throws Exception {
63         SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
64         IAtomContainer mol = sp.parseSmiles("CCCCC1CCCCC1");
65         Assert.assertThat(((DoubleResult) descriptor.calculate(mol).getValue()).doubleValue(), closeTo(4.322, 0.001));
66     }
67 }
68