-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
163 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,4 @@ | |
.dirstamp | ||
topo | ||
topo_dbg | ||
unittest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ before_install: | |
|
||
script: | ||
- make | ||
- make unittest | ||
- ./unittest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
A simple program for enumerating all possible binary tree Newick strings from given taxon names. This program is part of the program hybrid-coal. | ||
USEAGE: | ||
|
||
$ ./topo a b c d e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Execute this program to run the test suite. | ||
* | ||
* Usually there's no need to change anything in here. | ||
*/ | ||
#include <cppunit/TestResult.h> | ||
#include <cppunit/TestResultCollector.h> | ||
#include <cppunit/TestRunner.h> | ||
#include <cppunit/extensions/TestFactoryRegistry.h> | ||
#include <cppunit/BriefTestProgressListener.h> | ||
#include <cppunit/CompilerOutputter.h> | ||
|
||
using namespace CppUnit; | ||
|
||
int main(void) { | ||
TestResult controller; | ||
|
||
TestResultCollector result; | ||
controller.addListener(&result); | ||
|
||
BriefTestProgressListener progress; | ||
controller.addListener(&progress); | ||
|
||
TestRunner runner; | ||
runner.addTest( TestFactoryRegistry::getRegistry().makeTest() ); | ||
runner.run(controller); | ||
|
||
CompilerOutputter outputter(&result, std::cerr); | ||
outputter.write(); | ||
|
||
return result.wasSuccessful() ? 0 : 1; | ||
} | ||
|
||
// EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <cppunit/TestCase.h> | ||
#include <cppunit/extensions/HelperMacros.h> | ||
#include "all_gene_topo.hpp" | ||
|
||
#pragma GCC diagnostic ignored "-Wwrite-strings" | ||
|
||
class TestGeneTopoList : public CppUnit::TestCase { | ||
|
||
CPPUNIT_TEST_SUITE( TestGeneTopoList ); | ||
CPPUNIT_TEST ( testConstructor ); | ||
CPPUNIT_TEST ( testExtract ); | ||
CPPUNIT_TEST_SUITE_END(); | ||
private: | ||
|
||
public: | ||
void setUp() { | ||
return; | ||
} | ||
|
||
void tearDown() { | ||
return; | ||
} | ||
|
||
void testConstructor(){ | ||
const char *vinit3[] = {"a", "b", "c"}; | ||
std::vector<std::string> v3(vinit3, end(vinit3)); | ||
GeneTopoList testList3(v3); | ||
CPPUNIT_ASSERT ( testList3.TipLabels.size() == (unsigned)3 ); | ||
CPPUNIT_ASSERT ( testList3.TreeList.size() == (unsigned)3 ); | ||
|
||
const char *vinit4[] = {"a", "b", "c", "d"}; | ||
std::vector<std::string> v4(vinit4, end(vinit4)); | ||
GeneTopoList testList4(v4); | ||
CPPUNIT_ASSERT ( testList4.TipLabels.size() == (unsigned)4 ); | ||
CPPUNIT_ASSERT ( testList4.TreeList.size() == (unsigned)15 ); | ||
|
||
const char *vinit5[] = {"a", "b", "c", "d", "e"}; | ||
std::vector<std::string> v5(vinit5, end(vinit5)); | ||
GeneTopoList testList5(v5); | ||
CPPUNIT_ASSERT ( testList5.TipLabels.size() == (unsigned)5 ); | ||
CPPUNIT_ASSERT ( testList5.TreeList.size() == (unsigned)105 ); | ||
|
||
const char *vinit6[] = {"a", "b", "c", "1", "2", "3"}; | ||
std::vector<std::string> v6(vinit6, end(vinit6)); | ||
GeneTopoList testList6(v6); | ||
CPPUNIT_ASSERT ( testList6.TipLabels.size() == (unsigned)6 ); | ||
CPPUNIT_ASSERT ( testList6.TreeList.size() == (unsigned)945 ); | ||
|
||
} | ||
|
||
void testExtract(){ | ||
GeneTopoList testList; | ||
string tree = "(((A,B),C),D);"; | ||
CPPUNIT_ASSERT_NO_THROW(testList.extract_TipLabels_from_TreeStr(tree)); | ||
CPPUNIT_ASSERT ( testList.TipLabels.size() == (unsigned)4 ); | ||
CPPUNIT_ASSERT_NO_THROW(testList.init()); | ||
CPPUNIT_ASSERT_NO_THROW(testList.core()); | ||
CPPUNIT_ASSERT ( testList.TreeList.size() == (unsigned)15 ); | ||
} | ||
}; | ||
|
||
CPPUNIT_TEST_SUITE_REGISTRATION( TestGeneTopoList ); |