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());
}
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());
}
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());
}
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());
}
Aggregations