public void EmptyTest() { var queue = PhysicistsQueue <string> .Empty; Assert.IsTrue(PhysicistsQueue <string> .IsEmpty(queue)); queue = PhysicistsQueue <string> .Snoc(queue, "Item"); Assert.IsFalse(PhysicistsQueue <string> .IsEmpty(queue)); queue = PhysicistsQueue <string> .Tail(queue); Assert.IsTrue(PhysicistsQueue <string> .IsEmpty(queue)); }
public void PushPopTest() { const string data = "One Two Three One Three"; var queue = data.Split().Aggregate(PhysicistsQueue <string> .Empty, PhysicistsQueue <string> .Snoc); foreach (var expected in data.Split()) { var head = PhysicistsQueue <string> .Head(queue); Assert.AreEqual(expected, head); queue = PhysicistsQueue <string> .Tail(queue); } Assert.IsTrue(PhysicistsQueue <string> .IsEmpty(queue)); }