Skip to content

Commit

Permalink
increase test
Browse files Browse the repository at this point in the history
  • Loading branch information
hermeGarcia committed Nov 28, 2023
1 parent d40ddc6 commit 304ddf5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nucliadb_vectors/src/data_types/key_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,15 @@ mod tests {
(greater_than_2, v2_store.as_slice()),
];
merge::<(GreaterThan, TElem), std::fs::File>(&mut file, elems.as_slice()).unwrap();
let expected: Vec<u32> = vec![3, 4, 5, 6, 7, 8];
let merge_store = unsafe { memmap2::Mmap::map(&file).unwrap() };
let number_of_elements = elements_in_total(&merge_store);
let values: Vec<u32> = (0..number_of_elements)
.map(|i| get_value(TElem, &merge_store, i))
.map(|s| u32::from_be_bytes(s.try_into().unwrap()))
.collect();
assert_eq!(number_of_elements, 6);
assert_eq!(values, expected);

let elems = vec![
// cero and one will be removed
Expand All @@ -481,8 +487,14 @@ mod tests {
(greater_than_10, v2_store.as_slice()),
];
merge::<(GreaterThan, TElem), std::fs::File>(&mut file, elems.as_slice()).unwrap();
let expected: Vec<u32> = vec![3, 4, 5];
let merge_store = unsafe { memmap2::Mmap::map(&file).unwrap() };
let number_of_elements = elements_in_total(&merge_store);
let values: Vec<u32> = (0..number_of_elements)
.map(|i| get_value(TElem, &merge_store, i))
.map(|s| u32::from_be_bytes(s.try_into().unwrap()))
.collect();
assert_eq!(number_of_elements, 3);
assert_eq!(values, expected);
}
}

0 comments on commit 304ddf5

Please sign in to comment.