From c6f377fc2ba2787045a90ad078b68ee6bf993029 Mon Sep 17 00:00:00 2001 From: heck Date: Mon, 7 Jun 2021 23:51:07 +0200 Subject: [PATCH] Tests: PityModel - First shot --- test/pitytest11/src/PityModel.cc | 31 +++++++++++++++++++++++++------ test/pitytest11/src/PityModel.hh | 28 ++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/test/pitytest11/src/PityModel.cc b/test/pitytest11/src/PityModel.cc index 1fcb546..c42867c 100644 --- a/test/pitytest11/src/PityModel.cc +++ b/test/pitytest11/src/PityModel.cc @@ -1,16 +1,35 @@ #include "PityModel.hh" +//#include "PityUnit.hh" #include "iostream" -using namespace std; namespace pEp { namespace PityTest11 { - bool PityModel::log_enabled = true; + bool PityModel::debug_log_enabled = true; - PityModel::PityModel(const string& name) : name(name) {} + PityModel::PityModel(const std::string& name, int nodesCount) : + _name{ name }, _nodes_count{ nodesCount }, _root_unit{ nullptr, name, nullptr, this } + { + + for (int i = 0; i < nodesCount; i++) { + _nodes.emplace_back(PityNode(*this, i)); +// _nodes.emplace_back(*this, i); + } + } + + std::string PityModel::getName() const + { + return _name; + } - const std::string& PityModel::getName() const + std::vector PityModel::getNodes() const { - return name; + return _nodes; } - } // namespace Test + + PityUnit& PityModel::rootUnit() + { + return _root_unit; + } + + } // namespace PityTest11 } // namespace pEp diff --git a/test/pitytest11/src/PityModel.hh b/test/pitytest11/src/PityModel.hh index a660a26..590fe63 100644 --- a/test/pitytest11/src/PityModel.hh +++ b/test/pitytest11/src/PityModel.hh @@ -5,22 +5,34 @@ #define PITYTEST_PITYMODEL_HH #include "../../../src/pEpLog.hh" +#include "PityNode.hh" +#include "PityUnit.hh" namespace pEp { namespace PityTest11 { class PityModel { public: PityModel() = delete; - PityModel(const std::string& name); - virtual const std::string& getName() const; + PityModel(const std::string& name, int nodesCount); + std::string getName() const; + std::vector getNodes() const; + PityUnit& rootUnit(); + + //internal logging + static bool debug_log_enabled; + Adapter::pEpLog::pEpLogger logger_debug{ "PityModel", debug_log_enabled }; private: - const std::string name; - static bool log_enabled; - Adapter::pEpLog::pEpLogger logger{ "PityModel", log_enabled }; - Adapter::pEpLog::pEpLogger& m4gic_logger_n4me = logger; + const int _nodes_count; + PityUnit _root_unit; + std::vector _nodes; + const std::string _name; + + //internal logging + Adapter::pEpLog::pEpLogger& m4gic_logger_n4me = logger_debug; }; - }; // namespace Test -}; // namespace pEp + }; // namespace PityTest11 + +}; // namespace pEp #endif // PITYTEST_PITYMODEL_HH