Exemplo n.º 1
0
        public void TestSetDeqElementByPositionOoRNegative()
        {
            var d = new Deq <int>();

            d.SetDeqElementByPosition(0, 1);
            d.SetDeqElementByPosition(-1, -1);
        }
Exemplo n.º 2
0
        public void TestSetDeqElementByPositionOoRPositive()
        {
            var d = new Deq <int>();

            d.SetDeqElementByPosition(0, 1);
            d.SetDeqElementByPosition(2, 2);
        }
Exemplo n.º 3
0
 public void TestEmpty()
 {
     var d = new Deq<int>();
     Sorter.Sort2(d);
     Assert.IsTrue(d.Empty);
     Assert.AreEqual(0, d.Count);
 }
Exemplo n.º 4
0
        public void TestGetDeqElementByPositionOutOfRangePositive()
        {
            var d = new Deq <int>();

            d.SetDeqElementByPosition(0, 1);
            d.GetDeqElementByPosition(1);
        }
Exemplo n.º 5
0
 private void button11_Click(object sender, EventArgs e) // скопировать
 {
     d2 = new Deq(d.array.Length);
     d.array.CopyTo(d2.array, 0);
     d.Draw(this, pictureBox1, g, false);
     d2.Draw(this, pictureBox1, g, true);
 }
Exemplo n.º 6
0
 public DataSender(
     Enq EmuEnq
     , Enq RealEnq
     , Deq ProcessingData
     , Deq SetMMLParameter
     , PackData[] startData
     , PackData[] stopData
     , DataSeqFrqEventHandler DataSeqFrqCallBack
     , Action WaitSync
     , long EmuDelay
     , long RealDelay
     , int BufferSize = DATA_SEQUENCE_FREQUENCE
     , int Frq        = DATA_SEQUENCE_FREQUENCE
     )
 {
     action                = Main;
     this.Frq              = Frq;
     ringBuffer            = new RingBuffer(BufferSize);
     ringBuffer.AutoExtend = false;
     this.ringBufferSize   = BufferSize;
     SeqCounter            = Def_SeqCounter;
     this.EmuEnq           = EmuEnq;
     this.RealEnq          = RealEnq;
     this.startData        = startData;
     this.stopData         = stopData;
     this.ProcessingData   = ProcessingData;
     this.SetMMLParameter  = SetMMLParameter;
     OnDataSeqFrq         += DataSeqFrqCallBack;
     this.WaitSync         = WaitSync;
     this.EmuDelay         = EmuDelay;
     this.RealDelay        = RealDelay;
 }
Exemplo n.º 7
0
        public void TestEmpty()
        {
            var d = new Deq <int>();

            Sorter.Sort2(d);
            Assert.IsTrue(d.Empty);
            Assert.AreEqual(0, d.Count);
        }
Exemplo n.º 8
0
        public void TestEmptySetDeqElementByPosition0()
        {
            const int val = 100;

            var d = new Deq <int>();

            d.SetDeqElementByPosition(0, val);
        }
Exemplo n.º 9
0
        public void TestPushBackPopFrontOne()
        {
            const int val = 100503;
            var       d   = new Deq <int>();

            d.PushBack(val);
            Assert.AreEqual(val, d.PopFront());
            Assert.IsTrue(d.Empty);
            Assert.AreEqual(0, d.Count);
        }
Exemplo n.º 10
0
        public void TestOneItem()
        {
            const int val = 100500;
            var d = new Deq<int>();
            d.PushBack(val);
            Sorter.Sort2(d);
            Assert.IsFalse(d.Empty);

            Assert.AreEqual(1, d.Count);
            Assert.AreEqual(val, d.PopBack());
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        public void TestOneItem()
        {
            const int val = 100500;
            var       d   = new Deq <int>();

            d.PushBack(val);
            Sorter.Sort2(d);
            Assert.IsFalse(d.Empty);

            Assert.AreEqual(1, d.Count);
            Assert.AreEqual(val, d.PopBack());
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
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());
        }
Exemplo n.º 15
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));
        }
Exemplo n.º 16
0
        public void TestOrderPushBackPopBack()
        {
            var d = new Deq <int>();

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

            Assert.AreEqual(4, d.PopBack());
            Assert.AreEqual(3, d.PopBack());
            Assert.AreEqual(2, d.PopBack());
            Assert.AreEqual(1, d.PopBack());
        }
Exemplo n.º 17
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());
        }
