Beispiel #1
0
        public void AscendingDictionaryWithLimit_greaterThan(ConcurrentLinkedDictionary <int, int> map)
        {
            IDictionary <int, int> expected = newLinkedHashMap <int, int>();

            WarmUp(expected, 1, Capacity() / 2);

            Assert.That(map.AscendingDictionaryWithLimit((int)Capacity() / 2), Is.EqualTo(expected));
        }
Beispiel #2
0
 public void drain_blocksAscendingMap(ConcurrentLinkedDictionary <int, int> map)
 {
     checkDrainBlocks(map, () => {
         map.AscendingDictionary();
     });
     checkDrainBlocks(map, () => {
         map.AscendingDictionaryWithLimit((int)Capacity());
     });
 }
Beispiel #3
0
        public void AscendingDictionaryWithLimit_lessThan(ConcurrentLinkedDictionary <int, int> map)
        {
            IDictionary <int, int> expected = newLinkedHashMap <int, int>();

            WarmUp(expected, 1, Capacity());

            var dict = map.AscendingDictionaryWithLimit((int)Capacity() * 2);

            Assert.That(dict, Is.InstanceOf <SortedDictionary <int, int> >());
            Assert.That(dict.ToArray(), Is.EqualTo(expected.ToArray()));
        }
Beispiel #4
0
        public void AscendingDictionaryWithLimit_snapshot(ConcurrentLinkedDictionary <int, int> map)
        {
            IDictionary <int, int> expected = newLinkedHashMap <int, int>();

            WarmUp(expected, 1, Capacity() / 2);

            IDictionary <int, int> original = map.AscendingDictionaryWithLimit((int)Capacity() / 2);

            map.put((int)Capacity(), (int)-Capacity());

            Assert.That(original, Is.InstanceOf <SortedDictionary <int, int> >());
            Assert.That(original.ToArray(), Is.EqualTo(expected.ToArray()));
        }
Beispiel #5
0
 public void AscendingDictionaryWithLimit_negative(ConcurrentLinkedDictionary <int, int> map)
 {
     map.AscendingDictionaryWithLimit(-1);
 }
Beispiel #6
0
 public void AscendingDictionaryWithLimit_zero(ConcurrentLinkedDictionary <int, int> map)
 {
     Assert.That(map.AscendingDictionaryWithLimit(0), emptyMap <int, int>());
 }