use of il.ac.bgu.cs.bp.bpjs.model.BProgram in project BPjs by bThink-BGU.
the class DfsBProgramVerifierTest method testTwoLoopingBThreads.
@Test(timeout = 2000)
public void testTwoLoopingBThreads() throws Exception {
BProgram bprog = new StringBProgram("bp.registerBThread('bt1', function(){" + " while(true){\n" + " bsync({ request:[ bp.Event(\"STAM1\") ] });\n" + "}});\n" + "bp.registerBThread('bt2', function(){" + " while(true){\n" + " bsync({ request:[ bp.Event(\"STAM2\") ] });\n" + "}});\n" + "");
DfsBProgramVerifier sut = new DfsBProgramVerifier();
sut.setIterationCountGap(1);
sut.setProgressListener(new BriefPrintDfsVerifierListener());
sut.setDebugMode(true);
VerificationResult res = sut.verify(bprog);
assertFalse(res.isCounterExampleFound());
assertEquals(1, res.getScannedStatesCount());
}
use of il.ac.bgu.cs.bp.bpjs.model.BProgram in project BPjs by bThink-BGU.
the class DfsBProgramVerifierTest method testTwoSimpleBThreads.
@Test
public void testTwoSimpleBThreads() throws Exception {
BProgram bprog = new StringBProgram("bp.registerBThread('bt1', function(){bsync({ request:[ bp.Event(\"STAM1\") ] });});" + "bp.registerBThread('bt2', function(){bsync({ request:[ bp.Event(\"STAM2\") ] });});");
DfsBProgramVerifier sut = new DfsBProgramVerifier();
sut.setIterationCountGap(1);
sut.setProgressListener(new BriefPrintDfsVerifierListener());
sut.setDetectDeadlocks(false);
VerificationResult res = sut.verify(bprog);
assertTrue(res.isVerifiedSuccessfully());
assertEquals(3, res.getScannedStatesCount());
assertEquals(VerificationResult.ViolationType.None, res.getViolationType());
}
use of il.ac.bgu.cs.bp.bpjs.model.BProgram in project BPjs by bThink-BGU.
the class DfsBProgramVerifierTest method simpleAAABTrace_hashedNodeStore.
@Test
public void simpleAAABTrace_hashedNodeStore() throws Exception {
BProgram program = new SingleResourceBProgram("AAABTrace.js");
DfsBProgramVerifier sut = new DfsBProgramVerifier();
sut.setProgressListener(new BriefPrintDfsVerifierListener());
program.appendSource(Requirements.eventNotSelected("B"));
sut.setVisitedNodeStore(new BProgramStateVisitedStateStore(true));
VerificationResult res = sut.verify(program);
assertTrue(res.isCounterExampleFound());
assertEquals("AAAB", traceEventNamesString(res.getCounterExampleTrace(), ""));
}
use of il.ac.bgu.cs.bp.bpjs.model.BProgram in project BPjs by bThink-BGU.
the class BProgramSyncSnapshotClonerTest method verifyProgram.
@Test
public void verifyProgram() throws Exception {
DfsBProgramVerifier vfr = new DfsBProgramVerifier();
BProgram bprog = new SingleResourceBProgram("BProgramSyncSnapshotClonerTest.js");
final VerificationResult res = vfr.verify(bprog);
System.out.println("res = " + res.getCounterExampleTrace());
}
use of il.ac.bgu.cs.bp.bpjs.model.BProgram in project BPjs by bThink-BGU.
the class StateStorePerformanceComparison method makeBProgram.
private static BProgram makeBProgram() {
// prepare b-program
final BProgram bprog = new SingleResourceBProgram(IMPLEMENTATION);
bprog.putInGlobalScope("MAZE_NAME", MAZE_NAME);
bprog.putInGlobalScope("TARGET_FOUND_EVENT", TARGET_FOUND_EVENT);
bprog.appendSource(Requirements.eventNotSelected(TARGET_FOUND_EVENT.getName()));
return bprog;
}
Aggregations