public void HeadTest() { const string data = "One Two Three One Three"; var queue = data.Split().Aggregate(BatchedQueue <string> .Empty, BatchedQueue <string> .Snoc); var head = BatchedQueue <string> .Head(queue); Assert.AreEqual("One", head); }
public void PushPopTest() { const string data = "One Two Three One Three"; var queue = data.Split().Aggregate(BatchedQueue <string> .Empty, BatchedQueue <string> .Snoc); foreach (var expected in data.Split()) { var actual = BatchedQueue <string> .Head(queue); Assert.AreEqual(expected, actual); queue = BatchedQueue <string> .Tail(queue); } Assert.IsTrue(BatchedQueue <string> .IsEmpty(queue)); }
public void EmptyHeadTest() { var queue = BatchedQueue <string> .Empty; AssertThrows <ArgumentNullException>(() => BatchedQueue <string> .Head(queue)); }