예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
 public void EmptySoncTest()
 {
     AssertThrows <NullReferenceException>(() => RealTimeDeque <string> .Snoc(null, "Item"));
 }