Skip to content
Snippets Groups Projects
Verified Commit 51a3cc6c authored by Alberto Miranda's avatar Alberto Miranda :hotsprings:
Browse files

Add tests for is_divisible()

parent a3801406
No related branches found
No related tags found
No related merge requests found
......@@ -96,6 +96,24 @@ SCENARIO(" powers of 2 can be correctly detected ",
}
}
SCENARIO(" divisibility by powers of 2 can be correctly detected ",
"[utils][numeric][is_divisible]") {
GIVEN(" a number and a block_size ") {
const uint64_t n = GENERATE(range(0, 1000), range(20000, 23000),
std::numeric_limits<uint64_t>::max());
const std::size_t block_size =
GENERATE(filter([](uint64_t bs) { return is_power_of_2(bs); },
range(0, 10000)));
CAPTURE(n, block_size);
bool expected = n % block_size == 0;
REQUIRE(is_divisible(n, block_size) == expected);
}
}
SCENARIO(" offsets can be left-aligned to block size boundaries ",
"[utils][numeric][chnk_lalign]") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment