mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 01:14:13 +08:00
mdbx-test: fix keylen/datalen min/max ranges checking.
This commit is contained in:
parent
6b5ada7b6e
commit
26c4b673c4
@ -122,16 +122,16 @@ void maker::setup(const config::actor_params_pod &actor,
|
||||
unsigned thread_number) {
|
||||
key_essentials.flags =
|
||||
actor.table_flags & (MDBX_INTEGERKEY | MDBX_REVERSEKEY);
|
||||
assert(actor.keylen_min < UINT8_MAX);
|
||||
assert(actor.keylen_min <= UINT8_MAX);
|
||||
key_essentials.minlen = (uint8_t)actor.keylen_min;
|
||||
assert(actor.keylen_max < UINT16_MAX);
|
||||
assert(actor.keylen_max <= UINT16_MAX);
|
||||
key_essentials.maxlen = (uint16_t)actor.keylen_max;
|
||||
|
||||
value_essentials.flags =
|
||||
actor.table_flags & (MDBX_INTEGERDUP | MDBX_REVERSEDUP);
|
||||
assert(actor.datalen_min < UINT8_MAX);
|
||||
assert(actor.datalen_min <= UINT8_MAX);
|
||||
value_essentials.minlen = (uint8_t)actor.datalen_min;
|
||||
assert(actor.datalen_max < UINT16_MAX);
|
||||
assert(actor.datalen_max <= UINT16_MAX);
|
||||
value_essentials.maxlen = (uint16_t)actor.datalen_max;
|
||||
|
||||
assert(thread_number < 2);
|
||||
|
27
test/main.cc
27
test/main.cc
@ -188,20 +188,33 @@ int main(int argc, char *const argv[]) {
|
||||
config::duration, 1))
|
||||
continue;
|
||||
if (config::parse_option(argc, argv, narg, "keylen.min", params.keylen_min,
|
||||
config::no_scale, 0, params.keylen_max))
|
||||
config::no_scale, 0, UINT8_MAX)) {
|
||||
if (params.keylen_max < params.keylen_min)
|
||||
params.keylen_max = params.keylen_min;
|
||||
continue;
|
||||
if (config::parse_option(argc, argv, narg, "keylen.max", params.keylen_max,
|
||||
config::no_scale, params.keylen_min,
|
||||
mdbx_get_maxkeysize(0)))
|
||||
}
|
||||
if (config::parse_option(
|
||||
argc, argv, narg, "keylen.max", params.keylen_max, config::no_scale,
|
||||
0, std::min(mdbx_get_maxkeysize(0), (int)UINT16_MAX))) {
|
||||
|
||||
if (params.keylen_min > params.keylen_max)
|
||||
params.keylen_min = params.keylen_max;
|
||||
continue;
|
||||
}
|
||||
if (config::parse_option(argc, argv, narg, "datalen.min",
|
||||
params.datalen_min, config::no_scale, 0,
|
||||
params.datalen_max))
|
||||
UINT8_MAX)) {
|
||||
if (params.datalen_max < params.datalen_min)
|
||||
params.datalen_max = params.datalen_min;
|
||||
continue;
|
||||
}
|
||||
if (config::parse_option(argc, argv, narg, "datalen.max",
|
||||
params.datalen_max, config::no_scale,
|
||||
params.datalen_min, MDBX_MAXDATASIZE))
|
||||
params.datalen_max, config::no_scale, 0,
|
||||
std::min((int)UINT16_MAX, MDBX_MAXDATASIZE))) {
|
||||
if (params.datalen_min > params.datalen_max)
|
||||
params.datalen_min = params.datalen_max;
|
||||
continue;
|
||||
}
|
||||
if (config::parse_option(argc, argv, narg, "batch.read", params.batch_read,
|
||||
config::no_scale, 1))
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user