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]); }
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); }
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]); } }
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]); } }