Exemple #1
0
void AlignmentTestTrees::checkCallBack(hal::AlignmentConstPtr alignment)
{
  CuAssertTrue(_testCase, alignment->getRootName() == "NewRoot");
  CuAssertTrue(_testCase, alignment->getNewickTree() == 
        "((Leaf:10,Leaf1:3,Leaf2:5.1,Leaf3:6.1,Leaf4:7.1)Root:15)NewRoot;");
  CuAssertTrue(_testCase, alignment->getBranchLength("Root", "Leaf") == 10.0);
  CuAssertTrue(_testCase, alignment->getBranchLength("Root", "Leaf1") == 3.0);
  vector<string> children = alignment->getChildNames("Root");
  CuAssertTrue(_testCase, children.size() == 5);

  vector<string> leaves = alignment->getLeafNamesBelow("Leaf");
  CuAssertTrue(_testCase, leaves.size() == 0);
  leaves = alignment->getLeafNamesBelow("NewRoot");
  CuAssertTrue(_testCase, leaves.size() == 5);
  for (size_t i = 0; i < leaves.size(); ++i)
  {
    CuAssertTrue(_testCase, leaves[i][0] == 'L');
  }
  leaves = alignment->getLeafNamesBelow("Root");
  CuAssertTrue(_testCase, leaves.size() == 5);
  for (size_t i = 0; i < leaves.size(); ++i)
  {
    CuAssertTrue(_testCase, leaves[i][0] == 'L');
  }
}
void AlignmentTestBadPathError::checkCallBack(hal::AlignmentConstPtr alignment)
{
  string badPath(_checkPath);
  badPath += "blarg";
  try {
    ((Alignment*)alignment.get())->open(badPath, true);
  }
  catch(...)
  {
    return;
  }
  CuAssertTrue(_testCase, false);
}
Exemple #3
0
void AlignmentTestBadPathError::checkCallBack(hal::AlignmentConstPtr alignment)
{
#ifndef ENABLE_UDC
  // note: udc just exits here so test wont work
  string badPath(_checkPath);
  badPath += "blarg";
  try {
    ((Alignment*)alignment.get())->open(badPath, true);
  }
  catch(...)
  {
    return;
  }
  CuAssertTrue(_testCase, false);
#endif
}
void AlignmentTestEmpty::checkCallBack(hal::AlignmentConstPtr alignment)
{
  CuAssertTrue(_testCase, alignment->getNumGenomes() == 0);
}