public void Test_Replace_WhenCursorIsNull() { var list = new TwoWayList <int>(); list.Replace(1); Assert.AreEqual(OperationStatus.ERR, list.ReplaceStatus); }
public void Test_Find_WhenListIsEmpty() { var list = new TwoWayList <int>(); list.Find(3); Assert.AreEqual(OperationStatus.OK, list.FindStatus); }
public void Test_MoveToHead_WhenListIsEmpty() { var list = new TwoWayList <int>(); list.MoveToHead(); Assert.AreEqual(OperationStatus.ERR, list.MoveToHeadStatus); }
public void ReloadConcepts() { conceptNames = new List <string>(); conceptDictionary = new TwoWayList <int, Fuzzy.Concept>(); displayFunctions = new List <bool>(); functionDictionary = new Dictionary <Fuzzy.Concept, TwoWayList <int, Fuzzy.Function> >(); //Fills the conceptDictionary container and gather the concept names for (int conceptKey = 0; conceptKey < _owner.ConceptList.Count; conceptKey++) { Fuzzy.Concept concept = _owner.ConceptList[conceptKey]; displayFunctions.Add(false); conceptNames.Add(concept.name); conceptDictionary.Add(conceptKey, concept); functionDictionary.Add(concept, new TwoWayList <int, Fuzzy.Function>()); //Fills the function two-way list of the current concept for (int j = 0; j < concept.Functions.Count; j++) { functionDictionary[concept].Add(j, concept.GetFunction(j)); } } }
public void Test_MoveToTail_WhenOneNode() { var list = new TwoWayList <int>(); list.AddTail(1); list.MoveToTail(); Assert.AreEqual(1, list.Value()); }
public void Test_PutLeft_WhenEmptyList() { var list = new TwoWayList <int>(); list.PutLeft(2); Assert.AreEqual(OperationStatus.ERR, list.PutLeftStatus); }
public void Test_Remove_WhenListIsEmpty() { var list = new TwoWayList <int>(); list.Remove(); Assert.AreEqual(OperationStatus.ERR, list.RemoveStatus); }
public void Test_MoveToTail_WhenEmptyList() { var list = new TwoWayList <int>(); list.MoveToTail(); Assert.AreEqual(OperationStatus.ERR, list.MoveToTailStatus); }
public void Test_Constructor() { var list = new TwoWayList <int>(); Assert.AreEqual(false, list.IsValue); Assert.AreEqual(false, list.IsTail); Assert.AreEqual(false, list.IsHead); }
public void TestMethod3() { double exp = 1.6; TwoWayList list = new TwoWayList(new double[] { 0.5, 0, 1.6 }); double act = list.Solve(); Assert.AreEqual(exp, act); }
public void TestMethod1() { double exp = 0; TwoWayList list = new TwoWayList(new double[] { }); double act = list.Solve(); Assert.AreEqual(exp, act); }
public void Test_Replace_WhenCursorIsNotNull() { var list = new TwoWayList <int>(); list.AddTail(1); list.Replace(2); Assert.AreEqual(OperationStatus.OK, list.ReplaceStatus); Assert.AreEqual(2, list.Value()); }
public void Test_MoveRight_WhenNoNodesRighter() { var list = new TwoWayList <int>(); list.AddTail(1); list.MoveRight(); Assert.AreEqual(OperationStatus.ERR, list.MoveRightStatus); }
public void TestMethod4() { double exp = 7.6; TwoWayList list = new TwoWayList(new double[] { 0.9, 2, 0.1, 4 }); double act = list.Solve(); Assert.AreEqual(exp, act); }
public void Test_Find_WhenCursorNoElementAfter() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.Find(3); Assert.AreEqual(OperationStatus.OK, list.FindStatus); Assert.AreEqual(list.Value(), 1); }
public void Test_Remove_WhenOneElement() { var list = new TwoWayList <int>(); list.AddTail(1); list.Remove(); Assert.AreEqual(OperationStatus.OK, list.RemoveStatus); Assert.AreEqual(0, list.Size()); Assert.AreEqual(false, list.IsValue); }
public void Test_RemoveAll_WhenCursorNodeIsRemovedSeveralTimes() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.AddTail(2); list.AddTail(3); list.RemoveAll(1); Assert.AreEqual(2, list.Value()); }
public void Test_PutRight_WhenNewNodeInTail() { var list = new TwoWayList <int>(); list.AddTail(1); list.PutRight(2); Assert.AreEqual(OperationStatus.OK, list.PutRightStatus); Assert.AreEqual(1, list.Value()); Assert.AreEqual(2, list.Size()); }
public void Test_Find_WhenValueEqualsCurrent() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.AddTail(2); list.AddTail(3); list.Find(1); Assert.AreEqual(OperationStatus.OK, list.FindStatus); Assert.AreEqual(list.Value(), 1); }
public void Test_RemoveAll_WhenCursorNodeIsHeadAndRemoved() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.AddTail(2); list.AddTail(3); list.RemoveAll(1); Assert.AreEqual(2, list.Value()); Assert.AreEqual(3, list.Size()); }
public void Test_MoveRight_WhenSuccess() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.MoveRight(); Assert.AreEqual(OperationStatus.OK, list.MoveRightStatus); Assert.AreEqual(true, list.IsTail); Assert.AreEqual(2, list.Value()); }
public void Test_Remove_WhenHead() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.Remove(); Assert.AreEqual(OperationStatus.OK, list.RemoveStatus); Assert.AreEqual(1, list.Size()); Assert.AreEqual(true, list.IsValue); }
public void Test_Remove_WhenInMiddle() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.AddTail(3); list.MoveRight(); list.Remove(); Assert.AreEqual(OperationStatus.OK, list.RemoveStatus); Assert.AreEqual(2, list.Size()); }
public void Test_RemoveAll_WhenSeveralNodesAreRemoved() { var list = new TwoWayList <int>(); list.AddTail(1); list.AddTail(2); list.AddTail(3); list.AddTail(2); list.AddTail(4); list.MoveRight(); list.MoveRight(); list.RemoveAll(2); Assert.AreEqual(3, list.Value()); Assert.AreEqual(3, list.Size()); }
static void Main(string[] args) { Console.WriteLine("Працюємо зi стеком"); Console.WriteLine("Операцiї\n1 - додати в стек\n2 - видалити з стеку\n3 - показати стек як массив\n4 - перейти до черги"); Stack <int> stack = new Stack <int>(); bool IsEnd = false; while (!IsEnd) { Console.Write("Введiть номер операцiї => "); switch (Convert.ToInt32(Console.ReadLine())) { case 1: Console.Write("Введiть елемент => "); stack.Push(Convert.ToInt32(Console.ReadLine())); break; case 2: Console.WriteLine("Видалили " + stack.Pop()); break; case 3: ShowArray(stack.ToArray()); break; case 4: IsEnd = true; break; } } Console.Clear(); Console.WriteLine("Працюємо iз чергою"); Console.WriteLine("Операцiї\n1 - додати в чергу\n2 - видалити з черги\n3 - показати чергу як массив\n4 - перейти до списку"); Queue <int> queue = new Queue <int>(); IsEnd = false; while (!IsEnd) { Console.Write("Введiть номер операцiї => "); switch (Convert.ToInt32(Console.ReadLine())) { case 1: Console.Write("Введiть елемент => "); queue.Enqueue(Convert.ToInt32(Console.ReadLine())); break; case 2: Console.WriteLine("Видалили " + queue.Dequeue()); break; case 3: ShowArray(queue.ToArray()); break; case 4: IsEnd = true; break; } } Console.Clear(); Console.WriteLine("Працюємо iз списком"); Console.WriteLine("Операцiї\n1 - додати в початок списку\n2 - додати в кiнець списку\n3 - видалити з початку списку\n4 - видалити з кiнця списку\n5 - додати в середину списку\n6 - видалити з середини списку\n7 - показати список як массив\n8 - завершити роботу"); TwoWayList <int> twList = new TwoWayList <int>(); IsEnd = false; while (!IsEnd) { Console.Write("Введiть номер операцiї => "); switch (Convert.ToInt32(Console.ReadLine())) { case 1: Console.Write("Введiть елемент => "); twList.AddHead(Convert.ToInt32(Console.ReadLine())); break; case 2: Console.Write("Введiть елемент => "); twList.AddEnd(Convert.ToInt32(Console.ReadLine())); break; case 3: twList.DelHead(); Console.WriteLine("Видалили"); break; case 4: twList.DelEnd(); Console.WriteLine("Видалили"); break; case 5: Console.Write("Введiть елемент пiсля якого додати => "); int temp = Convert.ToInt32(Console.ReadLine()); Console.Write("Введiть елемент => "); twList.AddMid(temp, Convert.ToInt32(Console.ReadLine())); break; case 6: Console.Write("Введiть елемент => "); twList.DelMid(Convert.ToInt32(Console.ReadLine())); break; case 7: ShowArray(twList.ToArray()); break; case 8: IsEnd = true; break; } } }