Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rectify LINGOs regressions.
  • Loading branch information
johnmay authored and egonw committed Dec 18, 2014
1 parent 52330f4 commit b03297f
Showing 1 changed file with 21 additions and 6 deletions.
Expand Up @@ -32,6 +32,9 @@

import java.util.Map;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

/**
* @cdk.module test-smiles
*/
Expand All @@ -51,19 +54,31 @@ public void testGetSize() throws Exception {
Assert.assertEquals(-1, fingerprinter.getSize());
}

@Ignore("tested by testFingerprint")

@Test
@Override
public void testGetRawFingerprint() {}
public void testGetCountFingerprint() throws Exception {
LingoFingerprinter fpr = new LingoFingerprinter(4);
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer mol = sp.parseSmiles("Oc1ccccc1");
ICountFingerprint fp = fpr.getCountFingerprint(mol);
assertThat(fp.getCountForHash("cccc".hashCode()), is(2));
assertThat(fp.getCountForHash("Oc0c".hashCode()), is(1));
assertThat(fp.getCountForHash("c0cc".hashCode()), is(1));
assertThat(fp.getCountForHash("0ccc".hashCode()), is(1));
assertThat(fp.getCountForHash("ccc0".hashCode()), is(1));
}

@Test
public void testFingerprint() throws Exception {
@Override
public void testGetRawFingerprint() throws Exception {
LingoFingerprinter lfp = new LingoFingerprinter(3);
SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());
IAtomContainer mol = sp.parseSmiles("O(NC)PS");
IAtomContainer mol = sp.parseSmiles("SPONC");
Map<String, Integer> map = lfp.getRawFingerprint(mol);
Assert.assertEquals(5, map.size());
String[] subs = {"O(N", "(NC", "NC)", "C)P", ")PS"};
Assert.assertEquals(3, map.size());
// depend on canonical ordering of the SMILES since lingos uses Unique SMILES
String[] subs = {"PON", "ONC", "SPO"};
for (String s : subs)
Assert.assertTrue(map.containsKey(s));
}
Expand Down

0 comments on commit b03297f

Please sign in to comment.