From 7f07f7d567bc0bfde9fae460b1c9563ebfe928ff Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Sat, 10 Jun 2017 00:13:50 +0800 Subject: [PATCH 1/4] ArchiveDB: add a contains() test for long history test case --- util/src/journaldb/archivedb.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/util/src/journaldb/archivedb.rs b/util/src/journaldb/archivedb.rs index 1f9381c99..b86064d8f 100644 --- a/util/src/journaldb/archivedb.rs +++ b/util/src/journaldb/archivedb.rs @@ -239,6 +239,7 @@ mod tests { jdb.commit_batch(3, &b"3".sha3(), Some((0, b"0".sha3()))).unwrap(); assert!(jdb.contains(&h)); jdb.commit_batch(4, &b"4".sha3(), Some((1, b"1".sha3()))).unwrap(); + assert!(jdb.contains(&h)); } #[test] From a5531e83fd8a6ba1d2c52f71ae3d49474097ce63 Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Sat, 10 Jun 2017 00:23:25 +0800 Subject: [PATCH 2/4] ArchiveDB: add a new test case --- util/src/journaldb/archivedb.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/util/src/journaldb/archivedb.rs b/util/src/journaldb/archivedb.rs index b86064d8f..9099ff03b 100644 --- a/util/src/journaldb/archivedb.rs +++ b/util/src/journaldb/archivedb.rs @@ -242,6 +242,20 @@ mod tests { assert!(jdb.contains(&h)); } + #[test] + #[should_panic] + fn multiple_owed_removal_not_allowed() { + let mut jdb = ArchiveDB::new_temp(); + let h = jdb.insert(b"foo"); + jdb.commit_batch(0, &b"0".sha3(), None).unwrap(); + assert!(jdb.contains(&h)); + jdb.remove(&h); + jdb.remove(&h); + // commit_batch would call journal_under(), + // and we don't allow multiple owned removals. + jdb.commit_batch(1, &b"1".sha3(), None).unwrap(); + } + #[test] fn complex() { // history is 1 From 4eff7abf3b0e2a2eadacfe9cd991407c9d491dff Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Sun, 11 Jun 2017 22:41:16 +0800 Subject: [PATCH 3/4] StateDB: change spaces to tab --- ethcore/src/state_db.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index a5823f50b..de5a3f75b 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -477,7 +477,7 @@ mod tests { let mut batch = DBTransaction::new(); // blocks [ 3a(c) 2a(c) 2b 1b 1a(c) 0 ] - // balance [ 5 5 4 3 2 2 ] + // balance [ 5 5 4 3 2 2 ] let mut s = state_db.boxed_clone_canon(&root_parent); s.add_to_account_cache(address, Some(Account::new_basic(2.into(), 0.into())), false); s.journal_under(&mut batch, 0, &h0).unwrap(); From c1e5c36f7efd176a18bab5b0ecf1d36a4f7beee0 Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Sun, 11 Jun 2017 22:41:37 +0800 Subject: [PATCH 4/4] EthStore: add a Chinese path to tests in ethstore --- ethstore/src/dir/vault.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/ethstore/src/dir/vault.rs b/ethstore/src/dir/vault.rs index 31c99fcc4..a7b351643 100755 --- a/ethstore/src/dir/vault.rs +++ b/ethstore/src/dir/vault.rs @@ -296,6 +296,7 @@ mod test { assert!(check_vault_name("vault_with_underscores")); assert!(check_vault_name("vault-with-dashes")); assert!(check_vault_name("vault-with-digits-123")); + assert!(check_vault_name("vault中文名字")); } #[test]