Class FixedValuesGenerator

Synopsis

#include <include/internal/catch_generators.hpp>

template<typename T>
class FixedValuesGenerator final : public IGenerator<T>

Description

No description yet.

Mentioned in

Inheritance

Ancestors: IGenerator

Methods

FixedValuesGenerator
get
next

Source

Lines 71-88 in include/internal/catch_generators.hpp.

template<typename T>
class FixedValuesGenerator final : public IGenerator<T> {
    static_assert(!std::is_same<T, bool>::value,
        "FixedValuesGenerator does not support bools because of std::vector<bool>"
        "specialization, use SingleValue Generator instead.");
    std::vector<T> m_values;
    size_t m_idx = 0;
public:
    FixedValuesGenerator( std::initializer_list<T> values ) : m_values( values ) {}
    T const& get() const override {
        return m_values[m_idx];
    }
    bool next() override {
        ++m_idx;
        return m_idx < m_values.size();
    }
};





Add Discussion as Guest

Log in