Пример #1
0
        static void Main(string[] args)
        {
            var newList = new List <int>()
            {
                1, 2, 3, 4
            };

            newList = MapFilterAndFold.Map(newList, x => x + 30);
        }
Пример #2
0
        public void MultiplicationFunctionMapTest()
        {
            testList        = MapFilterAndFold.Map(testList, x => x * 3);
            rightAnswerList = new List <int>()
            {
                12, 6, 3, 24, -15, 21, 45
            };

            Assert.AreEqual(rightAnswerList, testList);
        }
Пример #3
0
        public void FilterTest()
        {
            testList        = MapFilterAndFold.Filter(testList, x => x % 2 == 0);
            rightAnswerList = new List <int>()
            {
                4, 2, 8
            };

            Assert.AreEqual(rightAnswerList, testList);
        }
Пример #4
0
        public void AdditionFunctionMapTest()
        {
            testList        = MapFilterAndFold.Map(testList, x => x + 30);
            rightAnswerList = new List <int>()
            {
                34, 32, 31, 38, 25, 37, 45
            };

            Assert.AreEqual(rightAnswerList, testList);
        }
Пример #5
0
        public void FoldTest()
        {
            int current = MapFilterAndFold.Fold(testList, 30, (x, y) => x + y);

            Assert.AreEqual(current, 62);
        }