Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
0
        public void EmptyInitTest()
        {
            var queue = RealTimeDeque <string> .Empty;

            AssertThrows <ArgumentNullException>(() => RealTimeDeque <string> .Init(queue));
        }