Search in sources :

Example 1 with OP

use of edu.cmu.ml.proppr.prove.wam.Instruction.OP in project ProPPR by TeamCohen.

the class WamProgramTest method testLoad.

@Test
public void testLoad() throws IOException {
    WamProgram program = WamBaseProgram.load(new File(SimpleProgramProverTest.PROGRAM));
    OP[] simpleProgram = { OP.comment, OP.allocate, OP.initfreevar, OP.initfreevar, OP.fclear, OP.fpushstart, OP.fpushconst, OP.fpushconst, OP.fpushconst, OP.freport, OP.pushboundvar, OP.pushfreevar, OP.callp, OP.pushboundvar, OP.pushboundvar, OP.callp, OP.returnp, OP.comment, OP.allocate, OP.initfreevar, OP.initfreevar, OP.fclear, OP.fpushstart, OP.fpushconst, OP.fpushconst, OP.fpushconst, OP.freport, OP.pushboundvar, OP.callp, OP.pushboundvar, OP.pushboundvar, OP.callp, OP.returnp, OP.comment, OP.unifyconst, OP.unifyconst, OP.fclear, OP.fpushstart, OP.fpushconst, OP.fpushconst, OP.fpushconst, OP.freport, OP.returnp, OP.comment, OP.unifyconst, OP.unifyconst, OP.fclear, OP.fpushstart, OP.fpushconst, OP.fpushconst, OP.fpushconst, OP.freport, OP.returnp, OP.comment, OP.unifyconst, OP.fclear, OP.fpushstart, OP.fpushconst, OP.fpushconst, OP.fpushconst, OP.freport, OP.returnp };
    assertEquals(simpleProgram.length, program.size());
    for (int i = 0; i < simpleProgram.length; i++) {
        assertEquals("Instruction " + i, simpleProgram[i], program.getInstruction(i).opcode);
    }
    assertTrue(program.hasLabel("coworker/2"));
    List<Integer> addr = program.getAddresses("coworker/2");
    assertEquals("coworker/2", 1, addr.get(0).intValue());
    assertTrue(program.hasLabel("employee/2"));
    addr = program.getAddresses(("employee/2"));
    assertEquals("employee/2", 18, addr.get(0).intValue());
}
Also used : OP(edu.cmu.ml.proppr.prove.wam.Instruction.OP) WamProgram(edu.cmu.ml.proppr.prove.wam.WamProgram) File(java.io.File) Test(org.junit.Test)

Aggregations

OP (edu.cmu.ml.proppr.prove.wam.Instruction.OP)1 WamProgram (edu.cmu.ml.proppr.prove.wam.WamProgram)1 File (java.io.File)1 Test (org.junit.Test)1