Skip to content

Instantly share code, notes, and snippets.

@rapodaca
Created June 25, 2009 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rapodaca/135647 to your computer and use it in GitHub Desktop.
Save rapodaca/135647 to your computer and use it in GitHub Desktop.
import com.metamolecular.mx.fingerprint.Fingerprinter;
import com.metamolecular.mx.fingerprint.PathFingerprinter;
import com.metamolecular.mx.io.Molecules;
import junit.framework.TestCase;
import java.util.BitSet;
public class Test extends TestCase
{
/**
* Fails with f89cd3b7433b707f1e5688648deaa2380a0dac44, but should pass.
*/
public void testItShouldMatchPropaneToAcetone()
{
Fingerprinter fingerprinter = new PathFingerprinter();
BitSet propane = fingerprinter.getFingerprint(Molecules.createPropane());
BitSet acetone = fingerprinter.getFingerprint(Molecules.createAcetone());
assertTrue(match(propane, acetone));
}
private boolean match(BitSet bitset, BitSet other)
{
BitSet intersection = (BitSet) other;
intersection.and(bitset);
return intersection.equals(bitset);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment