Exemple #1
0
 public void Reallocate_RedistributesBiggestBucket()
 {
     _systemUnderTest.Reallocate();
     Assert.AreEqual(2, _systemUnderTest.Buckets[0]);
     Assert.AreEqual(4, _systemUnderTest.Buckets[1]);
     Assert.AreEqual(1, _systemUnderTest.Buckets[2]);
     Assert.AreEqual(2, _systemUnderTest.Buckets[3]);
 }
Exemple #2
0
        public void Test1()
        {
            var result = memoryAllocation.Reallocate(new List <int> {
                11, 11, 13, 7, 0, 15, 5, 5, 4, 4, 1, 1, 7, 1, 15, 11
            });

            Assert.AreEqual(4074, result);
        }
Exemple #3
0
 public void Reallocate_TieForBiggest_FirstBucketUsed()
 {
     _systemUnderTest = new MemoryAllocation(new List <int> {
         3, 1, 2, 3
     });
     _systemUnderTest.Reallocate();
     Assert.AreEqual(0, _systemUnderTest.Buckets[0]);
     Assert.AreEqual(2, _systemUnderTest.Buckets[1]);
     Assert.AreEqual(3, _systemUnderTest.Buckets[2]);
     Assert.AreEqual(4, _systemUnderTest.Buckets[3]);
 }