OTest2
A C++ testing framework
|
Go to the documentation of this file.
35 struct StateGenerated::Impl {
39 const Context* context;
47 const Impl&) =
delete;
49 const Impl&) =
delete;
53 const Context& context_,
54 const std::string& name_,
55 const std::string& section_path_);
59 StateGenerated::Impl::Impl(
60 StateGenerated* owner_,
61 const Context& context_,
62 const std::string& name_,
63 const std::string& section_path_) :
67 section(section_path_),
72 StateGenerated::Impl::~Impl() {
78 const std::string& name_,
79 const std::string& section_path_) :
81 pimpl(new Impl(this, context_, name_, section_path_)) {
96 assert(parent_ !=
nullptr);
98 pimpl->parent = parent_;
106 return *pimpl->context;
111 const std::string& name_,
113 assert(pimpl->parent !=
nullptr && !name_.empty() && delay_ >= 0);
117 std::make_shared<CmdState>(pimpl->parent, name_, delay_));
122 const std::string& section_path_) {
StateGenerated(const StateGenerated &)=delete
This is a simple object keeping path to current testing object.
virtual ~StateGenerated()
Dtor.
bool isTestSectionActive(const Context &context_, const std::string §ion_path_)
Check whether a test section is active.
std::shared_ptr< CaseOrdinary > CaseOrdinaryPtr
Shared pointer of the ordinary cases.
CommandStack *const command_stack
void switchState(const Context &context_, const std::string &name_, int delay_)
Switch test states.
bool runUserCode(const Context &context_, std::function< void(const Context &)> ftor_) noexcept
void replaceCommand(CommandPtr command_)
Replace a command at the top of the stack.
virtual std::string getName() const
Get object's name.
virtual const Context & otest2Context() const
Get the OTest2 context.
void odelete(T_ *&object_)
Delete a pointer and set it invalid.
StateGenerated & operator=(const StateGenerated &)=delete
bool isPrefixOf(const ObjectPath &path_) const noexcept
Tell us whether this object is a prefix of specified path_.
virtual void executeState(const Context &context_, CaseOrdinaryPtr parent_)
Run the state.