Added dirty tracking on the cache

This commit is contained in:
obscuren
2014-02-16 20:32:56 +01:00
parent 7264044122
commit e4a6ee3d7f
2 changed files with 35 additions and 2 deletions

View File

@ -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()