@Test public void test() { Node node = Suite.parse("AND (OR (VAR A) (VAR B)) (OR (NOT (VAR A)) (VAR C))"); List<Node> results = new SldResolution().resolve(node); System.out.println(results); assertTrue(results != Atom.NIL); }
@Test public void testAssemble() { boolean isProverTrace0 = Suite.isProverTrace; Suite.isProverTrace = true; try { Assembler assembler = new Assembler(32); assembler.assemble(Suite.parse(".org = 0, .l LEA (EAX, `EAX * 4 + (0 - 4)`),")); } finally { Suite.isProverTrace = isProverTrace0; } }
@Test public void testSubstitute() { String fp0 = "" // + "use SUITE >> chars:\"1 + 2\" \n" // + "| suite-parse \n" // + "| (n => suite-substitute {chars:\"fn {.0}\"} {n;}) \n" // + "| suite-to-chars"; Node n = Suite.evaluateFun(fp0, true); assertEquals("fn {1 + 2}", Data.get(n).toString()); }
@Test public void testMatch() { String fp0 = "" // + "use SUITE >> chars:\"1 + 2\" \n" // + "| suite-parse \n" // + "| suite-match {chars:\".0 + .1\"} \n" // + "| (`$n0; _;` => n0) \n" // + "| suite-to-chars \n" // + "| cs-to-string"; assertEquals("49;", Suite.evaluateFun(fp0, true).toString()); }
@Test public void testAssemblePerformance() { Assembler assembler = new Assembler(32); for (int i = 0; i < 4096; i++) assembler.assemble(Suite.parse(".org = 0, .l CLD (),")); }
@Test public void testAssembleMisc() throws IOException { Assembler assembler = new Assembler(32, true); assembler.assemble(Suite.parse(".org = 0, _ JMP (BYTE .label), .label (),")); }
@Test public void testAssembleLongMode() throws IOException { Assembler assembler = new Assembler(32, true); Bytes bytes = assembler.assemble(Suite.parse(".org = 0, .l MOV (R9D, DWORD 16),")); assertEquals(bytes.size(), 7); }
private String eval(Node node) throws IOException { StringWriter sw = new StringWriter(); Node node1 = Suite.substitute("use MONAD >> .0", Suite.applyWriter(node)); Suite.evaluateFunToWriter(Suite.fcc(node1, true), sw); return sw.toString(); }
private String evalMonad(String m, String type) throws IOException { return eval(Suite.applyPerform(Suite.parse(m), Suite.parse(type))); }
public ProverConfig() { this(Suite.createRuleSet()); }