summaryrefslogtreecommitdiff
path: root/test/birdtest.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-05-16 13:25:48 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-05-16 13:25:48 +0200
commit3cf91fb9eb5e6aa51e63edcd237ee266373aec79 (patch)
tree094d80d17e747e6307b48125bdcc0250366c0be5 /test/birdtest.h
parenta8a64ca0fed41c78376b27880e934296bd3c3a7f (diff)
Nest: Add tests and benchmark for FIB
Basic fib_get() / fib_find() test for random prefixes, FIB_WALK() test, and benchmark for fib_find(). Also generalize and reuse some code from trie tests.
Diffstat (limited to 'test/birdtest.h')
-rw-r--r--test/birdtest.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/birdtest.h b/test/birdtest.h
index cfeebb98..540092d6 100644
--- a/test/birdtest.h
+++ b/test/birdtest.h
@@ -37,6 +37,10 @@ int bt_test_suite_base(int (*test_fn)(const void *), const char *test_id, const
static inline u64 bt_random(void)
{ return ((u64) random() & 0xffffffff) | ((u64) random() << 32); }
+static inline u32 bt_random_n(u32 max)
+{ return random() % max; }
+
+
void bt_log_suite_result(int result, const char *fmt, ...);
void bt_log_suite_case_result(int result, const char *fmt, ...);