Exemple #1
0
        public void RandomTest()
        {
            RingBuffer <int> TestObject = new RingBuffer <int>(10);

            Utilities.Random.Random Rand = new Utilities.Random.Random();
            int Value = 0;

            for (int x = 0; x < 10; ++x)
            {
                Value = Rand.Next();
                TestObject.Add(Value);
                Assert.Equal(1, TestObject.Count);
                Assert.Equal(Value, TestObject.Remove());
            }
            Assert.Equal(0, TestObject.Count);
            System.Collections.Generic.List <int> Values = new System.Collections.Generic.List <int>();
            for (int x = 0; x < 10; ++x)
            {
                Values.Add(Rand.Next());
            }
            TestObject.Add(Values);
            Assert.Equal(Values.ToArray(), TestObject.ToArray());

            for (int x = 0; x < 10; ++x)
            {
                Assert.Throws <IndexOutOfRangeException>(() => TestObject.Add(Rand.Next()));
                Assert.Equal(10, TestObject.Count);
            }
        }
        public void RandomTest()
        {
            var TestObject = new RingBuffer<int>(10);
            var Rand = new System.Random();
            int Value = 0;
            for (int x = 0; x < 10; ++x)
            {
                Value = Rand.Next();
                TestObject.Add(Value);
                Assert.Equal(1, TestObject.Count);
                Assert.Equal(Value, TestObject.Remove());
            }
            Assert.Equal(0, TestObject.Count);
            var Values = new System.Collections.Generic.List<int>();
            for (int x = 0; x < 10; ++x)
            {
                Values.Add(Rand.Next());
            }
            TestObject.Add(Values);
            Assert.Equal(Values.ToArray(), TestObject.ToArray());

            for (int x = 0; x < 10; ++x)
            {
                Assert.Throws<InvalidOperationException>(() => TestObject.Add(Rand.Next()));
                Assert.Equal(10, TestObject.Count);
            }
        }
        public void RandomTest()
        {
            RingBuffer<int> TestObject = new RingBuffer<int>(10);
            Utilities.Random.Random Rand = new Utilities.Random.Random();
            int Value = 0;
            for (int x = 0; x < 10; ++x)
            {
                Value = Rand.Next();
                TestObject.Add(Value);
                Assert.Equal(1, TestObject.Count);
                Assert.Equal(Value, TestObject.Remove());
            }
            Assert.Equal(0, TestObject.Count);
            System.Collections.Generic.List<int> Values=new System.Collections.Generic.List<int>();
            for (int x = 0; x < 10; ++x)
            {
                Values.Add(Rand.Next());
            }
            TestObject.Add(Values);
            Assert.Equal(Values.ToArray(), TestObject.ToArray());

            for (int x = 0; x < 10; ++x)
            {
                Assert.Throws<IndexOutOfRangeException>(() => TestObject.Add(Rand.Next()));
                Assert.Equal(10, TestObject.Count);
            }
        }
        public void RandomTest()
        {
            var TestObject = new RingBuffer <int>(10);
            var Rand       = new System.Random();
            int Value      = 0;

            for (int x = 0; x < 10; ++x)
            {
                Value = Rand.Next();
                TestObject.Add(Value);
                Assert.Equal(1, TestObject.Count);
                Assert.Equal(Value, TestObject.Remove());
            }
            Assert.Equal(0, TestObject.Count);
            var Values = new System.Collections.Generic.List <int>();

            for (int x = 0; x < 10; ++x)
            {
                Values.Add(Rand.Next());
            }
            TestObject.Add(Values);
            Assert.Equal(Values.ToArray(), TestObject.ToArray());

            for (int x = 0; x < 10; ++x)
            {
                Assert.Throws <InvalidOperationException>(() => TestObject.Add(Rand.Next()));
                Assert.Equal(10, TestObject.Count);
            }
        }