Mercurial > lbo > hg > leveldb-rs
changeset 138:bd12a967e26e
Add test for table iterator backwards data correctness
phew
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Mon, 02 Jan 2017 12:04:37 +0100 |
parents | 47228aa19ed2 |
children | 794926329f9f |
files | src/table_reader.rs |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/table_reader.rs Mon Jan 02 11:52:26 2017 +0100 +++ b/src/table_reader.rs Mon Jan 02 12:04:37 2017 +0100 @@ -507,8 +507,11 @@ // backwards count let mut j = 0; - while let Some(_) = iter.prev() { + while let Some((k, v)) = iter.prev() { j += 1; + assert_eq!((data[data.len() - 1 - j].0.as_bytes(), + data[data.len() - 1 - j].1.as_bytes()), + (k.as_ref(), v.as_ref())); } // expecting 7 - 1, because the last entry that the iterator stopped on is the last entry