本文整理汇总了C#中DoublyLinkedList.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# DoublyLinkedList.IsEmpty方法的具体用法?C# DoublyLinkedList.IsEmpty怎么用?C# DoublyLinkedList.IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoublyLinkedList
的用法示例。
在下文中一共展示了DoublyLinkedList.IsEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveTailPUT
public void RemoveTailPUT([PexAssumeUnderTest]IList<int> values, int randomPick1)
{
PexAssume.AreDistinctValues<int>(values as int[]);
PexAssume.IsTrue(values.Contains(randomPick1));
DoublyLinkedList<int> dll = new DoublyLinkedList<int> (values);
bool tail = dll.Tail.Value == randomPick1 ? true:false;
bool head = dll.Head.Value == randomPick1 ? true : false;
PexObserve.ValueForViewing<bool>("isTail", tail);
PexObserve.ValueForViewing<bool>("isHead", head);
dll.Remove(randomPick1);
PexAssert.AreEqual(values.Count - 1, dll.Count);
if (values.Count == 1)
{
PexAssert.IsTrue(dll.IsEmpty());
//PexGoal.Reached("g1");
return;
}
if (values.Count == 2)
{
PexAssert.AreEqual(dll.Head, dll.Tail);
//PexGoal.Reached("g2");
}
if (tail)
{
PexAssert.AreEqual(values[values.Count - 2], dll.Tail.Value);
//PexGoal.Reached("g3");
}
if (head)
{
PexAssert.AreEqual(values[1], dll.Head.Value);
// PexGoal.Reached("g4");
}
PexAssert.IsFalse(dll.Contains(randomPick1));
}
示例2: IsEmptyPUT
public void IsEmptyPUT()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int>();
PexAssert.IsTrue(dll.IsEmpty());
}
示例3: RemoveLastTest
public void RemoveLastTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10};
dll.RemoveLast();
Assert.IsTrue(dll.IsEmpty());
Assert.IsFalse(dll.RemoveLast());
Assert.IsNull(dll.Tail);
}
示例4: RemoveSingleNodeTest
public void RemoveSingleNodeTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int> {10};
dll.Remove(10);
Assert.IsTrue(dll.IsEmpty());
Assert.IsNull(dll.Head);
Assert.IsNull(dll.Tail);
Assert.AreEqual(0, dll.Count);
}
示例5: IsEmptyTest
public void IsEmptyTest()
{
DoublyLinkedList<int> dll = new DoublyLinkedList<int>();
Assert.IsTrue(dll.IsEmpty());
}