Fix tests.
This commit is contained in:
parent
12e1abdfb7
commit
e6a273f3a7
@ -524,7 +524,7 @@ mod tests {
|
||||
#[test]
|
||||
fn insert_same_in_fork() {
|
||||
// history is 1
|
||||
let mut jdb = JournalDB::new_temp();
|
||||
let mut jdb = OptionOneDB::new_temp();
|
||||
|
||||
let x = jdb.insert(b"X");
|
||||
jdb.commit(1, &b"1".sha3(), None).unwrap();
|
||||
@ -554,7 +554,7 @@ mod tests {
|
||||
#[test]
|
||||
fn long_history() {
|
||||
// history is 3
|
||||
let mut jdb = JournalDB::new_temp();
|
||||
let mut jdb = OptionOneDB::new_temp();
|
||||
let h = jdb.insert(b"foo");
|
||||
jdb.commit(0, &b"0".sha3(), None).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
@ -577,7 +577,7 @@ mod tests {
|
||||
#[test]
|
||||
fn complex() {
|
||||
// history is 1
|
||||
let mut jdb = JournalDB::new_temp();
|
||||
let mut jdb = OptionOneDB::new_temp();
|
||||
|
||||
let foo = jdb.insert(b"foo");
|
||||
let bar = jdb.insert(b"bar");
|
||||
@ -620,7 +620,7 @@ mod tests {
|
||||
#[test]
|
||||
fn fork() {
|
||||
// history is 1
|
||||
let mut jdb = JournalDB::new_temp();
|
||||
let mut jdb = OptionOneDB::new_temp();
|
||||
|
||||
let foo = jdb.insert(b"foo");
|
||||
let bar = jdb.insert(b"bar");
|
||||
@ -652,7 +652,7 @@ mod tests {
|
||||
#[test]
|
||||
fn overwrite() {
|
||||
// history is 1
|
||||
let mut jdb = JournalDB::new_temp();
|
||||
let mut jdb = OptionOneDB::new_temp();
|
||||
|
||||
let foo = jdb.insert(b"foo");
|
||||
jdb.commit(0, &b"0".sha3(), None).unwrap();
|
||||
@ -677,7 +677,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
jdb.commit(0, &b"0".sha3(), None).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
|
||||
@ -705,7 +705,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
jdb.commit(0, &b"0".sha3(), None).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
|
||||
@ -733,7 +733,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
jdb.commit(0, &b"0".sha3(), None).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
|
||||
@ -771,7 +771,7 @@ mod tests {
|
||||
let bar = H256::random();
|
||||
|
||||
let foo = {
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
// history is 1
|
||||
let foo = jdb.insert(b"foo");
|
||||
jdb.emplace(bar.clone(), b"bar".to_vec());
|
||||
@ -781,14 +781,14 @@ mod tests {
|
||||
};
|
||||
|
||||
{
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
jdb.remove(&foo);
|
||||
jdb.commit(1, &b"1".sha3(), Some((0, b"0".sha3()))).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
}
|
||||
|
||||
{
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
assert!(jdb.exists(&foo));
|
||||
assert!(jdb.exists(&bar));
|
||||
jdb.commit(2, &b"2".sha3(), Some((1, b"1".sha3()))).unwrap();
|
||||
@ -803,7 +803,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
|
||||
// history is 4
|
||||
let foo = jdb.insert(b"foo");
|
||||
@ -832,7 +832,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
|
||||
// history is 4
|
||||
let foo = jdb.insert(b"foo");
|
||||
@ -881,7 +881,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
// history is 1
|
||||
let foo = jdb.insert(b"foo");
|
||||
jdb.commit(1, &b"1".sha3(), Some((0, b"0".sha3()))).unwrap();
|
||||
@ -912,7 +912,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
// history is 4
|
||||
let foo = jdb.insert(b"foo");
|
||||
jdb.commit(0, &b"0".sha3(), None).unwrap();
|
||||
@ -952,7 +952,7 @@ mod tests {
|
||||
let foo = b"foo".sha3();
|
||||
|
||||
{
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
// history is 1
|
||||
jdb.insert(b"foo");
|
||||
jdb.commit(0, &b"0".sha3(), None).unwrap();
|
||||
@ -973,7 +973,7 @@ mod tests {
|
||||
assert!(jdb.exists(&foo));
|
||||
|
||||
// incantation to reopen the db
|
||||
}; { let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
}; { let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
|
||||
jdb.remove(&foo);
|
||||
jdb.commit(4, &b"4".sha3(), Some((2, b"2".sha3()))).unwrap();
|
||||
@ -981,14 +981,14 @@ mod tests {
|
||||
assert!(jdb.exists(&foo));
|
||||
|
||||
// incantation to reopen the db
|
||||
}; { let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
}; { let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
|
||||
jdb.commit(5, &b"5".sha3(), Some((3, b"3".sha3()))).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
assert!(jdb.exists(&foo));
|
||||
|
||||
// incantation to reopen the db
|
||||
}; { let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
}; { let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
|
||||
jdb.commit(6, &b"6".sha3(), Some((4, b"4".sha3()))).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
@ -1001,7 +1001,7 @@ mod tests {
|
||||
let mut dir = ::std::env::temp_dir();
|
||||
dir.push(H32::random().hex());
|
||||
let (foo, bar, baz) = {
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
// history is 1
|
||||
let foo = jdb.insert(b"foo");
|
||||
let bar = jdb.insert(b"bar");
|
||||
@ -1019,7 +1019,7 @@ mod tests {
|
||||
};
|
||||
|
||||
{
|
||||
let mut jdb = JournalDB::new(dir.to_str().unwrap());
|
||||
let mut jdb = OptionOneDB::new(dir.to_str().unwrap());
|
||||
jdb.commit(2, &b"2b".sha3(), Some((1, b"1b".sha3()))).unwrap();
|
||||
assert!(jdb.can_reconstruct_refs());
|
||||
assert!(jdb.exists(&foo));
|
||||
|
Loading…
Reference in New Issue
Block a user