public void StressDequeueTestCase()
        {
            /*ParallelTestHelper.Repeat (delegate {
             *      queue = new ConcurrentQueue<int> ();
             *      const int count = 10;
             *      const int threads = 5;
             *      const int delta = 5;
             *
             *      for (int i = 0; i < (count + delta) * threads; i++)
             *              queue.Enqueue (i);
             *
             *      bool state = true;
             *
             *      ParallelTestHelper.ParallelStressTest (queue, (q) => {
             *              int t;
             *              for (int i = 0; i < count; i++)
             *                      state &= queue.TryDequeue (out t);
             *      }, threads);
             *
             *      Assert.IsTrue (state, "#1");
             *      Assert.AreEqual (delta * threads, queue.Count, "#2");
             *
             *      string actual = string.Empty;
             *      int temp;
             *      while (queue.TryDequeue (out temp)) {
             *              actual += temp;
             *      }
             *      string expected = Enumerable.Range (count * threads, delta * threads)
             *              .Aggregate (string.Empty, (acc, v) => acc + v);
             *
             *      Assert.AreEqual (expected, actual, "#3");
             * });*/

            CollectionStressTestHelper.RemoveStressTest(new ConcurrentQueue <int> (), CheckOrderingType.InOrder);
        }
示例#2
0
        public void StressPopTestCase()
        {
            /*ParallelTestHelper.Repeat (delegate {
             *      stack = new ConcurrentStack<int> ();
             *      const int count = 10;
             *      const int threads = 5;
             *      const int delta = 5;
             *
             *      for (int i = 0; i < (count + delta) * threads; i++)
             *              stack.Push (i);
             *
             *      bool state = true;
             *
             *      ParallelTestHelper.ParallelStressTest (stack, (q) => {
             *              int t;
             *              for (int i = 0; i < count; i++)
             *                      state &= stack.TryPop (out t);
             *      }, threads);
             *
             *      Assert.IsTrue (state, "#1");
             *      Assert.AreEqual (delta * threads, stack.Count, "#2");
             *
             *      string actual = string.Empty;
             *      int temp;
             *      while (stack.TryPop (out temp)) {
             *              actual += temp;
             *      }
             *      string expected = Enumerable.Range (0, delta * threads).Reverse()
             *              .Aggregate (string.Empty, (acc, v) => acc + v);
             *
             *      Assert.AreEqual (expected, actual, "#3");
             * });*/

            CollectionStressTestHelper.RemoveStressTest(new ConcurrentStack <int> (), CheckOrderingType.Reversed);
        }
示例#3
0
 public void RemoveStressTest()
 {
     CollectionStressTestHelper.RemoveStressTest(bag, CheckOrderingType.DontCare);
 }