#include "testutils.h" #include #include TestUtils::TestUtils() { } QSet TestUtils::getTree(const QString &path) { QFileInfo info(path); if (!info.exists()) { return {}; } auto result = QSet{}; if (!info.isDir()) { result.insert(info.absoluteFilePath()); return result; } QDir dir(info.absoluteFilePath()); auto list = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot); for (auto &i: list) { result.unite(getTree(i.absoluteFilePath())); } return result; } QHash TestUtils::compareTree(const QSet &leftTree, const QSet &rightTree) { QHash result; auto valuel = leftTree - rightTree; auto valuer = rightTree - leftTree; for(auto &i :valuel) { result.insert(i, 1); } for(auto &i :valuer) { result.insert(i, -1); } return result; }