MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/prevector_tests.cpp:197–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195};
196
197BOOST_AUTO_TEST_CASE(PrevectorTestInt)
198{
199 for (int j = 0; j < 64; j++) {
200 prevector_tester<8, int> test;
201 for (int i = 0; i < 2048; i++) {
202 if (InsecureRandBits(2) == 0) {
203 test.insert(InsecureRandRange(test.size() + 1), InsecureRand32());
204 }
205 if (test.size() > 0 && InsecureRandBits(2) == 1) {
206 test.erase(InsecureRandRange(test.size()));
207 }
208 if (InsecureRandBits(3) == 2) {
209 int new_size = std::max(0, std::min(30, (int)test.size() + (int)InsecureRandRange(5) - 2));
210 test.resize(new_size);
211 }
212 if (InsecureRandBits(3) == 3) {
213 test.insert(InsecureRandRange(test.size() + 1), 1 + InsecureRandBool(), InsecureRand32());
214 }
215 if (InsecureRandBits(3) == 4) {
216 int del = std::min<int>(test.size(), 1 + (InsecureRandBool()));
217 int beg = InsecureRandRange(test.size() + 1 - del);
218 test.erase(beg, beg + del);
219 }
220 if (InsecureRandBits(4) == 5) {
221 test.push_back(InsecureRand32());
222 }
223 if (test.size() > 0 && InsecureRandBits(4) == 6) {
224 test.pop_back();
225 }
226 if (InsecureRandBits(5) == 7) {
227 int values[4];
228 int num = 1 + (InsecureRandBits(2));
229 for (int k = 0; k < num; k++) {
230 values[k] = InsecureRand32();
231 }
232 test.insert_range(InsecureRandRange(test.size() + 1), values, values + num);
233 }
234 if (InsecureRandBits(5) == 8) {
235 int del = std::min<int>(test.size(), 1 + (InsecureRandBits(2)));
236 int beg = InsecureRandRange(test.size() + 1 - del);
237 test.erase(beg, beg + del);
238 }
239 if (InsecureRandBits(5) == 9) {
240 test.reserve(InsecureRandBits(5));
241 }
242 if (InsecureRandBits(6) == 10) {
243 test.shrink_to_fit();
244 }
245 if (test.size() > 0) {
246 test.update(InsecureRandRange(test.size()), InsecureRand32());
247 }
248 if (InsecureRandBits(10) == 11) {
249 test.clear();
250 }
251 if (InsecureRandBits(9) == 12) {
252 test.assign(InsecureRandBits(5), InsecureRand32());
253 }
254 if (InsecureRandBits(3) == 3) {

Callers

nothing calls this directly

Calls 15

InsecureRandBitsFunction · 0.85
InsecureRandRangeFunction · 0.85
InsecureRand32Function · 0.85
maxFunction · 0.85
InsecureRandBoolFunction · 0.85
insert_rangeMethod · 0.80
copyMethod · 0.80
moveMethod · 0.80
insertMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected