示例#1
0
        public static IList<FilterTestMultiStmtExecution> Executions(bool withStats)
        {
            IList<FilterTestMultiStmtPermutable> cases = new List<FilterTestMultiStmtPermutable>();

            var stats = FilterTestMultiStmtAssertStats.MakeSingleStat("P0=(fh:1, fi:4),P1=(fh:0, fi:0, fipar:0)");

            // simple four-param equals
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive=1, LongPrimitive=10, DoublePrimitive=100, BoolPrimitive=true",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 10, 100, true), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 10, 100, false), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 0, 10, 100, true), false));

            // add boolean-expr
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive=1, LongPrimitive=10, DoublePrimitive=100, TheString like 'A%'",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 10, 100), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("B", 1, 10, 100), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 10, 0), false));

            return FilterTestMultiStmtRunner.ComputePermutations(
                typeof(ExprFilterPlanOneFilterNestedFourLvl),
                new PermutationSpec(true),
                cases,
                withStats);
        }
示例#2
0
        public static IList<FilterTestMultiStmtExecution> Executions(bool withStats)
        {
            IList<FilterTestMultiStmtPermutable> cases = new List<FilterTestMultiStmtPermutable>();

            var stats = FilterTestMultiStmtAssertStats.MakeTwoSameStat(
                "P0=(fh:1, fi:2),P1=(fh:2, fi:3),P2=(fh:1, fi:2),P3=(fh:0, fi:0, fipar:0)");

            // same equals-indexes
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "TheString != 'x' and TheString != 'y' and DoubleBoxed is not null",
                "TheString != 'x' and TheString != 'y' and LongBoxed is not null",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBeanWBoxed("E1", -1, null, null), false, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBeanWBoxed("x", -1, 1d, 1L), false, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBeanWBoxed("x", -1, 1d, null), false, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBeanWBoxed("y", -1, 1d, 1L), false, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBeanWBoxed("E2", -1, 1d, 1L), true, true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBeanWBoxed("E3", -1, 1d, null), true, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBeanWBoxed("E4", -1, null, 1L), false, true));

            // we permute only [0, 1] as all filters are the same
            return FilterTestMultiStmtRunner.ComputePermutations(
                typeof(ExprFilterPlanTwoFilterNestedTwoDiff),
                new PermutationSpec(0, 1),
                cases,
                withStats);
        }
