예제 #1
0
        public void TestMethod1()//testFront
        {
            DEQueue <string> qwsda = new DEQueue <string>();

            qwsda.pushBack("KAte");
            qwsda.pushBack("LOLQOP");
            Assert.AreEqual(qwsda.front(), "KAte");
        }
예제 #2
0
        public void testPushFrontMany()
        {
            DEQueue <string> b = new DEQueue <string>();

            b.pushBack("abc");
            b.pushBack("cba");
            Assert.IsTrue(b.Count == 2);
            Assert.AreEqual("abc", b.Head);
        }
예제 #3
0
        public void testBack()
        {
            DEQueue <string> b = new DEQueue <string>();

            Assert.AreEqual(null, b.back());
            b.pushBack("abc");
            b.pushBack("cba");
            Assert.AreEqual("cba", b.back());
            Assert.IsTrue(b.Count == 2);
        }
예제 #4
0
        public void testToArray()
        {
            DEQueue <string> b = new DEQueue <string>();

            Assert.AreEqual(null, b.toArray());
            b.pushBack("abc");
            b.pushBack("cba");
            string[] arr = b.toArray();
            Assert.AreEqual("abc", arr[0]);
            Assert.AreEqual("cba", arr[1]);
        }
예제 #5
0
파일: Test.cs 프로젝트: UserTundra/DEQueue
        public void PushBacktManyTest()
        {
            DEQueue <string> deq = new DEQueue <string>();

            deq.pushBack("a");
            deq.pushBack("b");
            deq.pushBack("c");
            Assert.IsTrue(deq.Size == 3);
            Assert.IsTrue(deq.Head.Data == "a");
            Assert.IsTrue(deq.Tail.Data == "c");
        }
예제 #6
0
        public void TestMethod4()//test_popfront_popback
        {
            DEQueue <string> qwsda = new DEQueue <string>();

            qwsda.pushBack("a");
            qwsda.pushBack("b");
            qwsda.pushBack("c");
            qwsda.pushBack("d");
            string a = qwsda.popFront() + qwsda.popBack() + qwsda.popFront() + qwsda.popBack();

            Assert.AreEqual(a, "adbc");
        }
예제 #7
0
        public void size_Test2()
        {
            int expected       = 4;
            DEQueue <String> q = new DEQueue <string>(); // Создание очереди для хранения строк

            q.pushBack("a");
            q.pushBack("b");
            q.pushBack("c");
            q.pushBack("d");
            int s = q.size();

            Assert.AreEqual(expected, s);
        }
예제 #8
0
        public void back_Test2()
        {
            string           expected = "d";
            DEQueue <String> q        = new DEQueue <string>(); // Создание очереди для хранения строк

            q.pushBack("a");
            q.pushBack("b");
            q.pushBack("c");
            q.pushBack("d");
            string s = q.back();

            Assert.AreEqual(expected, s);
        }
예제 #9
0
        public void TestMethod5()//test_toArray
        {
            DEQueue <int> qwsda = new DEQueue <int>();

            qwsda.pushBack(1);
            qwsda.pushBack(2);
            qwsda.pushBack(3);
            qwsda.pushBack(4);
            int[] a = new int[4];
            a[0] = 1; a[1] = 2; a[2] = 3; a[3] = 4;
            int[] b = qwsda.toArray();
            CollectionAssert.AreEqual(a, b);
        }
예제 #10
0
        public void pushFrontTest_MarkAndAlisa_AlisaReturn()
        {
            // arrange
            DEQueue <string> queue    = new DEQueue <string>();
            string           expected = "Alisa";

            // act
            queue.pushBack("Mark");
            queue.pushBack("Azat");
            queue.pushFront("Alisa");

            // assert
            Assert.AreEqual(expected, queue.front);
        }
예제 #11
0
        public void ClearTes_KostyaAndMark_KostyaReturnt()
        {
            // arrange
            DEQueue <string> queue    = new DEQueue <string>();
            string           expected = "Kostya";

            // act
            queue.pushBack("Mark");
            queue.Clear();

            queue.pushBack("Kostya");

            // assert
            Assert.AreEqual(expected, queue.back);
        }
예제 #12
0
        public void popBackTest_KostyaAndMark_KostyaReturn()
        {
            // arrange
            DEQueue <string> queue    = new DEQueue <string>();
            string           expected = "Kostya";

            // act
            queue.pushBack("Kostya");
            queue.pushBack("Mark");
            queue.pushFront("Kate");
            queue.popBack();

            // assert
            Assert.AreEqual(expected, queue.back);
        }