Exemplo n.º 18
0
 private void button13_Click(object sender, EventArgs e) //объединить в 1
 {
     try
     {
         d1       = new Deq(d.array.Length + d2.array.Length);
         d1.array = d.array.Concat(d2.array).ToArray();
         d        = d1;
         d2       = null;
         d.Draw(this, pictureBox1, g, false);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Ошибка при объединении! Нужно задать второй список", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 19
0
        public void TestTwoItems()
        {
            const int val1 = 100500;
            const int val2 = 100600;
            var       d    = new Deq <int>();

            d.PushBack(val1);
            d.PushBack(val2);
            d = Sorter.Sort2(d);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(2, d.Count);
            Assert.AreEqual(val1, d.PopFront());
            Assert.AreEqual(val2, d.PopFront());
        }
Exemplo n.º 20
0
 private void button1_Click(object sender, EventArgs e) // создать список
 {
     d = new Deq();
     d.Draw(this, pictureBox1, g, false);
     button10.Enabled = true;
     button11.Enabled = true;
     button12.Enabled = true;
     button14.Enabled = true;
     button13.Enabled = true;
     button4.Enabled  = true;
     button2.Enabled  = true;
     button9.Enabled  = true;
     button7.Enabled  = true;
     button6.Enabled  = true;
     button8.Enabled  = true;
 }
Exemplo n.º 21
0
        private void button12_Click(object sender, EventArgs e) //разбить на 2
        {
            int size = d.array.Length / 2;

            d1 = new Deq(size);
            for (int i = 0; i < size; i++)
            {
                d1.array[i] = d.array[i];
            }
            d2 = new Deq(d.array.Length - size);
            for (int i = 0; i < d.array.Length - size; i++)
            {
                d2.array[i] = d.array[i + size];
            }
            d = d1;
            d.Draw(this, pictureBox1, g, false);
            d2.Draw(this, pictureBox1, g, true);
        }
Exemplo n.º 22
0
        public void TestSortMoreItems()
        {
            int[] data = new[] {100500, 100600, 1, 1999, 200500, 1000, 100, 5};

            var d = new Deq<int>();
            foreach (var v in data) {
                d.PushBack(v);
            }

            d = Sorter.Sort2(d);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(data.Length, d.Count);

            Array.Sort(data);

            foreach (var v in data) {
                Assert.AreEqual(v, d.PopFront());
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// セットアップ
        /// </summary>
        /// <param name="DriverAction">ミュージックドライバーの1フレームあたりの処理を指定してください</param>
        /// <param name="RealChipAction">実チップ向けデータ送信処理を指定してください</param>
        /// <param name="startData">DataSenderが初期化を行うときに出力するデータを指定してください</param>
        public void Setup(
            DriverAction DriverAction
            , Snd RealChipAction
            , Deq ProcessingData
            , Deq SetMMLParameter
            , DataSeqFrqEventHandler DataSeqFrqCallBack
            , Action WaitSync
            , PackData[] startData
            , long EmuDelay
            , long RealDelay
            )
        {
            dataMaker      = new DataMaker(DriverAction);
            emuChipSender  = new EmuChipSender(DATA_SEQUENCE_FREQUENCE);
            realChipSender = new RealChipSender(RealChipAction, DATA_SEQUENCE_FREQUENCE);
            dataSender     = new DataSender(
                emuChipSender.Enq
                , realChipSender.Enq
                , ProcessingData
                , SetMMLParameter
                , startData
                , null
                , DataSeqFrqCallBack
                , WaitSync
                , EmuDelay
                , RealDelay
                //, mml2vgmIDE.Common.SampleRate
                //, mml2vgmIDE.Common.SampleRate
                );

            dataMaker.parent      = this;
            emuChipSender.parent  = this;
            realChipSender.parent = this;
            dataSender.parent     = this;

            dataMaker.Mount();
            dataSender.Mount();
            emuChipSender.Mount();
            realChipSender.Mount();
        }
Exemplo n.º 24
0
        public void TestSortSortedMoreItems()
        {
            int[] data = new[] { 100500, 100600, 1, 1999, 200500, 1000, 100, 5 };
            Array.Sort(data);

            var d = new Deq <int>();

            foreach (var v in data)
            {
                d.PushBack(v);
            }

            d = Sorter.Sort2(d);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(data.Length, d.Count);

            foreach (var v in data)
            {
                Assert.AreEqual(v, d.PopFront());
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// セットアップ
        /// </summary>
        /// <param name="DriverAction">ミュージックドライバーの1フレームあたりの処理を指定してください</param>
        /// <param name="RealChipAction">実チップ向けデータ送信処理を指定してください</param>
        /// <param name="startData">DataSenderが初期化を行うときに出力するデータを指定してください</param>
        public void Setup(
            DriverAction DriverAction
            , Snd RealChipAction
            , Deq ProcessingData
            , Action <long> DataSeqFrqCallBack
            , Action WaitSync
            , PackData[] startData
            , long EmuDelay
            , long RealDelay
            )
        {
            dataMaker      = new DataMaker(DriverAction);
            emuChipSender  = new EmuChipSender(DATA_SEQUENCE_FREQUENCE);
            realChipSender = new RealChipSender(RealChipAction, DATA_SEQUENCE_FREQUENCE);
            dataSender     = new DataSender(
                emuChipSender.Enq
                , realChipSender.Enq
                , ProcessingData
                , startData
                , null
                , DataSeqFrqCallBack
                , WaitSync
                , EmuDelay
                , RealDelay
                );

            dataMaker.parent      = this;
            emuChipSender.parent  = this;
            realChipSender.parent = this;
            dataSender.parent     = this;

            dataMaker.Mount();
            dataSender.Mount();
            emuChipSender.Mount();
            realChipSender.Mount();
        }
Exemplo n.º 26
0
        public void TestEmptySetDeqElementByPosition0()
        {
            const int val = 100;

            var d = new Deq<int>();

            d.SetDeqElementByPosition(0, val);
        }
Exemplo n.º 27
0
        public void TestEmptyPopBack()
        {
            var d = new Deq<int>();

            d.PopBack();
        }
Exemplo n.º 28
0
        public void TestEmptySetDeqElementByPositionOoRMinus1()
        {
            var d = new Deq<int>();

            d.SetDeqElementByPosition(-1, 1);
        }
Exemplo n.º 29
0
        public void TestEmptyGetFront()
        {
            var d = new Deq <int>();

            var val = d.Front;
        }
Exemplo n.º 30
0
        public void TestEmptyPopFront()
        {
            var d = new Deq <int>();

            d.PopFront();
        }
Exemplo n.º 31
0
        public void TestEmpty()
        {
            var d = new Deq<int>();

            Assert.IsTrue(d.Empty);
        }
Exemplo n.º 32
0
        public void TestOrderPushBackPopBack()
        {
            var d = new Deq<int>();

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

            Assert.AreEqual(4, d.PopBack());
            Assert.AreEqual(3, d.PopBack());
            Assert.AreEqual(2, d.PopBack());
            Assert.AreEqual(1, d.PopBack());
        }
Exemplo n.º 33
0
        public void TestEmpty()
        {
            var d = new Deq <int>();

            Assert.IsTrue(d.Empty);
        }
Exemplo n.º 34
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());
        }
Exemplo n.º 35
0
 public void TestSetDeqElementByPositionOoRNegative()
 {
     var d = new Deq<int>();
     d.SetDeqElementByPosition(0, 1);
     d.SetDeqElementByPosition(-1, -1);
 }
Exemplo n.º 36
0
 public void TestSetDeqElementByPositionOoRPositive()
 {
     var d = new Deq<int>();
     d.SetDeqElementByPosition(0, 1);
     d.SetDeqElementByPosition(2, 2);
 }
Exemplo n.º 37
0
        public void TestEmptyCountZero()
        {
            var d = new Deq<int>();

            Assert.IsTrue(d.Count == 0);
        }
Exemplo n.º 38
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());
        }
Exemplo n.º 39
0
        public void TestEmptyGetBack()
        {
            var d = new Deq<int>();

            var val = d.Back;
        }
Exemplo n.º 40
0
        public void TestEmptyPopBack()
        {
            var d = new Deq <int>();

            d.PopBack();
        }
Exemplo n.º 41
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);
        }
