コード例 #1
0
  public void testItShouldCreateANonemptyFingerprintWhenPathDepthIsZero() {
    Molecule benzene = Molecules.createBenzene();

    fingerprinter.setMaximumPathDepth(0);

    BitSet fingerprint = fingerprinter.getFingerprint(benzene);

    assertFalse(fingerprint.isEmpty());
  }
コード例 #2
0
  public void testItShouldNotFullyIntersectTheFingerprintDerivedFromASubstructure() {
    BitSet benzene = fingerprinter.getFingerprint(Molecules.createBenzene());
    BitSet phenol = fingerprinter.getFingerprint(Molecules.createPhenol());
    BitSet intersection = (BitSet) phenol.clone();

    intersection.and(benzene);

    assertFalse(match(phenol, benzene));
  }
コード例 #3
0
  public void testItCreatesCorrectFingerprintAfterFingerprintLengthSet() {
    BitSet fp1 = fingerprinter.getFingerprint(Molecules.createNaphthalene());

    fingerprinter.setFingerprintLength(1024);

    BitSet fp2 = fingerprinter.getFingerprint(Molecules.createNaphthalene());

    assertEquals(fp1, fp2);
  }
コード例 #4
0
  public void testItShouldReturnTheSameFingerprintForTheSameMolecule() {
    Molecule benzene = Molecules.createBenzene();
    BitSet firstFingerprint = fingerprinter.getFingerprint(benzene);

    for (int i = 0; i < 10; i++) {
      BitSet newFingerprint = fingerprinter.getFingerprint(benzene);

      assertEquals(firstFingerprint, newFingerprint);
    }
  }
コード例 #5
0
  public void testItShouldProduceADifferentFingerprintWhenThePathDepthIsChanged() {
    Molecule naphthalene = Molecules.createNaphthalene();

    fingerprinter.setMaximumPathDepth(6);

    BitSet fp6 = fingerprinter.getFingerprint(naphthalene);

    fingerprinter.setMaximumPathDepth(0);

    BitSet fpall = fingerprinter.getFingerprint(naphthalene);

    assertFalse(fp6.equals(fpall));
  }
コード例 #6
0
 public void testItRaisesWhenReservingMoreRingBitsThanTotalBitCount() {
   try {
     fingerprinter.reserveRingBits(1025);
     fail();
   } catch (IllegalStateException e) {
   }
 }
コード例 #7
0
  public void testItShouldCreateANonemptyFingerprint() {
    Molecule benzene = Molecules.createBenzene();

    BitSet fingerprint = fingerprinter.getFingerprint(benzene);

    assertFalse(fingerprint.isEmpty());
  }
コード例 #8
0
 public void testItRaisesWhenSettingFingerprintLengthBelowRingBitCount() {
   try {
     fingerprinter.setFingerprintLength(19);
     fail();
   } catch (IllegalStateException e) {
   }
 }
コード例 #9
0
  public void testItShouldMatchHexaneToCyclohexane() {
    BitSet cyclohexane = fingerprinter.getFingerprint(Molecules.createCyclohexane());
    BitSet hexane = fingerprinter.getFingerprint(Molecules.createHexane());

    assertTrue(match(hexane, cyclohexane));
  }
コード例 #10
0
 public void testItStartsWithFingerprintLength1024() {
   assertEquals(1024, fingerprinter.getFingerprintLength());
 }
コード例 #11
0
 public void testItStartsWithRingBitsTwenty() {
   assertEquals(20, fingerprinter.getRingBitCount());
 }
コード例 #12
0
 public void testItStartsWithMaxDepthSeven() {
   assertEquals(7, fingerprinter.getMaximumPathDepth());
 }
コード例 #13
0
  public void testItShouldFullyIntersectTheFingerprintDerivedFromASuperstructure() {
    BitSet benzene = fingerprinter.getFingerprint(Molecules.createBenzene());
    BitSet phenol = fingerprinter.getFingerprint(Molecules.createPhenol());

    assertTrue(match(benzene, phenol));
  }
