diff options
author | obscuren <geffobscura@gmail.com> | 2014-02-17 03:32:56 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-02-17 03:32:56 +0800 |
commit | e4a6ee3d7f8a3876387f837f6fec6822bd97951e (patch) | |
tree | 8e43b7fc4a7cc42978bfa972d9506179834570a8 /ethutil/trie_test.go | |
parent | 7264044122d2ceef413667ad8473746a40a44782 (diff) | |
download | dexon-e4a6ee3d7f8a3876387f837f6fec6822bd97951e.tar.gz dexon-e4a6ee3d7f8a3876387f837f6fec6822bd97951e.tar.zst dexon-e4a6ee3d7f8a3876387f837f6fec6822bd97951e.zip |
Added dirty tracking on the cache
Diffstat (limited to 'ethutil/trie_test.go')
-rw-r--r-- | ethutil/trie_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ethutil/trie_test.go b/ethutil/trie_test.go index 94414b82e..fa60c8cfc 100644 --- a/ethutil/trie_test.go +++ b/ethutil/trie_test.go @@ -45,6 +45,26 @@ func TestTrieSync(t *testing.T) { } } +func TestTrieDirtyTracking(t *testing.T) { + _, trie := New() + trie.Update("dog", LONG_WORD) + if !trie.cache.IsDirty { + t.Error("Expected trie to be dirty") + } + + trie.Sync() + if trie.cache.IsDirty { + t.Error("Expected trie not to be dirty") + } + + trie.Update("test", LONG_WORD) + trie.cache.Undo() + if trie.cache.IsDirty { + t.Error("Expected trie not to be dirty") + } + +} + func TestTrieReset(t *testing.T) { _, trie := New() |