コード例 #1
0
        public void HeadTest()
        {
            var stack = CustomStack <string> .Cons("Hello", CustomStack <string> .Empty);

            var head = CustomStack <string> .Head(stack);

            Assert.AreEqual("Hello", head);
        }
コード例 #2
0
        public void TailTest()
        {
            var empty = CustomStack <string> .Empty;
            var hello = CustomStack <string> .Cons("Hello", empty);

            var world = CustomStack <string> .Cons("World", hello);

            var stack = CustomStack <string> .Tail(world);

            Assert.AreEqual(hello, stack);
        }
コード例 #3
0
        public void NotEmptyTest()
        {
            var stack = CustomStack <string> .Cons("Hello", CustomStack <string> .Empty);

            Assert.IsFalse(CustomStack <string> .IsEmpty(stack));
        }