public void List8_InsertInTheTopTest() { var list = new List8<Int32>(); list.Add(2147483647); list.Add(1073741823); list.Add(715827882); list.Add(536870911); list.Add(429496729); list.Insert(4, -1073741824); Assert.AreEqual(6, list.Count); Assert.AreEqual(-1073741824, list[4]); Assert.AreEqual(2147483647, list[0]); Assert.AreEqual(1073741823, list[1]); Assert.AreEqual(715827882, list[2]); Assert.AreEqual(536870911, list[3]); Assert.AreEqual(429496729, list[5]); }
public void List8_Full_EnumerationTest() { var list = new List8<Int32>(); list.Add(2147483647); list.Add(1073741823); list.Add(715827882); list.Add(536870911); list.Add(429496729); list.Add(357913941); list.Add(306783378); list.Add(268435455); var index = -1; foreach (var item in list) { ++index; switch(index) { case 0: Assert.AreEqual(2147483647, item); break; case 1: Assert.AreEqual(1073741823, item); break; case 2: Assert.AreEqual(715827882, item); break; case 3: Assert.AreEqual(536870911, item); break; case 4: Assert.AreEqual(429496729, item); break; case 5: Assert.AreEqual(357913941, item); break; case 6: Assert.AreEqual(306783378, item); break; case 7: Assert.AreEqual(268435455, item); break; default: Assert.Fail("Out of range enumeration"); break; } } }
public void List8_Filled_SetWithOutOfRangeIndexTest() { var list = new List8<Int32>(); list.Add(1); list.Add(2); Assert.Throws<IndexOutOfRangeException>(() => list[8] = 1); }
public void List8_Filled_GetWithNegativeIndexTest() { var list = new List8<Int32>(); list.Add(1); list.Add(2); Assert.Throws<IndexOutOfRangeException>(() => { var temp = list[-1]; }); }
public void List8_ClearTest() { var list = new List8<Int32>(); list.Add(2147483647); list.Add(1073741823); list.Add(715827882); list.Add(536870911); list.Add(429496729); list.Add(357913941); list.Add(306783378); list.Add(268435455); list.Clear(); Assert.AreEqual(0, list.Count); Assert.AreEqual(8, list.Capacity); foreach (var item in list) Assert.Fail("Empty list enumeration"); }
public void List8_AddTest() { var list = new List8<Int32>(); list.Add(2147483647); list.Add(1073741823); list.Add(715827882); list.Add(536870911); list.Add(429496729); list.Add(357913941); list.Add(306783378); list.Add(268435455); Assert.AreEqual(2147483647, list[0]); Assert.AreEqual(1073741823, list[1]); Assert.AreEqual(715827882, list[2]); Assert.AreEqual(536870911, list[3]); Assert.AreEqual(429496729, list[4]); Assert.AreEqual(357913941, list[5]); Assert.AreEqual(306783378, list[6]); Assert.AreEqual(268435455, list[7]); }