additional tests

This commit is contained in:
Greg Landrum
2016-01-09 11:14:41 +01:00
parent 9e7b6a7409
commit 3130578930

View File

@@ -264,6 +264,12 @@ void test5LazyFPBReaderTanimoto() {
TEST_ASSERT(feq(fps.getTanimoto(0, bytes), 1.0));
TEST_ASSERT(feq(fps.getTanimoto(1, bytes), 0.3703));
}
{
boost::shared_ptr<ExplicitBitVect> ebv = fps.getFP(0);
TEST_ASSERT(ebv);
TEST_ASSERT(feq(fps.getTanimoto(0, *ebv.get()), 1.0));
TEST_ASSERT(feq(fps.getTanimoto(1, *ebv.get()), 0.3703));
}
{
boost::shared_array<boost::uint8_t> bytes = fps.getBytes(1);
TEST_ASSERT(bytes);
@@ -318,6 +324,17 @@ void test6LazyFPBReaderTanimotoNeighbors() {
TEST_ASSERT(feq(nbrs[1].first, 0.4125));
TEST_ASSERT(nbrs[1].second == 89);
}
{ // ebv with a threshold
boost::shared_ptr<ExplicitBitVect> ebv = fps.getFP(95);
TEST_ASSERT(ebv);
std::vector<std::pair<double, unsigned int> > nbrs =
fps.getTanimotoNeighbors(*ebv.get(), 0.30);
TEST_ASSERT(nbrs.size() == 2);
TEST_ASSERT(feq(nbrs[0].first, 1.));
TEST_ASSERT(nbrs[0].second == 95);
TEST_ASSERT(feq(nbrs[1].first, 0.4125));
TEST_ASSERT(nbrs[1].second == 89);
}
}
BOOST_LOG(rdInfoLog) << "Finished" << std::endl;
}
@@ -422,6 +439,16 @@ void test8FPBReaderContains() {
TEST_ASSERT(nbrs[2] == 87);
TEST_ASSERT(nbrs[3] == 88);
}
{
boost::shared_ptr<ExplicitBitVect> ebv = fps.getFP(87);
TEST_ASSERT(ebv);
std::vector<unsigned int> nbrs = fps.getContainingNeighbors(*ebv.get());
TEST_ASSERT(nbrs.size() == 4);
TEST_ASSERT(nbrs[0] == 85);
TEST_ASSERT(nbrs[1] == 86);
TEST_ASSERT(nbrs[2] == 87);
TEST_ASSERT(nbrs[3] == 88);
}
}
BOOST_LOG(rdInfoLog) << "Finished" << std::endl;
}