diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-26 13:20:54 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-26 13:27:50 -0400 |
commit | ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7 (patch) | |
tree | bb64d4cdd2913bc17f8f559c360824caa90e33a8 /src/test/test_containers.c | |
parent | bf89278c799e718a3b6c1ea139a6069db054ac09 (diff) | |
download | tor-ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7.tar.gz tor-ebbb0348dc3ad57f6be8208a90f3c2fd9fe2cbf7.zip |
Finish renaming digestset_contains to digestset_probably_contains
Since bloom filters are probabilistic, it's nice to make it clear
that the "contains" operation can have false positives.
Diffstat (limited to 'src/test/test_containers.c')
-rw-r--r-- | src/test/test_containers.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/test_containers.c b/src/test/test_containers.c index acb7543b39..5c712a9b16 100644 --- a/src/test/test_containers.c +++ b/src/test/test_containers.c @@ -644,18 +644,18 @@ test_container_digestset(void *arg) } set = digestset_new(1000); SMARTLIST_FOREACH(included, const char *, cp, - if (digestset_contains(set, cp)) + if (digestset_probably_contains(set, cp)) ok = 0); tt_assert(ok); SMARTLIST_FOREACH(included, const char *, cp, digestset_add(set, cp)); SMARTLIST_FOREACH(included, const char *, cp, - if (!digestset_contains(set, cp)) + if (!digestset_probably_contains(set, cp)) ok = 0); tt_assert(ok); for (i = 0; i < 1000; ++i) { crypto_rand(d, DIGEST_LEN); - if (digestset_contains(set, d)) + if (digestset_probably_contains(set, d)) ++false_positives; } tt_int_op(50, OP_GT, false_positives); /* Should be far lower. */ |