Exemplo n.º 1
0
        public void WhenNotEqualsConstraintExists_givenPairwiseDisjunctive_thenConstraintIsRedundand()
        {
            var variables = new List <Variable>()
            {
                new Variable("A", null),
                new Variable("B", null)
            };
            var domains = new List <Domain>
            {
                new Domain("red", 1),
                new Domain("blue", 2)
            };
            var constraints = new List <Constraint>
            {
                new Constraint(1, variables[0], CompareEnum.NotEquals, variables[1])
            };

            Approvals.Verify(ConstraintManager.GetRedundandConstraints(constraints, true).ToPrettyString());
        }
Exemplo n.º 2
0
        public void WhenConstraintIsSame_ThenConstraintIsRedundand()
        {
            var variables = new List <Variable>()
            {
                new Variable("A", null),
                new Variable("B", null)
            };
            var domains = new List <Domain>
            {
                new Domain("red", 1),
                new Domain("blue", 2)
            };
            var constraints = new List <Constraint>
            {
                new Constraint(1, variables[0], CompareEnum.Greater, variables[1]),
                new Constraint(2, variables[0], CompareEnum.Greater, variables[1])
            };

            Approvals.Verify(ConstraintManager.GetRedundandConstraints(constraints, true).ToPrettyString());
        }
Exemplo n.º 3
0
        public void WhenA_g_B_and_B_g_C_and_A_not_C_Then_nothing_isRedundand()
        {
            var variables = new List <Variable>()
            {
                new Variable("A", null),
                new Variable("B", null),
                new Variable("C", null)
            };
            var domains = new List <Domain>
            {
                new Domain("red", 1),
                new Domain("blue", 2)
            };
            var constraints = new List <Constraint>
            {
                new Constraint(1, variables[0], CompareEnum.Greater, variables[1]),
                new Constraint(2, variables[1], CompareEnum.Greater, variables[2]),
                new Constraint(2, variables[0], CompareEnum.NotEquals, variables[2])
            };

            Approvals.Verify(ConstraintManager.GetRedundandConstraints(constraints, false).ToPrettyString());
        }
Exemplo n.º 4
0
        public void WhenB_s_A_and_C_s_B_and_C_s_A_ThenC_s_A_isRedundand()
        {
            var variables = new List <Variable>()
            {
                new Variable("A", null),
                new Variable("B", null),
                new Variable("C", null)
            };
            var domains = new List <Domain>
            {
                new Domain("red", 1),
                new Domain("blue", 2)
            };
            var constraints = new List <Constraint>
            {
                new Constraint(1, variables[1], CompareEnum.Smaller, variables[0]),
                new Constraint(2, variables[2], CompareEnum.Smaller, variables[1]),
                new Constraint(2, variables[2], CompareEnum.Smaller, variables[0])
            };

            Approvals.Verify(ConstraintManager.GetRedundandConstraints(constraints, false).ToPrettyString());
        }
Exemplo n.º 5
0
        public void WhenInvertedChainA_to_D_and_A_g_D_ThenA_g_D_isRedundand()
        {
            var variables = new List <Variable>()
            {
                new Variable("A", null),
                new Variable("B", null),
                new Variable("C", null),
                new Variable("D", null)
            };
            var domains = new List <Domain>
            {
                new Domain("red", 1),
                new Domain("blue", 2)
            };
            var constraints = new List <Constraint>
            {
                new Constraint(1, variables[0], CompareEnum.Greater, variables[1]),
                new Constraint(2, variables[2], CompareEnum.Smaller, variables[1]),
                new Constraint(3, variables[2], CompareEnum.Greater, variables[3]),
                new Constraint(4, variables[0], CompareEnum.Greater, variables[3])
            };

            Approvals.Verify(ConstraintManager.GetRedundandConstraints(constraints, false).ToPrettyString());
        }