Function ChunkGenerator

Synopsis

#include <include/internal/catch_generators_generic.hpp>

ChunkGenerator(size_t size, GeneratorWrapper< T > generator)

Description

No description yet.

Source

Lines 197-210 in include/internal/catch_generators_generic.hpp.

ChunkGenerator(size_t size, GeneratorWrapper<T> generator) :
    m_chunk_size(size), m_generator(std::move(generator))
{
    m_chunk.reserve(m_chunk_size);
    if (m_chunk_size != 0) {
        m_chunk.push_back(m_generator.get());
        for (size_t i = 1; i < m_chunk_size; ++i) {
            if (!m_generator.next()) {
                Catch::throw_exception(GeneratorException("Not enough values to initialize the first chunk"));
            }
            m_chunk.push_back(m_generator.get());
        }
    }
}





Add Discussion as Guest

Log in