From 48c470b72cf32c49dc146f5859d67708759997b2 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 11 Jul 2019 22:57:21 +0200 Subject: rework diceparser to run unit tests --- node/testnode.cpp | 48 ------------------------------------------------ node/testnode.h | 44 -------------------------------------------- 2 files changed, 92 deletions(-) delete mode 100644 node/testnode.cpp delete mode 100644 node/testnode.h (limited to 'node') diff --git a/node/testnode.cpp b/node/testnode.cpp deleted file mode 100644 index 263286b..0000000 --- a/node/testnode.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "testnode.h" -#include "die.h" - -TestNode::TestNode() {} - -TestNode::~TestNode() -{ - m_nextNode= nullptr; - m_result= nullptr; -} -void TestNode::run(ExecutionNode* previous) -{ - if(nullptr != m_nextNode) - { - m_nextNode->run(this); - } -} - -QString TestNode::toString(bool wl) const -{ - if(wl) - { - return QStringLiteral("%1 [label=\"TestNode \"]").arg(m_id); - } - else - { - return m_id; - } -} -qint64 TestNode::getPriority() const -{ - qint64 priority= 4; - return priority; -} -ExecutionNode* TestNode::getCopy() const -{ - TestNode* node= new TestNode(); - if(nullptr != m_nextNode) - { - node->setNextNode(m_nextNode->getCopy()); - } - return node; -} - -void TestNode::setResult(Result* result) -{ - m_result= result; -} diff --git a/node/testnode.h b/node/testnode.h deleted file mode 100644 index 5c918ee..0000000 --- a/node/testnode.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef TESTNODE_H -#define TESTNODE_H - -#include - -#include "executionnode.h" -#include "result/diceresult.h" -#include -/** - * @brief The TestNode class replaces any kind of node for test purpose. - */ -class TestNode : public ExecutionNode -{ -public: - /** - * @brief TestNode builds an instance - * @param faces, number of faces of dices - * @param offset, first value of dice. - */ - TestNode(); - virtual ~TestNode() override; - - /** - * @brief run - starts to roll dice. - */ - virtual void run(ExecutionNode*) override; - /** - * @brief toString - * @param wl - * @return use to generate dot tree; - */ - virtual QString toString(bool wl) const override; - /** - * @brief getPriority - * @return priority for dice roll: 4 (higher) - */ - virtual qint64 getPriority() const override; - - virtual ExecutionNode* getCopy() const override; - - void setResult(Result* result); -}; - -#endif // TESTNODE_H -- cgit v1.2.3-70-g09d2