25 #ifndef WDENDROGRAM_TEST_H
26 #define WDENDROGRAM_TEST_H
28 #include <cxxtest/TestSuite.h>
30 #include "../../WLogger.h"
31 #include "../WDendrogram.h"
59 d.
merge( 3, 4, 0.60 );
60 d.
merge( 6, 7, 0.32 );
62 ss <<
"(0, (0,))" << std::endl;
63 ss <<
"(0, (1,))" << std::endl;
64 ss <<
"(0, (2,))" << std::endl;
65 ss <<
"(0, (3,))" << std::endl;
66 ss <<
"(0, (4,))" << std::endl;
67 ss <<
"(1, (0, 1), (0, 1), 0.8)" << std::endl;
68 ss <<
"(2, (2, 0, 1), (2, 5), 0.4)" << std::endl;
69 ss <<
"(1, (3, 4), (3, 4), 0.6)" << std::endl;
70 ss <<
"(3, (2, 0, 1, 3, 4), (6, 7), 0.32)" << std::endl;
73 std::cout <<
"Expected:" << std::endl << ss.str();
74 std::cout <<
"But got:" << std::endl << d.
toString();
75 TS_FAIL(
"Invalid dendrogram to string generation" );
88 #endif // WDENDROGRAM_TEST_H
size_t merge(size_t i, size_t j, double height)
Merges two elements (either inner nodes or leafs) given via the indices i and j.
static void startup(std::ostream &output=std::cout, LogLevel level=LL_DEBUG)
Create the first and only instance of the logger as it is a singleton.
TestSuite for the WDendrogram class.
std::string toString() const
Transform this dendrogram into a string, where each leaf or inner node is mapped to a special string...
void testStringCreation(void)
Check if the dendrogram correctly constructs the txt string.
void setUp(void)
Sets up the WLogger to properly log some thing...
Hirachical binary tree datastructure with spatial layout information called dendrogram.