aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/trie_test.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-02-17 03:32:56 +0800
committerobscuren <geffobscura@gmail.com>2014-02-17 03:32:56 +0800
commite4a6ee3d7f8a3876387f837f6fec6822bd97951e (patch)
tree8e43b7fc4a7cc42978bfa972d9506179834570a8 /ethutil/trie_test.go
parent7264044122d2ceef413667ad8473746a40a44782 (diff)
downloaddexon-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.go20
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()