コード例 #14
0
  public void testItDoesntMatchCyclooctaneToOctane() {
    BitSet cyclooctane = fingerprinter.getFingerprint(createCyclooctane());
    BitSet octane = fingerprinter.getFingerprint(createOctane());

    assertFalse(match(cyclooctane, octane));
  }
コード例 #15
0
  public void testItMatchesPropaneToAcetone() {
    BitSet propane = fingerprinter.getFingerprint(Molecules.createPropane());
    BitSet acetone = fingerprinter.getFingerprint(Molecules.createAcetone());

    assertTrue(match(propane, acetone));
  }
コード例 #16
0
  public void testItDoesntMatchEthaneToEthyne() {
    BitSet ethane = fingerprinter.getFingerprint(createEthane());
    BitSet ethyne = fingerprinter.getFingerprint(createEthyne());

    assertFalse(match(ethane, ethyne));
  }
コード例 #17
0
  public void testItGivesTheSameFingerprintFromOXyleneForAlternateKekuleForm() {
    BitSet xylene = fingerprinter.getFingerprint(createXylene());
    BitSet kekule = fingerprinter.getFingerprint(createKekuleXylene());

    assertEquals(xylene, kekule);
  }
コード例 #18
0
  public void testItDoesntChangeFingerprintLengthAfterReservingRingBits() {
    fingerprinter.reserveRingBits(24);

    assertEquals(1024, fingerprinter.getFingerprintLength());
  }
コード例 #19
0
  public void testItShouldNotMatchCyclohexaneToHexane() {
    BitSet cyclohexane = fingerprinter.getFingerprint(Molecules.createCyclohexane());
    BitSet hexane = fingerprinter.getFingerprint(Molecules.createHexane());

    assertFalse(match(cyclohexane, hexane));
  }
コード例 #20
0
  public void testItShouldMatchBenzeneToNaphthalene() {
    BitSet benzene = fingerprinter.getFingerprint(Molecules.createBenzene());
    BitSet naphthalene = fingerprinter.getFingerprint(Molecules.createNaphthalene());

    assertTrue(match(benzene, naphthalene));
  }
コード例 #21
0
  public void testItShouldGiveAFingerprintFromBenzeneThatMatchesOneFromPhenol() {
    BitSet benzene = fingerprinter.getFingerprint(Molecules.createBenzene());
    BitSet phenol = fingerprinter.getFingerprint(Molecules.createPhenol());

    assertTrue(match(benzene, phenol));
  }
コード例 #22
0
  public void testItShouldGiveAFingerprintFromBenzeneThatDoesntMatchCyclohexane() {
    BitSet benzene = fingerprinter.getFingerprint(Molecules.createBenzene());
    BitSet cyclohexane = fingerprinter.getFingerprint(Molecules.createCyclohexane());

    assertFalse(match(cyclohexane, benzene));
  }
コード例 #23
0
 public void testItReturnsWithBrevetoxin() {
   Molecule bt = MoleculeKit.readMolfile(brevetoxinMolfile);
   fingerprinter.setMaximumRingSize(10);
   fingerprinter.getFingerprint(bt);
 }
コード例 #24
0
  public void testItShouldNotMatchCyclopropaneToPropane() {
    BitSet cyclopropane = fingerprinter.getFingerprint(Molecules.createCyclopropane());
    BitSet propane = fingerprinter.getFingerprint(Molecules.createPropane());

    assertFalse(match(cyclopropane, propane));
  }
コード例 #25
0
  public void testItShouldMatchPropaneToCyclopropane() {
    BitSet cyclopropane = fingerprinter.getFingerprint(Molecules.createCyclopropane());
    BitSet propane = fingerprinter.getFingerprint(Molecules.createPropane());

    assertTrue(match(propane, cyclopropane));
  }
コード例 #26
0
  public void testItCreatesA2024BitFingerprint() {
    BitSet fingerprint = fingerprinter.getFingerprint(Molecules.createBenzene());

    assertEquals(1024, fingerprint.size());
  }