Beispiel #1
0
        public void Complex()
        {
            var sut = new OptimalCache(3);
              var pages = new[] { 0, 1, 2, 3, 2, 3, 0, 4, 5, 2, 3, 1, 4, 3, 2, 6, 3, 2, 1, 2 };
              sut.Future = pages;

              foreach (var page in pages)
            sut.AddPage(page);

              var result = sut.Pages;
              CollectionAssert.AreEqual(new[] { 1, 3, 2 }, result);
              Assert.AreEqual(10, sut.PageFaults);
        }
Beispiel #2
0
        public void Complex()
        {
            var sut   = new OptimalCache(3);
            var pages = new[] { 0, 1, 2, 3, 2, 3, 0, 4, 5, 2, 3, 1, 4, 3, 2, 6, 3, 2, 1, 2 };

            sut.Future = pages;

            foreach (var page in pages)
            {
                sut.AddPage(page);
            }

            var result = sut.Pages;

            CollectionAssert.AreEqual(new[] { 1, 3, 2 }, result);
            Assert.AreEqual(10, sut.PageFaults);
        }