Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Added tests (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao authored Feb 5, 2022
1 parent 3f7b937 commit 9a8edd0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/it/array/boolean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ fn basics() {

let array: BooleanArray = data.into_iter().collect();

assert_eq!(array.data_type(), &DataType::Boolean);

assert!(array.value(0));
assert!(!array.value(1));
assert!(!array.value(2));
assert!(!unsafe { array.value_unchecked(2) });
assert_eq!(array.values(), &Bitmap::from_u8_slice(&[0b00000001], 3));
assert_eq!(
array.validity(),
Expand Down Expand Up @@ -50,6 +53,21 @@ fn display() {
assert_eq!(format!("{:?}", array), "BooleanArray[true, None, false]");
}

#[test]
fn into_mut_valid() {
let bitmap = Bitmap::from([true, false, true]);
let a = BooleanArray::from_data(DataType::Boolean, bitmap, None);
let _ = a.into_mut().right().unwrap();
}

#[test]
fn into_mut_invalid() {
let bitmap = Bitmap::from([true, false, true]);
let _other = bitmap.clone(); // values are shared
let a = BooleanArray::from_data(DataType::Boolean, bitmap, None);
let _ = a.into_mut().left().unwrap();
}

#[test]
fn empty() {
let array = BooleanArray::new_empty(DataType::Boolean);
Expand Down

0 comments on commit 9a8edd0

Please sign in to comment.