-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
Description
Describe the bug
When using ChunkGenerator with a chunk-size of 0, the first vector returned is size 1. Following vectors are size 0.
Expected behavior
The first (and all following) vectors should be size 0.
Reproduction steps
TEST_CASE("chunks") {
auto vector = GENERATE(take(5, chunk(0, value(1))));
REQUIRE(vector.size() == 0);
}Platform information:
- OS: Linux 5.1.15-arch1-1-ARCH
- Compiler+version: g++ (GCC) 9.1.0
- Catch version: Catch v2.7.2 (it looks like the bug still exists though)
Additional context
My specific use-case in which I ran into this is a test like this:
TEST_CASE("my function") {
auto size = GENERATE(0, 1, 2, 3);
auto vector = GENERATE_COPY(take(1, chunk(size, random(-100, 100))));
auto list = VectorToList(vector);
REQUIRE(list.size() == size);
}It's possible that the intended behaviour was to return a minimum chunk-size of 1 for all chunks, but I think it would make much more sense to return empty vectors, otherwise the use-case above would be more annoying to write.
Reactions are currently unavailable