2 * Copyright (c) 2020 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 #include <vlib/vlib.h>
16 #include <vppinfra/bitmap.h>
19 test_bitmap_command_fn (vlib_main_t * vm,
20 unformat_input_t * input, vlib_cli_command_t * cmd)
27 bm = clib_bitmap_set_multiple (bm, 2, ~0ULL, BITS (uword));
29 junk = clib_bitmap_next_clear (bm, 3);
30 junk = clib_bitmap_next_clear (bm, 65);
32 bm2 = clib_bitmap_set_multiple (bm2, 0, ~0ULL, BITS (uword));
34 junk = clib_bitmap_next_clear (bm2, 0);
37 bm = clib_bitmap_set_multiple (bm, 2, ~0ULL, BITS (uword) - 3);
38 junk = clib_bitmap_get_multiple (bm, 2, BITS (uword));
39 junk = clib_bitmap_first_set (bm);
41 bm = clib_bitmap_xori (bm, junk);
42 bm = clib_bitmap_andi (bm, junk);
43 bm = clib_bitmap_xori_notrim (bm, junk);
44 bm = clib_bitmap_andi_notrim (bm, junk);
46 bm = clib_bitmap_set_multiple (bm, 2, ~0ULL, BITS (uword) - 3);
47 bm2 = clib_bitmap_set_multiple (bm2, 2, ~0ULL, BITS (uword) - 3);
49 dup = clib_bitmap_dup_and (bm, bm2);
51 dup = clib_bitmap_dup_andnot (bm, bm2);
62 VLIB_CLI_COMMAND (test_bihash_command, static) =
64 .path = "test bitmap",
65 .short_help = "Coverage test for bitmap.h",
66 .function = test_bitmap_command_fn,
71 * fd.io coding-style-patch-verification: ON
74 * eval: (c-set-style "gnu")