public void Cache_post_init_memory_calculated_correctly() { MemCountingCache cache = new MemCountingCache(1024, string.Empty); cache.Set(Keccak.Zero, new byte[0]); cache.MemorySize.Should().Be(400); }
public MemCountingCache Pre_init_trie_cache_160() { MemCountingCache memCountingCache = new MemCountingCache(1024 * 1024, string.Empty); return(memCountingCache); }
public MemCountingCache Post_init_trie_cache_with_item_400() { MemCountingCache cache = new MemCountingCache(1024 * 1024, string.Empty); cache.Set(Keccak.Zero, new byte[0]); return(cache); }
public MemCountingCache With_2_items_cache_504() { MemCountingCache cache = new MemCountingCache(1024 * 1024, string.Empty); cache.Set(TestItem.KeccakA, new byte[0]); cache.Set(TestItem.KeccakB, new byte[0]); return(cache); }
public void Cache_post_capacity_growth_memory_calculated_correctly() { MemCountingCache cache = new MemCountingCache(1024, string.Empty); cache.Set(TestItem.KeccakA, new byte[0]); cache.Set(TestItem.KeccakB, new byte[0]); cache.Set(TestItem.KeccakC, new byte[0]); cache.Set(TestItem.KeccakD, new byte[0]); cache.MemorySize.Should().Be(824); }
public MemCountingCache Post_dictionary_growth_cache_824_and_136_lost() { MemCountingCache cache = new MemCountingCache(1024 * 1024, string.Empty); cache.Set(TestItem.KeccakA, new byte[0]); cache.Set(TestItem.KeccakB, new byte[0]); cache.Set(TestItem.KeccakC, new byte[0]); cache.Set(TestItem.KeccakD, new byte[0]); return(cache); }
public void Limit_by_memory_works_fine_wth_deletes() { MemCountingCache cache = new MemCountingCache(800, string.Empty); cache.Set(TestItem.KeccakA, new byte[0]); cache.Set(TestItem.KeccakB, new byte[0]); cache.Set(TestItem.KeccakC, new byte[0]); cache.Set(TestItem.KeccakA, null); cache.MemorySize.Should().Be(504); cache.Get(TestItem.KeccakA).Should().BeNull(); cache.Set(TestItem.KeccakD, new byte[0]); cache.MemorySize.Should().Be(608); cache.Get(TestItem.KeccakB).Should().NotBeNull(); cache.Get(TestItem.KeccakD).Should().NotBeNull(); }
public void Cache_initial_memory_calculated_correctly() { MemCountingCache cache = new MemCountingCache(1024, string.Empty); cache.MemorySize.Should().Be(160); }