Search in sources :

Example 1 with SingleResourceBProgram

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(), ""));
}
Also used : BriefPrintDfsVerifierListener(il.ac.bgu.cs.bp.bpjs.analysis.listeners.BriefPrintDfsVerifierListener) SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram) BProgram(il.ac.bgu.cs.bp.bpjs.model.BProgram) StringBProgram(il.ac.bgu.cs.bp.bpjs.model.StringBProgram) SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram) Test(org.junit.Test)

Example 2 with SingleResourceBProgram

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());
}
Also used : VerificationResult(il.ac.bgu.cs.bp.bpjs.analysis.VerificationResult) SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram) BProgram(il.ac.bgu.cs.bp.bpjs.model.BProgram) SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram) DfsBProgramVerifier(il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier) Test(org.junit.Test)

Example 3 with SingleResourceBProgram

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()));
}
Also used : PrintBProgramRunnerListener(il.ac.bgu.cs.bp.bpjs.execution.listeners.PrintBProgramRunnerListener) BProgramRunner(il.ac.bgu.cs.bp.bpjs.execution.BProgramRunner) SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram) InMemoryEventLoggingListener(il.ac.bgu.cs.bp.bpjs.execution.listeners.InMemoryEventLoggingListener) Test(org.junit.Test)

Example 4 with SingleResourceBProgram

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;
}
Also used : VerificationResult(il.ac.bgu.cs.bp.bpjs.analysis.VerificationResult) SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram) DfsBProgramVerifier(il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier)

Example 5 with SingleResourceBProgram

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;
}
Also used : SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram) BProgram(il.ac.bgu.cs.bp.bpjs.model.BProgram) SingleResourceBProgram(il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram)

Aggregations

SingleResourceBProgram (il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram)45 Test (org.junit.Test)38 BProgramRunner (il.ac.bgu.cs.bp.bpjs.execution.BProgramRunner)29 PrintBProgramRunnerListener (il.ac.bgu.cs.bp.bpjs.execution.listeners.PrintBProgramRunnerListener)26 InMemoryEventLoggingListener (il.ac.bgu.cs.bp.bpjs.execution.listeners.InMemoryEventLoggingListener)22 BProgram (il.ac.bgu.cs.bp.bpjs.model.BProgram)17 BEvent (il.ac.bgu.cs.bp.bpjs.model.BEvent)14 EventPattern (il.ac.bgu.cs.bp.bpjs.analysis.eventpattern.EventPattern)10 DfsBProgramVerifier (il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier)9 VerificationResult (il.ac.bgu.cs.bp.bpjs.analysis.VerificationResult)9 StringBProgram (il.ac.bgu.cs.bp.bpjs.model.StringBProgram)7 BriefPrintDfsVerifierListener (il.ac.bgu.cs.bp.bpjs.analysis.listeners.BriefPrintDfsVerifierListener)4 PrioritizedBSyncEventSelectionStrategy (il.ac.bgu.cs.bp.bpjs.model.eventselection.PrioritizedBSyncEventSelectionStrategy)3 BProgramStateVisitedStateStore (il.ac.bgu.cs.bp.bpjs.analysis.BProgramStateVisitedStateStore)2 Node (il.ac.bgu.cs.bp.bpjs.analysis.Node)1 BProgramRunnerListenerAdapter (il.ac.bgu.cs.bp.bpjs.execution.listeners.BProgramRunnerListenerAdapter)1 ExecutorServiceMaker (il.ac.bgu.cs.bp.bpjs.internal.ExecutorServiceMaker)1 BProgramSyncSnapshot (il.ac.bgu.cs.bp.bpjs.model.BProgramSyncSnapshot)1 FailedAssertion (il.ac.bgu.cs.bp.bpjs.model.FailedAssertion)1 LoggingEventSelectionStrategyDecorator (il.ac.bgu.cs.bp.bpjs.model.eventselection.LoggingEventSelectionStrategyDecorator)1