public void NWayCache_BitsTag(int size_cache_bytes, int bytes_block, int ways, int expected) { var cache = new NWayCache <int>(size_cache_bytes, bytes_block, ways, ReplacementAlgorithm.FIFO, WriteAlgorithms.CopyBack); var result = cache.bitsTag; Assert.Equal(expected, result); }
public void Constructor_NWayCache_NumberSets(int size_cache_bytes, int bytes_block, int ways, int expected) { var cache = new NWayCache <int>(size_cache_bytes, bytes_block, ways, ReplacementAlgorithm.FIFO, WriteAlgorithms.CopyBack); var result = cache.nSets; Assert.Equal(result, expected); }
public void NwayCacheTest1() { NWayCache <int, string> cache = new NWayCache <int, string>(new LruCacheAlgorithm <int>(), 8, 2); cache.Put(16, "first"); cache.Put(32, "second"); cache.Put(48, "third"); Assert.AreEqual(cache.Get(16), null); Assert.AreEqual(cache.Get(32), "second"); Assert.AreEqual(cache.Get(48), "third"); }
public void NwayCacheTest3() { NWayCache <int, string> cache = new NWayCache <int, string>(new LruCacheAlgorithm <int>(), 8, 2); cache.Put(15, "first"); cache.Put(31, "second"); cache.Put(47, "third"); Assert.AreEqual(cache.Get(15), null); Assert.AreEqual(cache.Get(31), "second"); Assert.AreEqual(cache.Get(47), "third"); }
public void NwayCacheTest2() { NWayCache <int, string> cache = new NWayCache <int, string>(new LruCacheAlgorithm <int>(), 8, 2); cache.Put(7, "first"); cache.Put(23, "second"); cache.Put(39, "third"); Assert.AreEqual(cache.Get(7), null); Assert.AreEqual(cache.Get(23), "second"); Assert.AreEqual(cache.Get(39), "third"); }