diff --git a/trie-db/test/src/triedb.rs b/trie-db/test/src/triedb.rs index 92fbe820..04e0f710 100644 --- a/trie-db/test/src/triedb.rs +++ b/trie-db/test/src/triedb.rs @@ -107,8 +107,8 @@ fn iterator_internal() { test_layouts!(iterator_seek, iterator_seek_internal); fn iterator_seek_internal() { - let d = vec![b"A".to_vec(), b"AA".to_vec(), b"AB".to_vec(), b"B".to_vec()]; - let vals = vec![vec![0; 32], vec![1; 32], vec![2; 32], vec![3; 32]]; + let d = vec![b"A".to_vec(), b"AA".to_vec(), b"AB".to_vec(), b"AS".to_vec(), b"B".to_vec()]; + let vals = vec![vec![0; 32], vec![1; 32], vec![2; 32], vec![4; 32], vec![3; 32]]; let mut memdb = PrefixedMemoryDB::::default(); let mut root = Default::default(); @@ -133,11 +133,15 @@ fn iterator_seek_internal() { let iter = trie_db::TrieDBIterator::new_prefixed(&t, b"aaaaa").unwrap(); assert_eq!(&vals[..0], &iter.map(|x| x.unwrap().1).collect::>()[..]); let iter = trie_db::TrieDBIterator::new_prefixed(&t, b"A").unwrap(); - assert_eq!(&vals[..3], &iter.map(|x| x.unwrap().1).collect::>()[..]); + assert_eq!(&vals[..4], &iter.map(|x| x.unwrap().1).collect::>()[..]); let iter = trie_db::TrieDBIterator::new_prefixed_then_seek(&t, b"A", b"AA").unwrap(); - assert_eq!(&vals[1..3], &iter.map(|x| x.unwrap().1).collect::>()[..]); + assert_eq!(&vals[1..4], &iter.map(|x| x.unwrap().1).collect::>()[..]); + let iter = trie_db::TrieDBIterator::new_prefixed_then_seek(&t, b"A", b"AR").unwrap(); + assert_eq!(&vals[3..4], &iter.map(|x| x.unwrap().1).collect::>()[..]); + let iter = trie_db::TrieDBIterator::new_prefixed_then_seek(&t, b"A", b"AS").unwrap(); + assert_eq!(&vals[3..4], &iter.map(|x| x.unwrap().1).collect::>()[..]); let iter = trie_db::TrieDBIterator::new_prefixed_then_seek(&t, b"A", b"AB").unwrap(); - assert_eq!(&vals[2..3], &iter.map(|x| x.unwrap().1).collect::>()[..]); + assert_eq!(&vals[2..4], &iter.map(|x| x.unwrap().1).collect::>()[..]); let iter = trie_db::TrieDBIterator::new_prefixed_then_seek(&t, b"", b"AB").unwrap(); assert_eq!(&vals[2..], &iter.map(|x| x.unwrap().1).collect::>()[..]); let mut iter = t.iter().unwrap(); @@ -151,10 +155,10 @@ fn iterator_seek_internal() { assert_eq!(&vals[3..], &iter.map(|x| x.unwrap().1).collect::>()[..]); let mut iter = t.iter().unwrap(); iter.seek(b"B").unwrap(); - assert_eq!(&vals[3..], &iter.map(|x| x.unwrap().1).collect::>()[..]); + assert_eq!(&vals[4..], &iter.map(|x| x.unwrap().1).collect::>()[..]); let mut iter = t.iter().unwrap(); iter.seek(b"C").unwrap(); - assert_eq!(&vals[4..], &iter.map(|x| x.unwrap().1).collect::>()[..]); + assert_eq!(&vals[5..], &iter.map(|x| x.unwrap().1).collect::>()[..]); } test_layouts!(get_length_with_extension, get_length_with_extension_internal);