public void InitTest() { const string data = "One Two Three One Three"; var queue = data.Split().Aggregate(RealTimeDeque <string> .Empty, RealTimeDeque <string> .Snoc); var init = RealTimeDeque <string> .Init(queue); Assert.AreEqual("[3, {One, Two, $Three}, {Three}, 1, {One}, {}]", DumpQueue(init, true)); }
public void SnocLastInitTest() { const string data = "One Two Three One Three"; var queue = data.Split().Aggregate(RealTimeDeque <string> .Empty, RealTimeDeque <string> .Snoc); var dat = data.Split().Reverse(); foreach (var expected in dat) { var actual = RealTimeDeque <string> .Last(queue); Assert.AreEqual(expected, actual); queue = RealTimeDeque <string> .Init(queue); } Assert.IsTrue(RealTimeDeque <string> .IsEmpty(queue)); }
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 EmptyInitTest() { var queue = RealTimeDeque <string> .Empty; AssertThrows <ArgumentNullException>(() => RealTimeDeque <string> .Init(queue)); }