diff --git a/src/cursor.rs b/src/cursor.rs index 61058bd..11c189a 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -424,7 +424,8 @@ mod test { let items: Vec<(&[u8], &[u8])> = vec!((b"key1", b"val1"), (b"key2", b"val2"), - (b"key3", b"val3")); + (b"key3", b"val3"), + (b"key5", b"val5")); { let mut txn = env.begin_rw_txn().unwrap(); @@ -447,7 +448,10 @@ mod test { assert_eq!(items.clone().into_iter().skip(1).collect::>(), cursor.iter_from(b"key2").unwrap().collect::>()); - assert!(cursor.iter_from(b"foo").is_err()); + assert_eq!(items.clone().into_iter().skip(3).collect::>(), + cursor.iter_from(b"key4").unwrap().collect::>()); + + assert!(cursor.iter_from(b"key6").is_err()); } #[test] @@ -464,7 +468,10 @@ mod test { (b"b", b"3"), (b"c", b"1"), (b"c", b"2"), - (b"c", b"3")); + (b"c", b"3"), + (b"e", b"1"), + (b"e", b"2"), + (b"e", b"3")); { let mut txn = env.begin_rw_txn().unwrap(); @@ -491,6 +498,9 @@ mod test { assert_eq!(items.clone().into_iter().skip(3).collect::>(), cursor.iter_dup_from(b"ab").unwrap().flat_map(|x| x).collect::>()); + assert_eq!(items.clone().into_iter().skip(9).collect::>(), + cursor.iter_dup_from(b"d").unwrap().flat_map(|x| x).collect::>()); + assert_eq!(items.clone().into_iter().skip(3).take(3).collect::>(), cursor.iter_dup_of(b"b").unwrap().collect::>());