You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mvcc_test.rs
    path of file: ./repos/rdms/src/_archive
    
    the code of the file until where you have to start completion: use rand::{prelude::random, rngs::StdRng, Rng, SeedableRng};

use std::ops::Bound;

use super::*;
use crate::{
    core::{CommitIterator, Index, Reader, Validate, Writer},
    error::Error,
    mvcc::Mvcc,
    scans,
    types::Empty,
    util,
};

include!("./ref_test.rs");

// TODO: repeatable randoms.

#[test]
fn test_name() {
    let mut mvcc: Box<Mvcc<i32, Empty>> = Mvcc::new("test-mvcc");
    assert_eq!(mvcc.to_name().unwrap(), "test-mvcc".to_string());
    assert!(mvcc.validate().is_ok());
}

#[test]
fn test_len() {
    let mut mvcc: Box<Mvcc<i32, Empty>> = Mvcc::new("test-mvcc");
    assert_eq!(mvcc.len(), 0);
    assert!(mvcc.validate().is_ok());
}

#[test]
fn test_lsm_sticky() {
    let missing_key = 0x123456789;
    let populate = |index: &mut Mvcc<i64, i64>| -> i64 {
        for _ in 0..500 {
            let key: i64 = random::<i64>().abs();
            let value: i64 = random();
            index.set(key, value).unwrap();
        }
        let iter = index.iter().unwrap();
        let e = iter.skip(random::<u8>() as usize).next().unwrap();
        let key = e.unwrap().to_key();
        index.set(key.clone(), 9).unwrap();
        index.delete(&key).unwrap();
        index.set(key.clone(), 10).unwrap();
        index.delete(&key).unwrap();
        index.delete(&missing_key).ok();
        key
    };

    // without lsm
    let mut index: Box<Mvcc<i64, i64>> = Mvcc::new("test-mvcc");
    let key = populate(&mut index);
    match index.get(&key) {
        Err(Error::NotFound) => (),
        Err(err) => panic!("unexpected {:?}", err),
        Ok(e) => panic!("unexpected {}", e.to_seqno()),
    };
    match index.get(&missing_key) {
        Err(Error::NotFound) => (),
        Err(err) => panic!("unexpected {:?}", err),
        O
    
fn test_commit_iterator_scans2() {
    let seed: u128 = random();
    // let seed: u128 = 81230627573609454272905178397264218863;
    println!("seed: {}", seed);
    let mut rng = StdRng::from_seed(seed.to_le_bytes());

    let (n_ops, key_max) = (60_000_i64, 20_000);
    let mut mvcc: Box<Mvcc<i64, i64>> = Mvcc::new_lsm("test-mvcc");
    random_mvcc(n_ops, key_max, seed, &mut mvcc);

    for i in 0..20 {
        let shards = rng.gen::<usize>() % 31 + 1;
        let from_seqno = match rng.gen::<i64>() % n_ops {
            n if n >= 0 && n % 2 == 0 => Bound::Included(n as u64),
            n if n >= 0 => Bound::Excluded(n as u64),
            _ => Bound::Unbounded,
        };
        let mut r = mvcc.to_reader().unwrap();
        let within = (from_seqno, Bound::Included(mvcc.to_seqno().unwrap()));
        let mut iter = {
            let mut iters = mvcc.scans(shards, within.clone()).unwrap();
            iters.reverse(); // make this to stack
            let w = (Bound::<u64>::Unbounded, Bound::<u64>::Unbounded);
            scans::FilterScans::new(iters, w)
        };
        let mut ref_iter = r.iter().unwrap();
        let mut count = 0;
        loop {
            match ref_iter.next() {
                Some(Ok(ref_entry)) => {
                    match ref_entry.filter_within(within.0, within.1) {
                        Some(ref_entry) => match iter.next() {
                            Some(Ok(entry)) => {
                                check_node1(&entry, &ref_entry);
                                count += 1;
                            }
                            Some(Err(err)) => panic!("{:?}", err),
                            None => unreachable!(),
                        },
                        None => continue,
                    }
                }
                Some(Err(err)) => panic!("{:?}", err),
                None => {
                    assert!(iter.next().is_none());
                    break;
                }
            }
        }
        println!(
            "i:{} shards:{} within:{:?} count:{}",
            i, shards, within, count
        );
    }
}