예제 #1
0
        public void ParialsumTestMethod()
        {
            int[]      array = { 3, 6, 5, 8, 7, 1, 6 };
            STDelegate st    = new STDelegate(array, (x, y) => Math.Min(x, y));
            var        res   = st.Query(1, 5, int.MaxValue);

            Assert.AreEqual(1, res);
        }
예제 #2
0
        public void SumAllTestMethod()
        {
            int[]      array = { 3, 6, 5, 8, 7, 1, 6 };
            STDelegate st    = new STDelegate(array, (x, y) => Math.Min(x, y));
            var        res   = st.Query(0, array.Length - 1, int.MaxValue);

            Assert.AreEqual(array.Min(), res);
        }
예제 #3
0
        public void ParialsumTestMethod()
        {
            int[]      array = { 3, 6, 5, 8, 7, 1, 6 };
            STDelegate st    = new STDelegate(array, (x, y) => x * y);
            var        res   = st.Query(1, 5, 1);

            Assert.AreEqual(6 * 5 * 8 * 7 * 1, res);
        }
예제 #4
0
        public void SumAllTestMethod()
        {
            int[]      array = { 3, 6, 5, 8, 7, 1, 6 };
            STDelegate st    = new STDelegate(array, (x, y) => x * y);
            var        res   = st.Query(0, array.Length - 1, 1);

            Assert.AreEqual(3 * 6 * 5 * 8 * 7 * 1 * 6, res);
        }
예제 #5
0
        public void SumAllTestMethod()
        {
            int[]      array = { 3, 6, 5, 8, 7, 1, 6 };
            STDelegate st    = new STDelegate(array, (x, y) => x + y);
            var        res   = st.Query(0, array.Length - 1, 0);

            Assert.AreEqual(array.Sum(), res);
        }
예제 #6
0
        public void ModifyParialsumTestMethod()
        {
            int[]      array = { 3, 6, 5, 8, 7, 1, 6 };
            STDelegate st    = new STDelegate(array, (x, y) => x + y);

            st.Modify(5, -9);
            var res = st.Query(1, 5, 0);

            Assert.AreEqual(17, res);
        }