3
0
mirror of https://github.com/isar/libmdbx.git synced 2025-02-19 12:58:13 +08:00

mdbx-testing: подавление параноидальных предупреждений MSVC в extra-тестах.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-09-14 20:29:16 +03:00
parent 14a55ee244
commit 202cdbc4be
2 changed files with 14 additions and 12 deletions

@ -64,7 +64,7 @@ static mdbx::slice mk(mdbx::default_buffer &buf, unsigned min, unsigned max) {
unsigned len = (min < max) ? min + prng_fast(seed) % (max - min) : min;
buf.clear_and_reserve(len);
for (unsigned i = 0; i < len; ++i)
buf.append_byte(prng_fast(seed));
buf.append_byte(mdbx::byte(prng_fast(seed)));
return buf.slice();
}
@ -112,28 +112,30 @@ static void chunched_delete(mdbx::txn txn, const acase &thecase,
{
auto cursor = txn.open_cursor(map);
while (true) {
const unsigned all = cursor.txn().get_map_stat(cursor.map()).ms_entries;
const auto all = cursor.txn().get_map_stat(cursor.map()).ms_entries;
// printf("== seek random of %u\n", all);
const char *last_op;
bool last_r;
if ((last_op = "MDBX_GET_BOTH",
last_r = cursor.find_multivalue(mk_key(k, thecase),
mk_val(v, thecase), false)) ||
if (true == ((last_op = "MDBX_GET_BOTH"),
(last_r = cursor.find_multivalue(
mk_key(k, thecase), mk_val(v, thecase), false))) ||
rnd() % 3 == 0 ||
(last_op = "MDBX_SET_RANGE",
last_r = cursor.lower_bound(mk_key(k, thecase), false))) {
true == ((last_op = "MDBX_SET_RANGE"),
(last_r = cursor.lower_bound(mk_key(k, thecase), false)))) {
int i = int(rnd() % 7) - 3;
// if (i)
// printf(" %s -> %s\n", last_op, last_r ? "true" : "false");
// printf("== shift multi %i\n", i);
try {
while (i < 0 && (last_op = "MDBX_PREV_DUP",
last_r = cursor.to_current_prev_multi(false)))
while (i < 0 &&
true == ((last_op = "MDBX_PREV_DUP"),
(last_r = cursor.to_current_prev_multi(false))))
++i;
while (i > 0 && (last_op = "MDBX_NEXT_DUP",
last_r = cursor.to_current_next_multi(false)))
while (i > 0 &&
true == ((last_op = "MDBX_NEXT_DUP"),
(last_r = cursor.to_current_next_multi(false))))
--i;
} catch (const mdbx::no_data &) {
printf("cursor_del() -> exception, last %s %s\n", last_op,

@ -17,7 +17,7 @@ static buffer random(size_t length) {
buffer result(length);
#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
for (auto &i : result.bytes())
i = prng();
i = mdbx::byte(prng());
#else
for (auto p = result.byte_ptr(); p < result.end_byte_ptr(); ++p)
*p = mdbx::byte(prng());