Search in sources :

Example 6 with DfsBProgramVerifier

use of il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier in project BPjs by bThink-BGU.

the class VerificationResultOptionsTest method testWaitingIsNotDeadlock.

@Test
public void testWaitingIsNotDeadlock() throws Exception {
    final SingleResourceBProgram bprog = new SingleResourceBProgram("VerificationResultOptions.js");
    bprog.putInGlobalScope("addWaiter", true);
    bprog.putInGlobalScope("createDeadlock", false);
    bprog.putInGlobalScope("createFailedAssertion", false);
    DfsBProgramVerifier vfr = new DfsBProgramVerifier();
    final VerificationResult res = vfr.verify(bprog);
    assertEquals(VerificationResult.ViolationType.None, res.getViolationType());
    assertFalse(res.isCounterExampleFound());
}
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) Test(org.junit.Test)

Example 7 with DfsBProgramVerifier

use of il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier in project BPjs by bThink-BGU.

the class VerificationResultOptionsTest method testViolatingProgram.

@Test
public void testViolatingProgram() throws Exception {
    final SingleResourceBProgram bprog = new SingleResourceBProgram("VerificationResultOptions.js");
    bprog.putInGlobalScope("addWaiter", false);
    bprog.putInGlobalScope("createDeadlock", false);
    bprog.putInGlobalScope("createFailedAssertion", true);
    DfsBProgramVerifier vfr = new DfsBProgramVerifier();
    final VerificationResult res = vfr.verify(bprog);
    assertEquals(VerificationResult.ViolationType.FailedAssertion, res.getViolationType());
    assertTrue(res.isCounterExampleFound());
    assertEquals("assertor", res.getFailedAssertion().getBThreadName());
    assertEquals("B happened", res.getFailedAssertion().getMessage());
}
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) Test(org.junit.Test)

Example 8 with DfsBProgramVerifier

use of il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier in project BPjs by bThink-BGU.

the class VerificationResultOptionsTest method testDeadlockedProgram.

@Test
public void testDeadlockedProgram() throws Exception {
    final SingleResourceBProgram bprog = new SingleResourceBProgram("VerificationResultOptions.js");
    bprog.putInGlobalScope("addWaiter", false);
    bprog.putInGlobalScope("createDeadlock", true);
    bprog.putInGlobalScope("createFailedAssertion", false);
    DfsBProgramVerifier vfr = new DfsBProgramVerifier();
    final VerificationResult res = vfr.verify(bprog);
    assertEquals(VerificationResult.ViolationType.Deadlock, res.getViolationType());
    assertTrue(res.isCounterExampleFound());
}
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) Test(org.junit.Test)

Example 9 with DfsBProgramVerifier

use of il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier in project BPjs by bThink-BGU.

the class VerificationResultOptionsTest method testOKProgram.

@Test
public void testOKProgram() throws Exception {
    final SingleResourceBProgram bprog = new SingleResourceBProgram("VerificationResultOptions.js");
    bprog.putInGlobalScope("addWaiter", false);
    bprog.putInGlobalScope("createDeadlock", false);
    bprog.putInGlobalScope("createFailedAssertion", false);
    DfsBProgramVerifier vfr = new DfsBProgramVerifier();
    final VerificationResult res = vfr.verify(bprog);
    assertEquals(VerificationResult.ViolationType.None, res.getViolationType());
    assertFalse(res.isCounterExampleFound());
}
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) Test(org.junit.Test)

Aggregations

DfsBProgramVerifier (il.ac.bgu.cs.bp.bpjs.analysis.DfsBProgramVerifier)9 VerificationResult (il.ac.bgu.cs.bp.bpjs.analysis.VerificationResult)8 SingleResourceBProgram (il.ac.bgu.cs.bp.bpjs.model.SingleResourceBProgram)8 Test (org.junit.Test)5 BProgramStateVisitedStateStore (il.ac.bgu.cs.bp.bpjs.analysis.BProgramStateVisitedStateStore)3 BriefPrintDfsVerifierListener (il.ac.bgu.cs.bp.bpjs.analysis.listeners.BriefPrintDfsVerifierListener)2 BProgram (il.ac.bgu.cs.bp.bpjs.model.BProgram)2 ForgetfulVisitedStateStore (il.ac.bgu.cs.bp.bpjs.analysis.ForgetfulVisitedStateStore)1 Node (il.ac.bgu.cs.bp.bpjs.analysis.Node)1 PrioritizedBSyncEventSelectionStrategy (il.ac.bgu.cs.bp.bpjs.model.eventselection.PrioritizedBSyncEventSelectionStrategy)1