Exemplo n.º 42
0
        public void TestGetDeqElementByPositionOutOfRangePositive()
        {
            var d = new Deq<int>();

            d.SetDeqElementByPosition(0, 1);
            d.GetDeqElementByPosition(1);
        }
Exemplo n.º 43
0
        public void TestEmptySetDeqElementByPositionOoR1()
        {
            var d = new Deq <int>();

            d.SetDeqElementByPosition(1, 1);
        }
Exemplo n.º 44
0
        public void TestEmptyGetBack()
        {
            var d = new Deq <int>();

            var val = d.Back;
        }
Exemplo n.º 45
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));
        }
Exemplo n.º 46
0
        public void TestEmptyGetDeqElementByPosition1()
        {
            var d = new Deq <int>();

            d.GetDeqElementByPosition(1);
        }
Exemplo n.º 47
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);
        }
Exemplo n.º 48
0
        public void TestThreeItems()
        {
            const int val1 = 100500;
            const int val2 = 100600;
            const int val3 = 100700;
            var d = new Deq<int>();
            d.PushBack(val2);
            d.PushBack(val3);
            d.PushBack(val1);
            d = Sorter.Sort2(d);

            Assert.IsFalse(d.Empty);
            Assert.AreEqual(3, d.Count);
            Assert.AreEqual(val1, d.PopFront());
            Assert.AreEqual(val2, d.PopFront());
            Assert.AreEqual(val3, d.PopFront());
        }
Exemplo n.º 49
0
        public void TestEmptyGetFront()
        {
            var d = new Deq<int>();

            var val = d.Front;
        }
Exemplo n.º 50
0
        public void TestEmptyCountZero()
        {
            var d = new Deq <int>();

            Assert.IsTrue(d.Count == 0);
        }
Exemplo n.º 51
0
        public void TestEmptyPopFront()
        {
            var d = new Deq<int>();

            d.PopFront();
        }
Exemplo n.º 52
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);
        }
Exemplo n.º 53
0
        public void TestEmptyGetDeqElementByPositionMinus0()
        {
            var d = new Deq<int>();

            d.GetDeqElementByPosition(-1);
        }