CPPUNIT_TEST_SUITE( TESTNAME );
CPPUNIT_TEST( testCreate );
CPPUNIT_TEST( testMakeUnoriented );
+ CPPUNIT_TEST( testCountLeaves );
CPPUNIT_TEST_SUITE_END();
protected:
void testCreate (){
GeneOrder go(_validPerm.begin(),_validPerm.end());
ComponentTree t(findComponents(go));
- ComponentTree::Node* n = &t._root;
+ ComponentTree::Node* n = t._root;
CPPUNIT_ASSERT_EQUAL((size_t)4u,count(n));
CPPUNIT_ASSERT_EQUAL((size_t)5u,count(n,true));
GeneOrder go2(_validPerm4.begin(),_validPerm4.end());
ComponentTree t2(findComponents(go2));
- n = &t2._root;
+ n = t2._root;
CPPUNIT_ASSERT_EQUAL((size_t)6u,count(n));
CPPUNIT_ASSERT_EQUAL((size_t)9u,count(n,true));
GeneOrder go(_validPerm.begin(),_validPerm.end());
ComponentTree t(findComponents(go));
t.makeUnoriented();
- ComponentTree::Node* n = &t._root;
+ ComponentTree::Node* n = t._root;
CPPUNIT_ASSERT_EQUAL((size_t)0u,count(n));
CPPUNIT_ASSERT_EQUAL((size_t)1u,count(n,true));
GeneOrder go2(_validPerm4.begin(),_validPerm4.end());
ComponentTree t2(findComponents(go2));
t2.makeUnoriented();
- n = &t2._root;
+ n = t2._root;
CPPUNIT_ASSERT_EQUAL((size_t)4u,count(n));
CPPUNIT_ASSERT_EQUAL((size_t)6u,count(n,true));
CPPUNIT_ASSERT(n->_children[1]->_children[0]->_children[1]->_comp == go24);
}
+ void testCountLeaves (){
+ GeneOrder go(_validPerm.begin(),_validPerm.end());
+ ComponentTree t(findComponents(go));
+ t.makeUnoriented();
+
+ //CPPUNIT_ASSERT_EQUAL((size_t)0u,t.countLeaves());
+
+ GeneOrder go2(_validPerm4.begin(),_validPerm4.end());
+ ComponentTree t2(findComponents(go2));
+ t2.makeUnoriented();
+ ComponentTree::Node* n = t2._root;
+ CPPUNIT_ASSERT_EQUAL((size_t)2u,n->_children.size());
+ CPPUNIT_ASSERT_EQUAL(false,n->_children.empty());
+ CPPUNIT_ASSERT_EQUAL((size_t)3u,t2.countLeaves());
+ }
+
};
CPPUNIT_TEST_SUITE_REGISTRATION( TESTNAME );