2 template <typename T, typename U>
5 SizeIterator(MTRandom *rand, size_t howmany)
9 fixed_size_(SIZEOF_ARRAY(U::sizes)),
13 if (count_ < fixed_size_) {
14 return fixed_[count_];
16 return rand_->Rand<T>() % U::max_value;
20 return count_ >= fixed_size_ && count_ >= howmany_;
38 static size_t sizes[];
39 static size_t max_value;
42 size_t SmallSizes::sizes[] = {
52 size_t SmallSizes::max_value = 128 * 3;
57 static size_t sizes[];
58 static size_t max_value;
61 size_t LargeSizes::sizes[] = {
67 size_t LargeSizes::max_value = 1<<20;
70 struct BaseConstants {
71 static const size_t TEST_ROUNDS;
74 const size_t BaseConstants::TEST_ROUNDS = 10;
76 // Regtest<> arguments
77 struct SmallBlock : public BaseConstants {
78 static const xoff_t BLOCK_SIZE;
79 static const size_t WINDOW_SIZE;
80 typedef SmallSizes Sizes;
83 const xoff_t SmallBlock::BLOCK_SIZE = 1<<7;
84 const size_t SmallBlock::WINDOW_SIZE = 1<<7;
86 struct LargeBlock : public BaseConstants {
87 static const xoff_t BLOCK_SIZE;
88 static const size_t WINDOW_SIZE;
89 typedef LargeSizes Sizes;
92 const xoff_t LargeBlock::BLOCK_SIZE = (1 << 13);
93 const size_t LargeBlock::WINDOW_SIZE = (1 << 13);
95 struct MixedBlock : public BaseConstants {
96 static const xoff_t BLOCK_SIZE;
97 static const size_t WINDOW_SIZE;
98 typedef SmallSizes Sizes;
101 const xoff_t MixedBlock::BLOCK_SIZE = 1<<7;
102 const size_t MixedBlock::WINDOW_SIZE = 1<<8;
104 struct OversizeBlock : public BaseConstants {
105 static const xoff_t BLOCK_SIZE;
106 static const size_t WINDOW_SIZE;
107 typedef SmallSizes Sizes;
110 const xoff_t OversizeBlock::BLOCK_SIZE = 1<<8;
111 const size_t OversizeBlock::WINDOW_SIZE = 1<<7;