KM3JAFGPFV7MP7M2LJIYRVAUTU646B3IRXADTRZKOU2RF7LUB62QC
OFINGD26ZWCRDVVDI2ZIBLMHXKEMJA6MRNLANJYUHQPIJLPA7J2AC
OP6SVMOD2GTQ7VNJ4E5KYFG4MIYA7HBMXJTADALMZH4PY7OQRMZQC
PXF3R6SVXJXN2NMLMWNY5OFV5QYVE2VZTLGIZDZVK5ZVLFTVSSWQC
EYNN7RLSFVBWDLRTLNNFUAF46Q6OX3BR5SUEJIOOHBSNP7FVBXGAC
UAQX27N4PI4LHEW6LSHJETIE5MV7JTEMPLTJFYUBMYVPC43H7VOAC
KX3WVNZW5KHVEH6EOQTZ4RBEFFJ3SGF5I467X3JWZ74PURRK4HVAC
}
}
#[test]
fn iterators() {
env_logger::try_init().unwrap_or(());
let env = Env::new_anon(40960, 1).unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut db = create_db_::<MutTxn<&Env, ()>, u64, A, P<u64, A>>(&mut txn).unwrap();
for i in 0..100 {
let a = A([i; 100]);
put(&mut txn, &mut db, &i, &a).unwrap();
}
let mut cursor = btree::cursor::Cursor::new(&txn, &db).unwrap();
for i in 0..50 {
let (k, v) = cursor.next(&txn).unwrap().unwrap();
assert_eq!(*k, i);
assert_eq!(v.0[0], i);
debug!("{:?}", i);
crate::debug::debug(&txn, &[&db], "debug", true);
debug!("=======");
for i in (25..50).rev() {
let (k, v) = cursor.prev(&txn).unwrap().unwrap();
debug!("{:?} {:?}", i, k);
assert_eq!(*k, i);
assert_eq!(v.0[0], i);
}
debug!("=======");
for i in 24..75 {
let (k, v) = cursor.next(&txn).unwrap().unwrap();
assert_eq!(*k, i);
assert_eq!(v.0[0], i);
debug!("{:?}", i);
}