mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
compiler/rust/bitset: Test next_unset()
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32812>
This commit is contained in:
parent
2bcb950865
commit
c273ada502
1 changed files with 17 additions and 0 deletions
|
|
@ -427,6 +427,23 @@ mod tests {
|
|||
assert!(set2.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_next_unset() {
|
||||
for test_range in
|
||||
&[0..0, 42..1337, 1337..1337, 31..32, 32..33, 63..64, 64..65]
|
||||
{
|
||||
let mut set = BitSet::new();
|
||||
for i in test_range.clone() {
|
||||
set.insert(i);
|
||||
}
|
||||
for extra_bit in [17, 34, 39] {
|
||||
assert!(test_range.end != extra_bit);
|
||||
set.insert(extra_bit);
|
||||
}
|
||||
assert_eq!(set.next_unset(test_range.start), test_range.end);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_iter() {
|
||||
let vec = vec![0, 1, 99];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue