aboutsummaryrefslogtreecommitdiff
path: root/src/core/id_test.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2023-12-29 17:43:50 -0800
committerGarrett D'Amore <garrett@damore.org>2023-12-29 18:25:04 -0800
commit3298ac1e93742e7a1ef5c4dc2e9b603dfa89d3cb (patch)
treea1051ba1a3edcd5bc6c75c9a1f43ae1a14813b45 /src/core/id_test.c
parent5954332f1690e95c329b991a25b2d89b9a44ef02 (diff)
downloadnng-3298ac1e93742e7a1ef5c4dc2e9b603dfa89d3cb.tar.gz
nng-3298ac1e93742e7a1ef5c4dc2e9b603dfa89d3cb.tar.bz2
nng-3298ac1e93742e7a1ef5c4dc2e9b603dfa89d3cb.zip
fixes #1740 Public ID hash API
This includes a manual page documenting the entire set of functions in one step. The hash is 64-bit based for now, to be maximally flexible. An internal 32-bit convenience for the common internal use is also provided (not public). The public API includes a test suite.
Diffstat (limited to 'src/core/id_test.c')
-rw-r--r--src/core/id_test.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/id_test.c b/src/core/id_test.c
index b948cc13..78be63b8 100644
--- a/src/core/id_test.c
+++ b/src/core/id_test.c
@@ -1,5 +1,5 @@
//
-// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
@@ -39,7 +39,7 @@ void
test_random(void)
{
int i;
- uint32_t id;
+ uint64_t id;
for (i = 0; i < 2; i++) {
nni_id_map m;
nni_id_map_init(&m, 0, 0, true);
@@ -94,7 +94,7 @@ void
test_not_found(void)
{
nni_id_map m;
- uint32_t id;
+ uint64_t id;
nni_id_map_init(&m, 0, 0, false);
NUTS_PASS(nni_id_alloc(&m, &id, &id));
@@ -137,7 +137,7 @@ test_dynamic(void)
{
nni_id_map m;
int expect[5];
- uint32_t id;
+ uint64_t id;
nni_id_map_init(&m, 10, 13, false);
@@ -175,7 +175,7 @@ test_set_out_of_range(void)
// We can insert outside the range forcibly.
NUTS_PASS(nni_id_set(&m, 1, &x));
NUTS_PASS(nni_id_set(&m, 100, &x));
- NUTS_PASS(nni_id_alloc(&m, &id, &x));
+ NUTS_PASS(nni_id_alloc32(&m, &id, &x));
NUTS_TRUE(id == 10);
nni_id_map_fini(&m);
}