mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 05:20:37 +02:00
rusticl: add a bunch of trivial tests
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35188>
This commit is contained in:
parent
ccf099d0d1
commit
dcfa4fafca
2 changed files with 17 additions and 0 deletions
|
|
@ -7,3 +7,13 @@ pub fn test_bit(bitset: &[u32], bit: u32) -> bool {
|
|||
|
||||
bitset[idx as usize] & (1 << test) != 0
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_test_bit() {
|
||||
let data = [0x3254424d, 0xffffffff, 0x00000001];
|
||||
|
||||
assert!(test_bit(&data, 0));
|
||||
assert!(!test_bit(&data, 5));
|
||||
assert!(test_bit(&data, 64));
|
||||
assert!(!test_bit(&data, 65));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,13 @@ where
|
|||
b
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gcd_test() {
|
||||
assert_eq!(gcd(5, 15), 5);
|
||||
assert_eq!(gcd(7, 15), 1);
|
||||
assert_eq!(gcd(60, 45), 15);
|
||||
}
|
||||
|
||||
pub struct SetBitIndices<T> {
|
||||
val: T,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue