Skip to content

Commit

Permalink
Create tree_l0_point_read
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 authored Nov 30, 2024
1 parent c494b13 commit dcc41e2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/tree_l0_point_read
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
use lsm_tree::AbstractTree;
use test_log::test;

#[test]
fn tree_l0_point_read() -> lsm_tree::Result<()> {
let folder = tempfile::tempdir()?;
let path = folder.path();

let tree = lsm_tree::Config::new(path).open_as_blob_tree()?;

tree.insert("a", "a", 0);
tree.insert("b", "b", 0);
tree.insert("c", "c", 0);
tree.flush_active_memtable(0)?;

tree.insert("a", "a", 1);
tree.insert("b", "b", 1);
tree.insert("c", "c", 1);
tree.flush_active_memtable(0)?;

tree.insert("a", "A", 2);
tree.insert("b", "B", 2);
tree.insert("c", "C", 2);
tree.flush_active_memtable(0)?;

tree.insert("d", "d", 3);
tree.insert("e", "e", 3);
tree.insert("f", "f", 3);
tree.flush_active_memtable(0)?;

tree.insert("g", "g", 3);
tree.flush_active_memtable(0)?;

assert_eq!(b"A", &*tree.get("a")?.unwrap());
assert_eq!(b"B", &*tree.get("b")?.unwrap());
assert_eq!(b"C", &*tree.get("c")?.unwrap());
assert_eq!(b"d", &*tree.get("d")?.unwrap());
assert_eq!(b"e", &*tree.get("e")?.unwrap());
assert_eq!(b"f", &*tree.get("f")?.unwrap());
assert_eq!(b"g", &*tree.get("g")?.unwrap());

Ok(())
}

0 comments on commit dcc41e2

Please sign in to comment.