Skip to content

Commit 0189e2a

Browse files
committed
tests: remove custom seed and use Catch seed and RandomIntegerGenerator
1 parent f671e24 commit 0189e2a

File tree

4 files changed

+175
-154
lines changed

4 files changed

+175
-154
lines changed

tests/include/config.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
#ifndef DYNAMIC_BITSET_CONFIG_HPP
99
#define DYNAMIC_BITSET_CONFIG_HPP
1010

11-
#include <random>
12-
1311
constexpr size_t RANDOM_VECTORS_TO_TEST = 100;
1412
constexpr size_t RANDOM_VARIATIONS_TO_TEST = 10;
15-
constexpr uint32_t SEED = 314159;
16-
//const std::minstd_rand::result_type SEED = std::random_device{}();
1713

1814
#endif //DYNAMIC_BITSET_CONFIG_HPP

tests/src/count.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ TEMPLATE_TEST_CASE("count (" COUNT_TESTED_IMPL ")",
3636
uint32_t,
3737
uint64_t)
3838
{
39-
CAPTURE(SEED);
40-
4139
SECTION("empty bitset")
4240
{
4341
sul::dynamic_bitset<TestType> bitset;
@@ -48,7 +46,7 @@ TEMPLATE_TEST_CASE("count (" COUNT_TESTED_IMPL ")",
4846
SECTION("non-empty bitset")
4947
{
5048
sul::dynamic_bitset<TestType> bitset =
51-
GENERATE(take(RANDOM_VECTORS_TO_TEST, randomDynamicBitset<TestType>(SEED)));
49+
GENERATE(take(RANDOM_VECTORS_TO_TEST, randomDynamicBitset<TestType>()));
5250
CAPTURE(bitset);
5351

5452
size_t count = 0;

tests/src/find_first_find_next.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// https://opensource.org/licenses/MIT
77
//
88
#include "MultiTakeGenerator.hpp"
9-
#include "RandomIntGenerator.hpp"
109
#include "config.hpp"
1110
#include "utils.hpp"
1211

@@ -42,8 +41,6 @@ TEMPLATE_TEST_CASE("find_first find_next (" FIND_FIRST_FIND_NEXT_TESTED_IMPL ")"
4241
uint32_t,
4342
uint64_t)
4443
{
45-
CAPTURE(SEED);
46-
4744
SECTION("empty-bitset")
4845
{
4946
sul::dynamic_bitset<TestType> bitset;
@@ -56,8 +53,8 @@ TEMPLATE_TEST_CASE("find_first find_next (" FIND_FIRST_FIND_NEXT_TESTED_IMPL ")"
5653
{
5754
const std::tuple<size_t, size_t> values =
5855
GENERATE(multitake(RANDOM_VECTORS_TO_TEST,
59-
randomInt<size_t>(0, 5 * bits_number<TestType>, SEED),
60-
randomInt<size_t>(0, 5 * bits_number<TestType>, SEED + 1)));
56+
random<size_t>(0, 5 * bits_number<TestType>),
57+
random<size_t>(0, 5 * bits_number<TestType>)));
6158
const size_t first_bit_pos = std::get<0>(values);
6259
const size_t second_bit_pos = first_bit_pos + 1 + std::get<1>(values);
6360
CAPTURE(first_bit_pos, second_bit_pos);

0 commit comments

Comments
 (0)