public void SnocTest() { var queue = RealTimeDeque <string> .Empty; queue = RealTimeDeque <string> .Snoc(queue, "Head"); Assert.AreEqual("[0, {}, {}, 1, {$}, {}]", DumpQueue(queue, false)); queue = RealTimeDeque <string> .Snoc(queue, "Last"); Assert.AreEqual("[1, {$Head}, {Head}, 1, {$Last}, {Last}]", DumpQueue(queue, true)); }
public void EmptyTest() { var queue = RealTimeDeque <string> .Empty; Assert.IsTrue(RealTimeDeque <string> .IsEmpty(queue)); queue = RealTimeDeque <string> .Cons("Head", queue); Assert.IsFalse(RealTimeDeque <string> .IsEmpty(queue)); queue = RealTimeDeque <string> .Tail(queue); Assert.IsTrue(RealTimeDeque <string> .IsEmpty(queue)); queue = RealTimeDeque <string> .Snoc(queue, "Tail"); Assert.IsFalse(RealTimeDeque <string> .IsEmpty(queue)); queue = RealTimeDeque <string> .Init(queue); Assert.IsTrue(RealTimeDeque <string> .IsEmpty(queue)); }
public void EmptySoncTest() { AssertThrows <NullReferenceException>(() => RealTimeDeque <string> .Snoc(null, "Item")); }