u01: Add test case for very short loop
This actually worked, but it is nice to have it verified nonetheless.
This commit is contained in:
parent
8a07422a51
commit
63431b6824
|
@ -178,6 +178,30 @@ TEST_CASE("Cycle detection (iterative)") {
|
|||
delete n;
|
||||
}
|
||||
|
||||
TEST_CASE("Very short cycle detection") {
|
||||
node *n = new node("foo");
|
||||
n->add_child(n);
|
||||
|
||||
std::stringstream output;
|
||||
output << n->print_recursive();
|
||||
|
||||
REQUIRE(output.str() == "foo [↝ foo]\n");
|
||||
|
||||
delete n;
|
||||
}
|
||||
|
||||
TEST_CASE("Very short cycle detection (iterative)") {
|
||||
node *n = new node("foo");
|
||||
n->add_child(n);
|
||||
|
||||
std::stringstream output;
|
||||
output << n->print_iterative();
|
||||
|
||||
REQUIRE(output.str() == "foo [↝ foo]\n");
|
||||
|
||||
delete n;
|
||||
}
|
||||
|
||||
TEST_CASE("Equivalence of iterative and recursive print") {
|
||||
node *n = new node();
|
||||
REQUIRE(n->print_recursive() == n->print_iterative());
|
||||
|
|
Reference in a new issue