예제 #13
0
파일: Test.cs 프로젝트: UserTundra/DEQueue
        public void ToArrayIntTest()
        {
            int[]         output = { 1, 2, 3, 4, 5 };
            DEQueue <int> deq    = new DEQueue <int>();

            deq.pushFront(1);
            deq.pushBack(2);
            deq.pushBack(3);
            deq.pushBack(4);
            deq.pushBack(5);
            for (int i = 0; i < 5; i++)
            {
                Assert.AreEqual(output[i], deq.toArray()[i]);
            }
        }
예제 #14
0
        public void DeqTest4()
        {
            DEQueue <int> Deq = new DEQueue <int>();

            Deq.pushBack(1);
            Deq.pushBack(2);
            Deq.pushBack(3);
            int[] expected = { 1, 2, 3 };
            int   i        = 0;

            foreach (int s in Deq)
            {
                Assert.AreEqual(expected[i], s);
                i++;
            }
        }
예제 #15
0
        public void testSize()
        {
            DEQueue <string> b = new DEQueue <string>();

            b.pushBack("abc");
            Assert.AreEqual(1, b.size());
        }
예제 #16
0
        public void ClearTes_MarkAndAlisa_MarkReturnt()
        {
            // arrange
            DEQueue <string> queue    = new DEQueue <string>();
            string           expected = "Mark";

            // act
            queue.pushBack("Alisa");
            queue.pushBack("Azat");
            queue.Clear();

            queue.pushBack("Mark");

            // assert
            Assert.AreEqual(expected, queue.back);
        }
예제 #17
0
        public void testClear()
        {
            DEQueue <string> b = new DEQueue <string>();

            b.pushBack("abc");
            b.clear();
            Assert.IsTrue(b.Count == 0);
        }
예제 #18
0
파일: Test.cs 프로젝트: UserTundra/DEQueue
        public void FrontManyTest()
        {
            DEQueue <string> deq = new DEQueue <string>();

            deq.pushFront("a");
            deq.pushBack("b");
            deq.pushFront("c");
            Assert.AreEqual("c", deq.front().Data);
        }
예제 #19
0
        public void clearTest_LuffyAndZoroAndSanji_ReturnedNami()
        {
            // arrange
            DEQueue <string> queue    = new DEQueue <string>();
            string           expected = "Nami";

            // act
            queue.pushFront("Luffy");
            queue.pushBack("Zoro");
            queue.pushFront("Sanji");
            queue.Clear();

            queue.pushBack("Nami");
            queue.pushBack("Usopp");
            queue.pushBack("Chopper");

            // assert
            Assert.AreEqual(expected, queue.front);
        }
예제 #20
0
        public void testPushFrontOne()
        {
            DEQueue <string> b = new DEQueue <string>();

            b.pushBack("abc");
            Assert.IsTrue(b.Count == 1);
            foreach (var x in b)
            {
                Assert.AreEqual("abc", x);
            }
        }
예제 #21
0
파일: Test.cs 프로젝트: UserTundra/DEQueue
        public void PushBack()
        {
            DEQueue <string> deq = new DEQueue <string>();

            deq.pushBack("a");
            Assert.IsTrue(deq.Size == 1);

            foreach (var item in deq)
            {
                Assert.AreEqual("a", item);
            }
        }
예제 #22
0
파일: Test.cs 프로젝트: UserTundra/DEQueue
        public void PopFrontTest()
        {
            DEQueue <string> deq = new DEQueue <string>();

            deq.pushBack("a");
            deq.pushBack("b");
            deq.pushBack("c");
            Assert.IsTrue(deq.Size == 3);
            Assert.AreEqual("a", deq.Head.Data);
            Assert.AreEqual("c", deq.Tail.Data);

            deq.popFront();
            Assert.IsTrue(deq.Size == 2);
            Assert.AreEqual("b", deq.Head.Data);
            Assert.AreEqual("c", deq.Tail.Data);

            deq.popFront();
            Assert.IsTrue(deq.Size == 1);
            Assert.AreEqual("c", deq.Head.Data);
            Assert.AreEqual("c", deq.Tail.Data);
        }
예제 #23
0
        public void pushFrontTest_LuffyAndZoro_ReturnedLuffy()
        {
            // arrange
            DEQueue <string> queue    = new DEQueue <string>();
            string           expected = "Luffy";

            // act
            queue.pushFront("Luffy");
            queue.pushBack("Zoro");

            // assert
            Assert.AreEqual(expected, queue.front);
        }
예제 #24
0
        public void pushFrontTest_KostyaAndMark_MarkReturn()
        {
            // arrange
            DEQueue <string> queue    = new DEQueue <string>();
            string           expected = "Mark";

            // act
            queue.pushBack("Kostya");
            queue.pushFront("Mark");

            // assert
            Assert.AreEqual(expected, queue.front);
        }
