move MemoryDB's tests into tests module
This commit is contained in:
parent
4efd673c19
commit
ce8f8f40d7
@ -250,8 +250,12 @@ impl HashDB for MemoryDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[cfg(test)]
|
||||||
fn memorydb_remove_and_purge() {
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn memorydb_remove_and_purge() {
|
||||||
let hello_bytes = b"Hello world!";
|
let hello_bytes = b"Hello world!";
|
||||||
let hello_key = hello_bytes.sha3();
|
let hello_key = hello_bytes.sha3();
|
||||||
|
|
||||||
@ -274,10 +278,10 @@ fn memorydb_remove_and_purge() {
|
|||||||
assert_eq!(&*m.remove_and_purge(&hello_key).unwrap(), hello_bytes);
|
assert_eq!(&*m.remove_and_purge(&hello_key).unwrap(), hello_bytes);
|
||||||
assert_eq!(m.raw(&hello_key), None);
|
assert_eq!(m.raw(&hello_key), None);
|
||||||
assert!(m.remove_and_purge(&hello_key).is_none());
|
assert!(m.remove_and_purge(&hello_key).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn consolidate() {
|
fn consolidate() {
|
||||||
let mut main = MemoryDB::new();
|
let mut main = MemoryDB::new();
|
||||||
let mut other = MemoryDB::new();
|
let mut other = MemoryDB::new();
|
||||||
let remove_key = other.insert(b"doggo");
|
let remove_key = other.insert(b"doggo");
|
||||||
@ -292,4 +296,5 @@ fn consolidate() {
|
|||||||
|
|
||||||
assert_eq!(overlay.get(&remove_key).unwrap(), &(DBValue::from_slice(b"doggo"), 0));
|
assert_eq!(overlay.get(&remove_key).unwrap(), &(DBValue::from_slice(b"doggo"), 0));
|
||||||
assert_eq!(overlay.get(&insert_key).unwrap(), &(DBValue::from_slice(b"arf"), 2));
|
assert_eq!(overlay.get(&insert_key).unwrap(), &(DBValue::from_slice(b"arf"), 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user