#include "support/tree_helpers.hpp" namespace support { // Цепочка ...x... заданной глубины, построенная сверху вниз // A chain ...x... of the given depth, built top-down beresta::Document deepChain(std::size_t depth) { beresta::Document document; beresta::Element* cursor = document.setRoot(std::make_unique("a")); for (std::size_t level = 1; level < depth; ++level) cursor = static_cast(cursor->appendChild(std::make_unique("a"))); cursor->appendChild(std::make_unique("x")); return document; } // Самый глубокий элемент цепочки // The deepest element of the chain beresta::Element* deepestElement(beresta::Document& document) { beresta::Element* cursor = document.getRoot(); while (cursor->getFirstChild() != nullptr && cursor->getFirstChild()->getType() == beresta::NodeType::ELEMENT) cursor = static_cast(cursor->getFirstChild()); return cursor; } }