OTest2
A C++ testing framework
|
Go to the documentation of this file.
38 struct SuiteGenerated::Impl {
42 const Context* context;
44 std::vector<FceMarshalerPtr> start_ups;
45 std::vector<FceMarshalerPtr> tear_downs;
49 const Impl&) =
delete;
51 const Impl&) =
delete;
55 const Context& context_,
56 const std::string& name_);
60 SuiteGenerated::Impl::Impl(
61 SuiteGenerated* owner_,
62 const Context& context_,
63 const std::string& name_) :
72 SuiteGenerated::Impl::~Impl() {
78 const std::string& name_) :
80 pimpl(new Impl(this, context_, name_)) {
95 if(index_ >= 0 && index_ < pimpl->start_ups.size()) {
97 pimpl->start_ups[index_]->runFunction(context_);
110 std::make_shared<CmdNextObject>(scenario_->getChildren(), me_));
116 assert(index_ >= 0 && index_ < pimpl->tear_downs.size());
118 pimpl->tear_downs[index_]->runFunction(context_);
123 return *pimpl->context;
129 assert(start_up_ !=
nullptr && tear_down_ !=
nullptr);
130 pimpl->start_ups.push_back(start_up_);
131 pimpl->tear_downs.push_back(tear_down_);
virtual void scheduleBody(const Context &context_, ScenarioPtr scenario_, ObjectPtr parent_) override
Schedule body of the testing object.
virtual const Context & otest2Context() const
Get the OTest2 context.
SuiteGenerated(const SuiteGenerated &)=delete
SuiteGenerated & operator=(const SuiteGenerated &)=delete
virtual void tearDownObject(const Context &context_, int index_) override
Execute tear-down function at specified index.
void pushCommand(CommandPtr command_)
Push a command into the stack.
void registerFixture(FceMarshalerPtr start_up_, FceMarshalerPtr tear_down_)
Register a fixture (a pair of a start-up and a tear-down functions)
virtual bool startUpObject(const Context &context_, int index_) override
Execute start-up function at specified index.
std::shared_ptr< FceMarshaler > FceMarshalerPtr
std::shared_ptr< Object > ObjectPtr
Shared pointer to a testing object.
CommandStack *const command_stack
virtual std::string getName() const
Get object's name.
bool runUserCode(const Context &context_, std::function< void(const Context &)> ftor_) noexcept
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
virtual ~SuiteGenerated()
Dtor.
void odelete(T_ *&object_)
Delete a pointer and set it invalid.