示例#3
0
        public static IList<FilterTestMultiStmtExecution> Executions(bool withStats)
        {
            IList<FilterTestMultiStmtPermutable> cases = new List<FilterTestMultiStmtPermutable>();

            // Permutations:
            // [0, 1, 2]
            // [0, 2, 1]
            // [1, 0, 2]
            // [1, 2, 0]
            // [2, 0, 1]
            // [2, 1, 0]

            var perm012 =
                "P0=(fh:1, fi:1),P1=(fh:2, fi:2),P2=(fh:3, fi:3),P3=(fh:2, fi:3),P4=(fh:1, fi:3),P5=(fh:0, fi:0, fipar:0)";
            var perm021 =
                "P0=(fh:1, fi:1),P1=(fh:2, fi:3),P2=(fh:3, fi:3),P3=(fh:2, fi:3),P4=(fh:1, fi:2),P5=(fh:0, fi:0, fipar:0)";
            var perm102 =
                "P0=(fh:1, fi:2),P1=(fh:2, fi:2),P2=(fh:3, fi:3),P3=(fh:2, fi:3),P4=(fh:1, fi:3),P5=(fh:0, fi:0, fipar:0)";
            var perm120 =
                "P0=(fh:1, fi:2),P1=(fh:2, fi:3),P2=(fh:3, fi:3),P3=(fh:2, fi:3),P4=(fh:1, fi:1),P5=(fh:0, fi:0, fipar:0)";
            var perm201 =
                "P0=(fh:1, fi:3),P1=(fh:2, fi:3),P2=(fh:3, fi:3),P3=(fh:2, fi:2),P4=(fh:1, fi:2),P5=(fh:0, fi:0, fipar:0)";
            var perm210 =
                "P0=(fh:1, fi:3),P1=(fh:2, fi:3),P2=(fh:3, fi:3),P3=(fh:2, fi:2),P4=(fh:1, fi:1),P5=(fh:0, fi:0, fipar:0)";
            FilterTestMultiStmtAssertStats[] reuseStats = {
                new FilterTestMultiStmtAssertStats(perm012, 0, 1, 2),
                new FilterTestMultiStmtAssertStats(perm021, 0, 2, 1),
                new FilterTestMultiStmtAssertStats(perm102, 1, 0, 2),
                new FilterTestMultiStmtAssertStats(perm120, 1, 2, 0),
                new FilterTestMultiStmtAssertStats(perm201, 2, 0, 1),
                new FilterTestMultiStmtAssertStats(perm210, 2, 1, 0)
            };

            // equals
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                reuseStats,
                "IntPrimitive = 1",
                "IntPrimitive = 1 and LongPrimitive = 10",
                "IntPrimitive = 1 and LongPrimitive = 10 and DoublePrimitive=100",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E1", 1, 10, 100), true, true, true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E2", 0, 10, 100), false, false, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E2", 1, 0, 100), true, false, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E3", 1, 10, 0), true, true, false));

            return FilterTestMultiStmtRunner.ComputePermutations(
                typeof(ExprFilterPlanThreeFilterIndexReuse),
                new PermutationSpec(2, 1, 0),
                cases,
                withStats);
        }
        public static IList<FilterTestMultiStmtExecution> Executions(bool withStats)
        {
            IList<FilterTestMultiStmtPermutable> cases = new List<FilterTestMultiStmtPermutable>();

            var stats = FilterTestMultiStmtAssertStats.MakeSingleStat("P0=(fh:1,fi:3),P1=(fh:0,fi:0,fipar:0)");

            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "TheString = 'A' and (IntPrimitive = 0 or LongPrimitive = 0)",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 0, 1), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 0), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 1), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("B", 0, 0), false));

            return FilterTestMultiStmtRunner.ComputePermutations(
                typeof(ExprFilterPlanOneFilterTwoPathNested),
                new PermutationSpec(true),
                cases,
                withStats);
        }
        public static IList<FilterTestMultiStmtExecution> Executions(bool withStats)
        {
            IList<FilterTestMultiStmtPermutable> cases = new List<FilterTestMultiStmtPermutable>();

            var stats = FilterTestMultiStmtAssertStats.MakeTwoSameStat(
                "P0=(fh:1, fi:1),P1=(fh:2, fi:1),P2=(fh:1, fi:1),P3=(fh:0, fi:0, fipar:0)");

            // same equals-index, different value
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive = 0",
                "IntPrimitive = 1",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E1", 0), true, false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E2", 1), false, true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E3", -1), false, false));

            return FilterTestMultiStmtRunner.ComputePermutations(
                typeof(ExprFilterPlanTwoFilterDifferent),
                new PermutationSpec(true),
                cases,
                withStats);
        }
示例#6
0
        public static IList<FilterTestMultiStmtExecution> Executions(bool withStats)
        {
            IList<FilterTestMultiStmtPermutable> cases = new List<FilterTestMultiStmtPermutable>();

            var stats = FilterTestMultiStmtAssertStats.MakeSingleStat("P0=(fh:1, fi:2),P1=(fh:0, fi:0, fipar:0)");

            // simple two-param equals and not-equals
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive=1, LongPrimitive=10",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 10), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 0), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 0, 10), false));

            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive != 0, LongPrimitive != 1",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E1", 0, 1), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E2", -1, -1), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E3", 0, -1), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E4", -1, 1), false));

            // simple two-param greater
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive>1, LongPrimitive>10",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1, 10), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 2, 11), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 2, 10), false));

            // two-param range
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive between 0 and 2, LongPrimitive between 0 and 2",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E1", 0, 1), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E2", 0, 2), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E3", 2, 0), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E10", 5, 1), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E11", 1, 5), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E12", -1, -1), false));

            // two-param 'in'
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive in (0,1), LongPrimitive in (2, 3)",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E1", 0, 2), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E2", 1, 3), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E3", 0, 3), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E10", 2, 2), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E11", 1, 4), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E12", -1, -1), false));

            // two-param 'not-in'
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive not in (0,1), LongPrimitive not in (2, 3)",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E1", 2, 0), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E2", -1, -1), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E3", 3, 1), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E10", 0, 2), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E11", 1, 4), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("E12", -1, 2), false));

            // equals with boolean
            FilterTestMultiStmtPermutable.AddCase(
                cases,
                stats,
                "IntPrimitive=1 and TheString like 'A%B'",
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A B", 1), true),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A", 1), false),
                FilterTestMultiStmtAssertItem.MakeItem(SupportBean.MakeBean("A B", 0), false));

            return FilterTestMultiStmtRunner.ComputePermutations(
                typeof(ExprFilterPlanOneFilterNestedTwoLvl),
                new PermutationSpec(true),
                cases,
                withStats);
        }