diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2023-09-18 14:12:22 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2023-10-04 13:07:33 +0200 |
commit | e338c4b63c6a9258d858f158049943e1e8f00e6f (patch) | |
tree | 2bdf6767e32edbbb12d75760ed8be9f1ed623471 /lib/bitmap_test.c | |
parent | bcff3ae79acfd938459869ac98db4f83e3d422b6 (diff) |
Lib: Extend MPLS label allocator bitmap
Add function lmap_last_one_in_range() for finding the last active label
in a label range.
Diffstat (limited to 'lib/bitmap_test.c')
-rw-r--r-- | lib/bitmap_test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/bitmap_test.c b/lib/bitmap_test.c index 3aeeaef5..39fbd0ed 100644 --- a/lib/bitmap_test.c +++ b/lib/bitmap_test.c @@ -216,6 +216,18 @@ t_lmap_set_clear_fill(void) lmap_clear(&b, n); expected[n] = 0; } + + { + n = lmap_last_one_in_range(&b, lo, hi); + bt_assert(n >= lo); + bt_assert(n <= hi); + + for (last = n + 1; last < hi; last++) + bt_assert(!expected[last]); + + if (n < hi) + bt_assert(expected[n]); + } } uint cnt = 0; |