public void EmptyTest() { var queue = HoodMelvilleQueue <string> .Empty; Assert.IsTrue(HoodMelvilleQueue <string> .IsEmpty(queue)); queue = HoodMelvilleQueue <string> .Snoc(queue, "Item"); Assert.IsFalse(HoodMelvilleQueue <string> .IsEmpty(queue)); queue = HoodMelvilleQueue <string> .Tail(queue); Assert.IsTrue(HoodMelvilleQueue <string> .IsEmpty(queue)); }
public void SnocTest() { var queue = HoodMelvilleQueue <string> .Empty; queue = HoodMelvilleQueue <string> .Snoc(queue, "One"); Assert.AreEqual("[1, [One], 0, null]", DumpQueue(queue)); queue = HoodMelvilleQueue <string> .Snoc(queue, "Two"); Assert.AreEqual("[1, [One], 1, [Two]]", DumpQueue(queue)); queue = HoodMelvilleQueue <string> .Snoc(queue, "Three"); Assert.AreEqual("[3, [One], 0, null]", DumpQueue(queue)); }
public void SnocEmptyTest() { AssertThrows <NullReferenceException>(() => HoodMelvilleQueue <string> .Snoc(null, "Item")); }