#include #include #include int main() { bool error=false; std::shared_ptr t=std::make_shared(); // first test if the parent node is a nullptr for root node if ( t->getParent() != nullptr ) { std::cerr << "Failed Test: Root node parent is not null" << std::endl; error=true; } /* * create a temp node and add to root */ std::shared_ptr temp0=std::make_shared(); t->addChild(temp0); // check if the parent node of temp0 has been set correctly if (temp0->getParent() != t) { std::cerr << "Failed Test: temp0 node parent is null" << std::endl; error=true; } // check if the number of direct children of t is 1 if (t->getNrDirectChildren() != 1) { std::cerr << "Failed Test: nr of direct children is not 1" << std::endl; error=true; } if (error) { return -1; } std::cerr << "Test OK" << std::endl; return 0; }