Class CaseBase

Synopsis

#include <lib/inc/drogon/drogon_test.h>

class CaseBase : public trantor::NonCopyable

Description

No description yet.

Inheritance

Ancestors: NonCopyable

Decsendents: TestCase, Case

Methods

CaseBase overload
~CaseBase
failed
fullname
name
setFailed

Source

Lines 365-415 in lib/inc/drogon/drogon_test.h.

class CaseBase : public trantor::NonCopyable
{
  public:
    CaseBase() = default;
    CaseBase(const std::string& name) : name_(name)
    {
    }
    CaseBase(std::shared_ptr<CaseBase> parent, const std::string& name)
        : parent_(parent), name_(name)
    {
    }
    virtual ~CaseBase() = default;

    std::string fullname() const
    {
        std::string result;
        auto curr = this;
        while (curr != nullptr)
        {
            result = curr->name() + result;
            if (curr->parent_ != nullptr)
                result = "." + result;
            curr = curr->parent_.get();
        }
        return result;
    }

    const std::string& name() const
    {
        return name_;
    }

    void setFailed()
    {
        if (failed_ == false)
        {
            internal::numFailedTestCases++;
            failed_ = true;
        }
    }

    bool failed() const
    {
        return failed_;
    }

  protected:
    bool failed_ = false;
    std::shared_ptr<CaseBase> parent_ = nullptr;
    std::string name_;
};





Add Discussion as Guest

Log in