Browse Source

Test: PityUnit - Copy C'tor, clone()

LIB-11
heck 11 months ago
parent
commit
66bd23800e
2 changed files with 21 additions and 2 deletions
  1. +5
    -2
      test/pitytest11/src/PityUnit.hh
  2. +16
    -0
      test/pitytest11/src/PityUnit.hxx

+ 5
- 2
test/pitytest11/src/PityUnit.hh View File

@ -23,7 +23,7 @@ namespace pEp {
// Test success if TestFunction:
// * does not throw
// * returns 0
using TestFunction = const std::function<int(PityUnit<TestContext>&, TestContext*)>;
using TestFunction = std::function<int(PityUnit<TestContext>&, TestContext*)>;
// Constructors are private
PityUnit() = delete;
@ -40,11 +40,14 @@ namespace pEp {
TestContext* perspective = nullptr,
ExecutionMode exec_mode = ExecutionMode::FUNCTION);
PityUnit<TestContext>(const PityUnit<TestContext> &rhs);
PityUnit<TestContext> *clone() override;
// Read-Only
TestContext* getPerspective() const;
private:
void _runSelf();
void _runSelf() override;
// Fields
TestContext* _perspective; //nullptr if inherited


+ 16
- 0
test/pitytest11/src/PityUnit.hxx View File

@ -5,6 +5,8 @@
#define PITYTEST_PITYUNIT_HXX
#include "../../../src/std_utils.hh"
#include "PityUnit.hh"
#include <iostream>
#include <unistd.h>
#include <cstdlib>
@ -44,6 +46,20 @@ namespace pEp {
{
}
template<class TestContext>
PityUnit<TestContext>::PityUnit(const PityUnit<TestContext> &rhs) :
AbstractPityUnit(rhs, *this)
{
_perspective = rhs._perspective;
_test_func = rhs._test_func;
}
template<class TestContext>
PityUnit<TestContext> *PityUnit<TestContext>::clone()
{
return new PityUnit<TestContext>(*this);
}
template<class TestContext>
void PityUnit<TestContext>::_runSelf()
{


Loading…
Cancel
Save