|
| 1 | +/* |
| 2 | + * Copyright (C) 2011 Jonathan Alvarsson <jonalv@users.sf.net> |
| 3 | + * |
| 4 | + * Contact: cdk-devel@lists.sourceforge.net |
| 5 | + * |
| 6 | + * This program is free software; you can redistribute it and/or |
| 7 | + * modify it under the terms of the GNU Lesser General Public License |
| 8 | + * as published by the Free Software Foundation; either version 2.1 |
| 9 | + * of the License, or (at your option) any later version. |
| 10 | + * All I ask is that proper credit is given for my work, which includes |
| 11 | + * - but is not limited to - adding the above copyright notice to the beginning |
| 12 | + * of your source code files, and to any copyright notice that you may distribute |
| 13 | + * with programs based on this work. |
| 14 | + * |
| 15 | + * This program is distributed in the hope that it will be useful, |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + * GNU Lesser General Public License for more details. |
| 19 | + * |
| 20 | + * You should have received a copy of the GNU Lesser General Public License |
| 21 | + * along with this program; if not, write to the Free Software |
| 22 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 23 | + */ |
| 24 | +package org.openscience.cdk.fingerprint; |
| 25 | + |
| 26 | +import java.util.BitSet; |
| 27 | + |
| 28 | +import org.junit.Assert; |
| 29 | +import org.junit.Test; |
| 30 | +import org.openscience.cdk.silent.SilentChemObjectBuilder; |
| 31 | +import org.openscience.cdk.smiles.SmilesParser; |
| 32 | + |
| 33 | +/** |
| 34 | + * @cdk.module test-fingerprint |
| 35 | + */ |
| 36 | +public class KlekotaRothFingerprinterTest extends AbstractFingerprinterTest { |
| 37 | + |
| 38 | + public IFingerprinter getFingerprinter() { |
| 39 | + return new KlekotaRothFingerprinter(); |
| 40 | + } |
| 41 | + |
| 42 | + @Test |
| 43 | + public void testGetSize() throws Exception { |
| 44 | + IFingerprinter printer = getFingerprinter(); |
| 45 | + Assert.assertEquals(4860, printer.getSize()); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + public void testFingerprint() throws Exception { |
| 50 | + SmilesParser parser = new SmilesParser(SilentChemObjectBuilder.getInstance()); |
| 51 | + IFingerprinter printer = getFingerprinter(); |
| 52 | + |
| 53 | + BitSet bs1 = printer.getFingerprint(parser.parseSmiles("C=C-C#N")); |
| 54 | + BitSet bs2 = printer.getFingerprint(parser.parseSmiles("C=CCC(O)CC#N")); |
| 55 | + |
| 56 | + Assert.assertEquals(4860,printer.getSize()); |
| 57 | + |
| 58 | + Assert.assertTrue(FingerprinterTool.isSubset(bs2, bs1)); |
| 59 | + } |
| 60 | +} |
0 commit comments