コード例 #1
0
        public void Apply_Eight()
        {
            var func = Uncurry.Apply <int, int, int, int, int, int, int, int, int>(a => b => c => d => e => f => g => h => a + b + c + d + e + f + g + h);

            int value = -1;

            value = func(1, 0, 0, 0, 0, 0, 0, 0);
            Assert.AreEqual(1, value);

            value = func(1, 2, 0, 0, 0, 0, 0, 0);
            Assert.AreEqual(3, value);

            value = func(1, 2, 3, 0, 0, 0, 0, 0);
            Assert.AreEqual(6, value);

            value = func(1, 2, 3, 4, 0, 0, 0, 0);
            Assert.AreEqual(10, value);

            value = func(1, 2, 3, 4, 5, 0, 0, 0);
            Assert.AreEqual(15, value);

            value = func(1, 2, 3, 4, 5, 6, 0, 0);
            Assert.AreEqual(21, value);

            value = func(1, 2, 3, 4, 5, 6, 7, 0);
            Assert.AreEqual(28, value);

            value = func(1, 2, 3, 4, 5, 6, 7, 8);
            Assert.AreEqual(36, value);
        }
コード例 #2
0
        public void Apply_Two()
        {
            var func = Uncurry.Apply <int, int, int>(a => b => a + b);

            int value = -1;

            value = func(1, 0);
            Assert.AreEqual(1, value);

            value = func(1, 2);
            Assert.AreEqual(3, value);
        }
コード例 #3
0
        public void Apply_Three()
        {
            var func = Uncurry.Apply <int, int, int, int>(a => b => c => a + b + c);

            int value = -1;

            value = func(1, 0, 0);
            Assert.AreEqual(1, value);

            value = func(1, 2, 0);
            Assert.AreEqual(3, value);

            value = func(1, 2, 3);
            Assert.AreEqual(6, value);
        }
コード例 #4
0
        public void Apply_Four()
        {
            var func = Uncurry.Apply <int, int, int, int, int>(a => b => c => d => a + b + c + d);

            int value = -1;

            value = func(1, 0, 0, 0);
            Assert.AreEqual(1, value);

            value = func(1, 2, 0, 0);
            Assert.AreEqual(3, value);

            value = func(1, 2, 3, 0);
            Assert.AreEqual(6, value);

            value = func(1, 2, 3, 4);
            Assert.AreEqual(10, value);
        }
コード例 #5
0
        public void Apply_Six()
        {
            var func = Uncurry.Apply <int, int, int, int, int, int, int>(a => b => c => d => e => f => a + b + c + d + e + f);

            int value = -1;

            value = func(1, 0, 0, 0, 0, 0);
            Assert.AreEqual(1, value);

            value = func(1, 2, 0, 0, 0, 0);
            Assert.AreEqual(3, value);

            value = func(1, 2, 3, 0, 0, 0);
            Assert.AreEqual(6, value);

            value = func(1, 2, 3, 4, 0, 0);
            Assert.AreEqual(10, value);

            value = func(1, 2, 3, 4, 5, 0);
            Assert.AreEqual(15, value);

            value = func(1, 2, 3, 4, 5, 6);
            Assert.AreEqual(21, value);
        }