use of il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram 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.SingleResourceBProgram 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.SingleResourceBProgram in project BPjs by bThink-BGU.
the class BProgramSyncSnapshotClonerTest method testProgramIsOk.
@Test
public void testProgramIsOk() throws InterruptedException {
BProgramRunner bpr = new BProgramRunner(new SingleResourceBProgram("BProgramSyncSnapshotClonerTest.js"));
bpr.addListener(new PrintBProgramRunnerListener());
InMemoryEventLoggingListener events = bpr.addListener(new InMemoryEventLoggingListener());
bpr.run();
events.getEvents().forEach(e -> System.out.println(e.toString()));
}
use of il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram in project BPjs by bThink-BGU.
the class DiningPhilTest method verifyPhilosophers.
private static VerificationResult verifyPhilosophers(int philosopherCount) throws InterruptedException {
// Create a program
final SingleResourceBProgram bprog = new SingleResourceBProgram("BPJSDiningPhil.js");
bprog.putInGlobalScope("PHILOSOPHER_COUNT", philosopherCount);
try {
DfsBProgramVerifier vfr = new DfsBProgramVerifier();
vfr.setMaxTraceLength(50);
final VerificationResult res = vfr.verify(bprog);
System.out.printf("Scanned %,d states\n", res.getScannedStatesCount());
System.out.printf("Time: %,d milliseconds\n", res.getTimeMillies());
return res;
} catch (Exception ex) {
ex.printStackTrace(System.out);
}
return null;
}
use of il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram 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