Browse Source

Test: PityTest - update test_pitytree.cc

LIB-11
heck 11 months ago
parent
commit
24d2c072df
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      test/pitytest11/test/test_pitytree.cc

+ 17
- 0
test/pitytest11/test/test_pitytree.cc View File

@ -19,6 +19,7 @@ public:
// methods
virtual int implMe(int magic_nr) = 0;
AbstractNode& getSelf() override = 0;
AbstractNode *clone() override = 0;
// fields
@ -48,6 +49,7 @@ public:
explicit ANode(const std::string &name);
explicit ANode(const std::string &name, AbstractNode &parent);
ANode(const ANode &rhs);
ANode &getSelf() override;
ANode *clone() override;
int implMe(int magic_nr) override;
};
@ -61,6 +63,11 @@ int ANode::implMe(int magic_nr)
return 23;
}
ANode &ANode::getSelf()
{
return *this;
}
ANode *ANode::clone()
{
return new ANode(*this);
@ -73,6 +80,7 @@ public:
explicit BNode(const std::string &name);
explicit BNode(const std::string &name, AbstractNode &parent);
BNode(const BNode &rhs);
BNode &getSelf() override;
BNode *clone() override;
int implMe(int magic_nr) override;
};
@ -86,6 +94,11 @@ int BNode::implMe(int magic_nr)
return 42;
}
BNode &BNode::getSelf()
{
return *this;
}
BNode *BNode::clone()
{
return new BNode(*this);
@ -141,4 +154,8 @@ int main(int argc, char *argv[])
a.getChild("b").addCopy(ANode(a), a.getName() + "1");
std::cout << a.to_string() << std::endl;
ANode a2 = ANode(a);
a2.setName("a2");
std::cout << a2.to_string() << std::endl;
}

Loading…
Cancel
Save