From 66bd23800e5e2b01ba4bd25d9917733056f2b977 Mon Sep 17 00:00:00 2001 From: heck Date: Thu, 8 Jul 2021 02:45:52 +0200 Subject: [PATCH] Test: PityUnit - Copy C'tor, clone() --- test/pitytest11/src/PityUnit.hh | 7 +++++-- test/pitytest11/src/PityUnit.hxx | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/test/pitytest11/src/PityUnit.hh b/test/pitytest11/src/PityUnit.hh index b77d07d..0c04e55 100644 --- a/test/pitytest11/src/PityUnit.hh +++ b/test/pitytest11/src/PityUnit.hh @@ -23,7 +23,7 @@ namespace pEp { // Test success if TestFunction: // * does not throw // * returns 0 - using TestFunction = const std::function&, TestContext*)>; + using TestFunction = std::function&, TestContext*)>; // Constructors are private PityUnit() = delete; @@ -40,11 +40,14 @@ namespace pEp { TestContext* perspective = nullptr, ExecutionMode exec_mode = ExecutionMode::FUNCTION); + PityUnit(const PityUnit &rhs); + PityUnit *clone() override; + // Read-Only TestContext* getPerspective() const; private: - void _runSelf(); + void _runSelf() override; // Fields TestContext* _perspective; //nullptr if inherited diff --git a/test/pitytest11/src/PityUnit.hxx b/test/pitytest11/src/PityUnit.hxx index e9ca1c2..122940d 100644 --- a/test/pitytest11/src/PityUnit.hxx +++ b/test/pitytest11/src/PityUnit.hxx @@ -5,6 +5,8 @@ #define PITYTEST_PITYUNIT_HXX #include "../../../src/std_utils.hh" +#include "PityUnit.hh" + #include #include #include @@ -44,6 +46,20 @@ namespace pEp { { } + template + PityUnit::PityUnit(const PityUnit &rhs) : + AbstractPityUnit(rhs, *this) + { + _perspective = rhs._perspective; + _test_func = rhs._test_func; + } + + template + PityUnit *PityUnit::clone() + { + return new PityUnit(*this); + } + template void PityUnit::_runSelf() {