Example #1
0
        public void DeepCopyAndFindIn100()
        {
            tml.setTestCaseName("DeepCopyAndFindIn100");


            ImmutableSortedDictionary <Payload, Payload> tree     = null;
            ImmutableSortedDictionary <Payload, Payload> treeCopy = null;

            tml.setInitialTimeAndMemory();
            tree     = this.creatASListWithNelement(100);
            treeCopy = tree;
            Payload payloadtoFind = new Payload("Load 25");
            bool    ans           = treeCopy.ContainsValue(payloadtoFind);


            tml.logTimeAndMemoryUsage(25);
            tree     = null;
            treeCopy = null;
            this.callTheGC();
            ///////////
            tml.setInitialTimeAndMemory();
            tree = this.creatASListWithNelement(100);


            treeCopy      = tree;
            payloadtoFind = new Payload("Load 50");
            ans           = treeCopy.ContainsValue(payloadtoFind);
            tml.logTimeAndMemoryUsage(50);
            tree     = null;
            treeCopy = null;
            this.callTheGC();
            ///////////////
            tml.setInitialTimeAndMemory();
            tree = this.creatASListWithNelement(100);


            treeCopy      = tree;
            payloadtoFind = new Payload("Load 75");
            ans           = treeCopy.ContainsValue(payloadtoFind);
            tml.logTimeAndMemoryUsage(75);
            tree     = null;
            treeCopy = null;
            this.callTheGC();
            //////////////
            tml.setInitialTimeAndMemory();
            tree = this.creatASListWithNelement(100);

            treeCopy      = tree;
            payloadtoFind = new Payload("Load 99");
            ans           = treeCopy.ContainsValue(payloadtoFind);

            tml.logTimeAndMemoryUsage(100);
        }
Example #2
0
 protected void ContainsValueTestHelper <TKey, TValue>(ImmutableSortedDictionary <TKey, TValue> map, TKey key, TValue value)
 {
     Assert.False(map.ContainsValue(value));
     Assert.True(map.Add(key, value).ContainsValue(value));
 }