예제 #25
0
        public void Main_Test2()
        {
            string           expected = "a";
            DEQueue <String> q        = new DEQueue <String>(); // Создание очереди для хранения строк

            q.pushFront("a");                                   // очередь: a
            q.pushFront("b");                                   // очередь: b a
            q.pushBack("c");                                    // очередь: b a c
            String s = q.front();                               // s = “b”

            s = q.pop();                                        // s = “c”;    очередь:  b a

            Assert.AreEqual(expected, s);
        }
예제 #26
0
        public void sizeTest_LuffyAndZoroAndSanji_Returned3()
        {
            // arrange
            DEQueue <string> queue = new DEQueue <string>();
            int expected           = 3;

            // act
            queue.pushFront("Luffy");
            queue.pushBack("Zoro");
            queue.pushFront("Sanji");

            // assert
            Assert.AreEqual(expected, queue.size);
        }
예제 #27
0
파일: Test.cs 프로젝트: UserTundra/DEQueue
        public void ToArrayStringTest()
        {
            string[] output = { "c", "a", "b" };

            DEQueue <string> deq = new DEQueue <string>();

            deq.pushFront("a");
            deq.pushBack("b");
            deq.pushFront("c");
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(output[i], deq.toArray()[i]);
            }
        }
예제 #28
0
파일: Test.cs 프로젝트: UserTundra/DEQueue
        public void ClearTest()
        {
            DEQueue <string> deq = new DEQueue <string>();

            deq.pushFront("a");
            deq.pushBack("b");
            deq.pushFront("c");
            Assert.IsTrue(deq.Size == 3);
            Assert.AreEqual("c", deq.Head.Data);
            Assert.AreEqual("b", deq.Tail.Data);

            deq.clear();
            Assert.IsTrue(deq.Size == 0);
            Assert.IsNull(deq.Head);
            Assert.IsNull(deq.Tail);
        }
예제 #29
0
        private static void Main(string[] args)
        {
            DEQueue <string> queue = new DEQueue <string>();


            Console.WriteLine("---Добавление элементов---");
            queue.pushFront("Mark");
            queue.pushFront("Alisa");
            queue.pushBack("Kate");
            queue.pushBack("Ed");
            queue.pushBack("Kostya");
            queue.pushFront("Ilyas");
            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("---Удаление с начала---");

            Console.WriteLine(queue.popFront());

            Console.WriteLine("---Вывод данных---");

            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("---Удаление с конца---");
            Console.WriteLine(queue.popBack());

            Console.WriteLine("---Вывод данных---");

            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("---Очистка данных---");
            queue.Clear();

            queue.pushFront("Mark");
            queue.pushFront("Alisa");
            queue.pushBack("Kate");
            queue.pushBack("Ed");
            queue.pushBack("Kostya");
            queue.pushFront("Ilyas");

            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("---ЛИСТ---");

            foreach (var x in queue.convertToArray())
            {
                Console.WriteLine(x);
            }


            string[] ss = (string[])queue.convertToArray().Clone();

            Console.WriteLine("---ЛИСТ КОПИЯ---");

            foreach (var x in ss.ToArray())
            {
                Console.WriteLine(x);
            }


            Console.WriteLine("---Проверка Типов---");

            if (ss.ToArray().GetType() == queue.convertToArray().GetType())
            {
                Console.WriteLine("True");
            }


            Console.Read();
        }
예제 #30
0
        private static void Main(string[] args)
        {
            DEQueue <string> queue = new DEQueue <string>();

            // добавление элементов

            Console.WriteLine("-------Добавление элементов--------");

            queue.pushBack("Bob");
            queue.pushBack("Bill");
            queue.pushBack("Tom");
            queue.pushFront("Kate");
            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();

            Console.WriteLine("-------Удаление из начала--------");

            Console.WriteLine(queue.popFront());

            Console.WriteLine();

            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();

            Console.WriteLine("-------Удаление из конца--------");

            Console.WriteLine(queue.popBack());

            Console.WriteLine();

            Console.WriteLine("-------Количество элементов в очереди--------");

            Console.WriteLine(queue.size);

            Console.WriteLine();

            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("-------Очищение очереди--------");

            queue.Clear();

            Console.WriteLine();

            Console.WriteLine("----Добавление элементов-----");

            queue.pushBack("Bob");
            queue.pushBack("Bill");
            queue.pushBack("Tom");
            queue.pushFront("Kate");

            foreach (var item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine("-------Преобразование в список--------");

            foreach (var x in queue.convertToArray())
            {
                Console.WriteLine(x);
            }

            string[] ss = (string[])queue.convertToArray().Clone();

            Console.WriteLine("-------Копия списка--------");

            foreach (var x in ss.ToArray())
            {
                Console.WriteLine(x);
            }

            Console.WriteLine();

            Console.WriteLine("-------True потому что преобразовали очередь в список--------");
            if (ss.ToArray().GetType() == queue.convertToArray().GetType())
            {
                Console.WriteLine("True");
            }

            Console.Read();
        }