Skip to content

Commit b49a731

Browse files
committed
tests
1 parent 412e0c5 commit b49a731

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/range.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ pub fn seqno_filter(item_seqno: SeqNo, seqno: SeqNo) -> bool {
2323
item_seqno < seqno
2424
}
2525

26+
/// Calculates the prefix's upper range.
27+
///
28+
/// # Panics
29+
///
30+
/// Panics if the prefix is empty.
2631
pub(crate) fn prefix_upper_range(prefix: &[u8]) -> Bound<UserKey> {
2732
use std::ops::Bound::{Excluded, Unbounded};
2833

29-
if prefix.is_empty() {
30-
return Unbounded;
31-
}
34+
assert!(!prefix.is_empty(), "prefix may not be empty");
3235

3336
let mut end = prefix.to_vec();
3437
let len = end.len();

src/util.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ pub fn prefixed_range<P: AsRef<[u8]>, K: AsRef<[u8]>, R: RangeBounds<K>>(
2323

2424
let prefix = prefix.as_ref();
2525

26-
assert!(!prefix.is_empty(), "prefix may not be empty");
26+
if prefix.is_empty() {
27+
return (Unbounded, Unbounded);
28+
}
2729

2830
match (range.start_bound(), range.end_bound()) {
2931
(Unbounded, Unbounded) => prefix_to_range(prefix),

tests/blob_major_compact_gc_stats.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fn blob_tree_major_compact_gc_stats() -> lsm_tree::Result<()> {
5656
},
5757
&*gc_stats,
5858
);
59+
assert_eq!(big_value.len() as u64, tree.stale_blob_bytes());
5960
}
6061

6162
Ok(())

0 commit comments

Comments
 (0)