public void AddAfterTest() { var llist = UnsafeLinkedList.Allocate <int>(); UnsafeLinkedList.AddLast(llist, 1); UnsafeLinkedList.AddLast(llist, 3); UnsafeLinkedList.AddLast(llist, 5); // Add a node after 1 and 3 so we have a 1 - 5 sequence var node = UnsafeLinkedList.FindNode(llist, 1); UnsafeLinkedList.AddAfter(llist, node, 2); node = UnsafeLinkedList.FindNode(llist, 3); UnsafeLinkedList.AddAfter(llist, node, 4); Assert.AreEqual(5, UnsafeLinkedList.GetCount(llist)); var enumerator = UnsafeLinkedList.GetEnumerator <int>(llist); enumerator.MoveNext(); for (int i = 1; i < 5; i++) { Assert.AreEqual(i, enumerator.Current); enumerator.MoveNext(); } UnsafeLinkedList.Free(llist); }
public void AddAfter(ref Node previousNode, T item) { UnsafeLinkedList.AddAfter(m_inner, previousNode._node, item); previousNode._node = null; }