//[TestCase(new[] { "Race([y])!=Race([x])", "Strength([x])>=Strength([y])", "[x]!=[y]" }, true, null)] //[TestCase(new[] { "Race([y])!=Race([x])", "Strength([x])>=Strength([y])", "[x]!=[y]", "#[x]=3" }, true, null)] //[TestCase(new[] { "Race([y])!=Race([x])", "Strength([x])>=Strength([y])", "[x]!=[y]", "Count([x])=3", "Count([y])=5" }, true, null)] //[TestCase(new[] { "Count(Like([x]))=0" }, true, null)] public void Test_ConditionSet(string[] conditions, bool result, string[] constraints) { var set = constraints != null?new[] { new SubstitutionSet(constraints.Select(c => new Substitution(c))) }:null; var conds = new ConditionSet(conditions.Select(Condition.Parse)); Assert.AreEqual(result, conds.Evaluate(_kb, Name.SELF_SYMBOL, set)); }
public void ConditionEvaluatorSet_Test_Universal_Pass(params string[] beliefs) { var kb = new KB((Name)"Me"); foreach (var s in beliefs.Select(b => b.Split(':'))) kb.Tell((Name)s[0], (Name)s[1]); var set = new ConditionSet(LogicalQuantifier.Universal, TEST_CONDITIONS); Assert.True(set.Evaluate(kb, Name.SELF_SYMBOL, null)); }
public void ConditionEvaluatorSet_Test_Universal_Pass(params string[] beliefs) { var kb = new KB((Name)"Me"); foreach (var s in beliefs.Select(b => b.Split(':'))) { kb.Tell((Name)s[0], PrimitiveValue.Parse(s[1])); } var set = new ConditionSet(LogicalQuantifier.Universal, TEST_CONDITIONS); Assert.True(set.Evaluate(kb, Name.SELF_SYMBOL, null)); }
public void Test_ConditionSet(string[] conditions, bool result, string[] constraints) { var set = constraints!=null?new[]{new SubstitutionSet(constraints.Select(c => new Substitution(c)))}:null; var conds = new ConditionSet(conditions.Select(Condition.Parse)); Assert.AreEqual(result, conds.Evaluate(_kb, Name.SELF_SYMBOL, set)); }