private IList ConvertToListType(string iniString) { IList list = null; switch (iniString) { case "AList0": list = new AList0(); break; case "AList1": list = new AList1(); break; case "AList2": list = new AList2(); break; case "AListR": list = new AListR(); break; case "LList1": list = new LList1(); break; default: break; } return(list); }
public void NU_Init_AListR(int[] ini, int size, int[] exp) { AListR list = new AListR(); list.Init(ini); int[] act = list.ToArray(); Assert.AreEqual(size, list.Size()); CollectionAssert.AreEqual(exp, act); }
public void Init_AListR() { AListR list = new AListR(); list.Init(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); int[] act = list.ToArray(); int[] exp = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; Assert.AreEqual(11, list.Size()); CollectionAssert.AreEqual(exp, act); }
public void NU_DelPos_AListR(int[] ini, int pos, int delVal, int[] exp) { AListR list = new AListR(); list.Init(ini); int res = list.DelPos(pos); int[] act = list.ToArray(); Assert.AreEqual(delVal, res); CollectionAssert.AreEqual(exp, act); }
public void IndMax_AListR() { AListR list = new AListR(); list.Init(new int[] { 6 }); for (int i = 5; i >= 0; i--) { list.AddStart(i); } int act = list.IndMax(); Assert.AreEqual(6, act); }
public void DelPos_Overlapped_AListR() { AListR list = new AListR(); list.Init(new int[] { 1, 6, 7, 4, 2, 1 }); int res = list.DelPos(3); int[] act = list.ToArray(); int[] exp = new int[] { 1, 6, 7, 2, 1 }; Assert.AreEqual(4, res); CollectionAssert.AreEqual(exp, act); }
public void AddPos_AListR() { AListR list = new AListR(); list.Init(new int[] { 0, 1, 2, 4, 5, 6, 7, 8, 9 }); list.AddPos(3, 3); int[] act = list.ToArray(); int[] exp = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; Assert.AreEqual(10, list.Size()); CollectionAssert.AreEqual(exp, act); }
public void NU_IndMax_AListR(int[] ini, int exp) { AListR list = new AListR(); list.Init(ini); for (int i = 5; i >= 0; i--) { list.AddStart(i); } int act = list.IndMax(); Assert.AreEqual(exp, act); }
public void NU_ToString_AListR(int[] ini, string exp) { AListR list = new AListR(); list.Init(ini); for (int i = 5; i >= 0; i--) { list.AddStart(i); } string act = list.ToString(); Assert.AreEqual(exp, act); }
public void ToString_AListR() { AListR list = new AListR(); list.Init(new int[] { 6 }); for (int i = 5; i >= 0; i--) { list.AddStart(i); } string act = list.ToString(); string exp = "0 1 2 3 4 5 6"; Assert.AreEqual(exp, act); }
public void DelStart_AListR() { AListR list = new AListR(); list.Init(new int[] { 0, 1, 2, 3, 4, 5, 6 }); int res = 0; for (int i = 1; i <= 6; ++i) { res = list.DelStart(); } int[] act = list.ToArray(); Assert.AreEqual(5, res); CollectionAssert.AreEqual(new int[] { 6 }, act); }
public void NU_DelStart_AListR(int[] ini, int[] exp, int delVal) { AListR list = new AListR(); list.Init(ini); int res = 0; for (int i = 1; i <= 6; ++i) { res = list.DelStart(); } int[] act = list.ToArray(); Assert.AreEqual(delVal, res); CollectionAssert.AreEqual(exp, act); }