public void HornTest() { Model temp = new Model(); PropositionInterpreter test = new PropositionInterpreter(ref temp); string[] teststring = { "b&e => f" }; Proposition[] tester = test.ParseProps(teststring); }
public void FileInputToPaserToWorld() { FileInput input = new FileInput("./t1.txt"); Model temp = new Model(); PropositionInterpreter test = new PropositionInterpreter(ref temp); Proposition[] temper = test.ParseProps(input.ReadFromFile()); World MyWorld = new World(temper, temp.Length); }
public void BackwardChainAndImp() { FileInput input = new FileInput("./t2.txt"); Model temp = new Model(); PropositionInterpreter test = new PropositionInterpreter(ref temp); World MyWorld = new World(test.ParseProps(input.ReadFromFile()), temp.Length); BackwardsChain solver = new BackwardsChain(temp, MyWorld); solver.Start(); }
public void Full_Truth_Table_fail() { FileInput input = new FileInput("./Semicomplicated_false.txt"); Model temp = new Model(); PropositionInterpreter test = new PropositionInterpreter(ref temp); World MyWorld = new World(test.ParseProps(input.ReadFromFile()), temp.Length); TruthTable solver = new TruthTable(temp, MyWorld); Assert.AreEqual(solver.solve(), 0); }
public void TestParserIsTrue() { Model temp = new Model(); PropositionInterpreter test = new PropositionInterpreter(ref temp); string[] teststring = { "a&b" }; Proposition[] tester = test.ParseProps(teststring); bool? ans = tester[0].IsTrue(new bool?[] { true, false }); Assert.AreEqual(ans, false); }
// // You can use the following additional attributes as you write your tests: // // Use ClassInitialize to run code before running the first test in the class // [ClassInitialize()] // public static void MyClassInitialize(TestContext testContext) { } // // Use ClassCleanup to run code after all tests in a class have run // [ClassCleanup()] // public static void MyClassCleanup() { } // // Use TestInitialize to run code before running each test // [TestInitialize()] // public void MyTestInitialize() { } // // Use TestCleanup to run code after each test has run // [TestCleanup()] // public void MyTestCleanup() { } // #endregion private void setup() { model = new Model(); propintr = new PropositionInterpreter(ref model); input = new FileInput(filePath); MyWorld = new World(propintr.ParseProps(input.ReadFromFile()), model.Length); Truthsolver = new TruthTable(model, MyWorld); forwardsolver = new ForwardChain(model, MyWorld); backwardsolver = new BackwardsChain(model, MyWorld); strWriter = new StringWriter(); Console.SetOut(strWriter); }
public void TestParserRequirements_semicomplicated() { Model temp = new Model(); PropositionInterpreter test = new PropositionInterpreter(ref temp); string[] teststring = { "a|(b&~a)" }; Proposition[] tester = test.ParseProps(teststring); List <int> symbols = tester[0].Requirements(); List <int> rightAns = new List <int> { 0, 1, 0 }; CollectionAssert.AreEqual(symbols, rightAns); }
public void TestParserIsTrue_complicated() { Model temp = new Model(); PropositionInterpreter test = new PropositionInterpreter(ref temp); string[] teststring = { "(a|(~a&d))&((e<=>f)=>d)" }; Proposition[] tester = test.ParseProps(teststring); bool? ans = tester[0].IsTrue(new bool?[] { false, false, true, false, true, true }); Assert.AreEqual(ans, true); ans = tester[0].IsTrue(new bool?[] { false, false, false, false, true, false }); Assert.AreEqual(ans, false); ans = tester[0].IsTrue(new bool?[] { true, true, false, true, true, false }); Assert.AreEqual(ans, false); ans = tester[0].IsTrue(new bool?[] { true, true, false, true, true, null }); Assert.AreEqual(ans, null); }
public void setup() { model = new Model(); propintr = new PropositionInterpreter(ref model); }