use of suite.lp.Configuration.ProverConfig in project suite by stupidsing.
the class MapifyTest method testMapify.
@Test
public void testMapify() {
ProverConfig pc0 = new ProverConfig();
pc0.setRuleSet(null);
Object map = mapify.mapify(ProverConfig.class, pc0);
assertNotNull(map);
System.out.println(map);
ProverConfig pc1 = mapify.unmapify(ProverConfig.class, map);
System.out.println(pc1);
assertEquals(pc0, pc1);
assertTrue(pc0.hashCode() == pc1.hashCode());
}
use of suite.lp.Configuration.ProverConfig in project suite by stupidsing.
the class LogicCompilerLevel2Test method test1.
@Test
public void test1() throws IOException {
RuleSet rs = Suite.newRuleSet(List.of("auto.sl"));
Builder builder = CompiledProverBuilder.level2(new ProverConfig());
Suite.evaluateLogic(builder, rs, "(), sink ()");
}
use of suite.lp.Configuration.ProverConfig in project suite by stupidsing.
the class ProverFactoryTest method test.
private void test(String query, boolean result) {
for (ProverFactory pf : new ProverFactory[] { //
new CompileProverImpl(), new SewingProverImpl(Suite.newRuleSet(List.of("auto.sl"))) }) {
Prove_ p = pf.prover(Suite.parse(query));
assertEquals(result, p.test(new ProverConfig()));
}
}
use of suite.lp.Configuration.ProverConfig 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.Configuration.ProverConfig 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));
}
Aggregations