예제 #1
0
        public void TestPushFront1To4()
        {
            var d = new Deq <int>();

            d.PushFront(1);
            d.PushFront(2);
            d.PushFront(3);
            d.PushFront(4);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(4, d.Count);
        }
예제 #2
0
        public void TestPushFrontGetByPos()
        {
            var d = new Deq <int>();

            d.PushFront(1);
            d.PushFront(2);
            d.PushFront(3);
            d.PushFront(4);

            Assert.AreEqual(4, d.GetDeqElementByPosition(0));
            Assert.AreEqual(3, d.GetDeqElementByPosition(1));
            Assert.AreEqual(2, d.GetDeqElementByPosition(2));
            Assert.AreEqual(1, d.GetDeqElementByPosition(3));
        }
예제 #3
0
        public void TestOrderPushFrontPopFront()
        {
            var d = new Deq <int>();

            d.PushFront(1);
            d.PushFront(2);
            d.PushFront(3);
            d.PushFront(4);

            Assert.AreEqual(4, d.PopFront());
            Assert.AreEqual(3, d.PopFront());
            Assert.AreEqual(2, d.PopFront());
            Assert.AreEqual(1, d.PopFront());
        }
예제 #4
0
        public void TestPushFrontPopBackOne()
        {
            const int val = 100502;
            var       d   = new Deq <int>();

            d.PushFront(val);
            Assert.AreEqual(val, d.PopBack());
            Assert.IsTrue(d.Empty);
            Assert.AreEqual(0, d.Count);
        }
예제 #5
0
        public void TestPushFront()
        {
            const int val = 100501;
            var       d   = new Deq <int>();

            d.PushFront(val);
            Assert.IsFalse(d.Empty);
            Assert.AreEqual(1, d.Count);
            Assert.AreEqual(val, d.Back);
            Assert.AreEqual(val, d.Front);
        }
예제 #6
0
        public void TestSetDeqElementByPosition()
        {
            var d = new Deq <int>();

            d.PushFront(1);
            d.SetDeqElementByPosition(0, 2);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(1, d.Count);
            Assert.AreEqual(2, d.GetDeqElementByPosition(0));
            Assert.AreEqual(2, d.PopFront());
        }
예제 #7
0
 private void button2_Click(object sender, EventArgs e) //вставить в начало
 {
     try
     {
         string    con  = textBox5.Text;
         int       num  = Convert.ToInt32(textBox7.Text);
         Deq.Train item = new Deq.Train(num, con);
         d.PushFront(item);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Номер должен быть целым числом!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     d.Draw(this, pictureBox1, g, false);
 }
예제 #8
0
파일: DeqTest.cs 프로젝트: iarestov/DeqOpt
        public void TestSetDeqElementByPosition()
        {
            var d = new Deq<int>();

            d.PushFront(1);
            d.SetDeqElementByPosition(0, 2);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(1, d.Count);
            Assert.AreEqual(2, d.GetDeqElementByPosition(0));
            Assert.AreEqual(2, d.PopFront());
        }
예제 #9
0
파일: DeqTest.cs 프로젝트: iarestov/DeqOpt
        public void TestPushFrontPopBackOne()
        {
            const int val = 100502;
            var d = new Deq<int>();

            d.PushFront(val);
            Assert.AreEqual(val, d.PopBack());
            Assert.IsTrue(d.Empty);
            Assert.AreEqual(0, d.Count);
        }
예제 #10
0
파일: DeqTest.cs 프로젝트: iarestov/DeqOpt
        public void TestPushFrontGetByPos()
        {
            var d = new Deq<int>();

            d.PushFront(1);
            d.PushFront(2);
            d.PushFront(3);
            d.PushFront(4);

            Assert.AreEqual(4, d.GetDeqElementByPosition(0));
            Assert.AreEqual(3, d.GetDeqElementByPosition(1));
            Assert.AreEqual(2, d.GetDeqElementByPosition(2));
            Assert.AreEqual(1, d.GetDeqElementByPosition(3));
        }
예제 #11
0
파일: DeqTest.cs 프로젝트: iarestov/DeqOpt
        public void TestPushFront1To4()
        {
            var d = new Deq<int>();

            d.PushFront(1);
            d.PushFront(2);
            d.PushFront(3);
            d.PushFront(4);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(4, d.Count);
        }
예제 #12
0
파일: DeqTest.cs 프로젝트: iarestov/DeqOpt
        public void TestPushFront()
        {
            const int val = 100501;
            var d = new Deq<int>();

            d.PushFront(val);
            Assert.IsFalse(d.Empty);
            Assert.AreEqual(1, d.Count);
            Assert.AreEqual(val, d.Back);
            Assert.AreEqual(val, d.Front);
        }
예제 #13
0
파일: DeqTest.cs 프로젝트: iarestov/DeqOpt
        public void TestOrderPushFrontPopFront()
        {
            var d = new Deq<int>();

            d.PushFront(1);
            d.PushFront(2);
            d.PushFront(3);
            d.PushFront(4);

            Assert.AreEqual(4, d.PopFront());
            Assert.AreEqual(3, d.PopFront());
            Assert.AreEqual(2, d.PopFront());
            Assert.AreEqual(1, d.PopFront());
        }