aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/dice/testnode.cpp
diff options
context:
space:
mode:
authorrenaud guezennec <renaud@rolisteam.org>2019-07-29 20:35:52 +0000
committerrenaud guezennec <renaud@rolisteam.org>2019-07-29 20:35:52 +0000
commit1a902d383eef1e042d4462cd07b9384fcdf4d118 (patch)
tree766b8ab720fa5da11730d2fc2388f51b9d14de49 /tests/dice/testnode.cpp
parentf5906125576a8323a731c9456ce3dfc53b67ef59 (diff)
parent0d4b68221bda594cc695d216dfa21306ddb69c85 (diff)
downloadOneRoll-1a902d383eef1e042d4462cd07b9384fcdf4d118.tar.gz
OneRoll-1a902d383eef1e042d4462cd07b9384fcdf4d118.zip
Merge branch 'liberation' into 'master'
Add fuzzer on the DiceParser See merge request kde/rolisteam-diceparser!2
Diffstat (limited to 'tests/dice/testnode.cpp')
-rw-r--r--tests/dice/testnode.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/dice/testnode.cpp b/tests/dice/testnode.cpp
new file mode 100644
index 0000000..de9fc05
--- /dev/null
+++ b/tests/dice/testnode.cpp
@@ -0,0 +1,49 @@
+#include "testnode.h"
+#include "die.h"
+
+TestNode::TestNode() {}
+
+TestNode::~TestNode()
+{
+ m_nextNode= nullptr;
+ m_result= nullptr;
+}
+void TestNode::run(ExecutionNode* previous)
+{
+ Q_UNUSED(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;
+}