diff --git a/benches/memtable.rs b/benches/memtable.rs index f089452b..beb60d57 100644 --- a/benches/memtable.rs +++ b/benches/memtable.rs @@ -7,7 +7,7 @@ fn memtable_get_hit(c: &mut Criterion) { memtable.insert(InternalValue::from_components( "abc_w5wa35aw35naw", - vec![], + vec![1, 2, 3], 0, lsm_tree::ValueType::Value, )); @@ -23,7 +23,10 @@ fn memtable_get_hit(c: &mut Criterion) { c.bench_function("memtable get", |b| { b.iter(|| { - memtable.get("abc_w5wa35aw35naw", None); + assert_eq!( + [1, 2, 3], + &*memtable.get("abc_w5wa35aw35naw", None).unwrap().value, + ) }); }); } @@ -39,7 +42,7 @@ fn memtable_get_snapshot(c: &mut Criterion) { )); memtable.insert(InternalValue::from_components( "abc_w5wa35aw35naw", - vec![], + vec![1, 2, 3], 1, lsm_tree::ValueType::Value, )); @@ -53,9 +56,12 @@ fn memtable_get_snapshot(c: &mut Criterion) { )); } - c.bench_function("memtable get", |b| { + c.bench_function("memtable get snapshot", |b| { b.iter(|| { - memtable.get("abc_w5wa35aw35naw", Some(1)); + assert_eq!( + [1, 2, 3], + &*memtable.get("abc_w5wa35aw35naw", Some(1)).unwrap().value, + ); }); }); } @@ -72,10 +78,8 @@ fn memtable_get_miss(c: &mut Criterion) { )); } - c.bench_function("memtable get", |b| { - b.iter(|| { - memtable.get("abc_564321", None); - }); + c.bench_function("memtable get miss", |b| { + b.iter(|| assert!(memtable.get("abc_564321", None).is_none())); }); }