use of suite.lp.sewing.impl.SewingProverImpl in project suite by stupidsing.
the class SewingProverTest method testIf.
@Test
public void testIf() {
RuleSet rs = Suite.newRuleSet();
ProverFactory sp = new SewingProverImpl(rs);
ProverConfig pc = new ProverConfig(rs);
assertTrue(sp.prover(Suite.parse("if () () fail")).test(pc));
assertFalse(sp.prover(Suite.parse("if () fail ()")).test(pc));
assertTrue(sp.prover(Suite.parse("if fail fail ()")).test(pc));
assertFalse(sp.prover(Suite.parse("if fail () fail")).test(pc));
}
use of suite.lp.sewing.impl.SewingProverImpl in project suite by stupidsing.
the class SewingProverTest method test.
@Test
public void test() {
RuleSet rs = Suite.newRuleSet();
Suite.addRule(rs, "yes");
ProverFactory sp = new SewingProverImpl(rs);
ProverConfig pc = new ProverConfig(rs);
assertTrue(sp.prover(Suite.parse("yes")).test(pc));
assertTrue(sp.prover(Suite.parse("fail; yes")).test(pc));
assertTrue(sp.prover(Suite.parse("yes; yes")).test(pc));
assertFalse(sp.prover(Suite.parse("yes, fail")).test(pc));
assertFalse(sp.prover(Suite.parse("!, fail; yes")).test(pc));
assertTrue(sp.prover(new Generalizer().generalize(Suite.parse("(.v = 1; .v = 2), .v = 2"))).test(pc));
assertFalse(sp.prover(new Generalizer().generalize(Suite.parse("once (.v = 1; .v = 2), .v = 2"))).test(pc));
assertFalse(sp.prover(Suite.parse("not yes")).test(pc));
assertTrue(sp.prover(Suite.parse("not fail")).test(pc));
assertTrue(sp.prover(new Generalizer().generalize(Suite.parse(".p = yes, .p"))).test(pc));
}
use of suite.lp.sewing.impl.SewingProverImpl in project suite by stupidsing.
the class SewingProverTest method testCut.
@Test
public void testCut() {
RuleSet rs = Suite.newRuleSet();
Suite.addRule(rs, "a :- b");
Suite.addRule(rs, "a");
Suite.addRule(rs, "b :- !, fail");
ProverFactory sp = new SewingProverImpl(rs);
ProverConfig pc = new ProverConfig(rs);
assertTrue(sp.prover(Suite.parse("a")).test(pc));
}
use of suite.lp.sewing.impl.SewingProverImpl in project suite by stupidsing.
the class SewingProverTest method testEnv.
@Test
public void testEnv() {
RuleSet rs = Suite.newRuleSet();
Suite.addRule(rs, "a :- b .a, b .b");
Suite.addRule(rs, "b 1");
ProverFactory sp = new SewingProverImpl(rs);
ProverConfig pc = new ProverConfig(rs);
assertTrue(sp.prover(Suite.parse("a")).test(pc));
}
Aggregations