@Test
  public void hitSameStateThroughDifferentSearchPaths() {
    if (verifyNoPropertyViolation(LISTENER)) {
      Verify.getBoolean();

      synchronized (this) {
      }

      Verify.getBoolean();
    }
  }
Beispiel #2
0
 public void move() {
   if (side == Torch.side) {
     if (!Verify.getBoolean()) {
       Bridge.tryToCross(this);
     }
   }
 }
  public static void testDriver(int length) {
    BankAccount b = new BankAccount(0);
    for (int i = 0; i < length; i++) {
      Verify.beginAtomic();

      // switch (Verify.random(1)){
      switch (flag(true)) {
        case 0:
          b.deposit(10);
          break;
        case 1:
          b.withdraw(1);
          break;
      }
      Verify.endAtomic();
    }
  }
 public static void testDriver(int length) {
   Stack s = new Stack();
   System.out.println("before loop");
   for (int i = 0; i < length; i++) {
     Verify.beginAtomic();
     switch (Verify.random(1)) {
       case 0:
         System.out.println(i + "0");
         s.push(0);
         break;
       case 1:
         System.out.println(i + "1");
         s.pop(0);
         break;
     }
     Verify.endAtomic();
     // Verify.ignoreIf(Debug.matchAbstractState(s));
   }
 }
Beispiel #5
0
  public static void testDriver(int length) {
    BST t = new BST();

    for (int i = 0; i < length; i++) {
      Verify.beginAtomic();
      switch (Verify.random(1)) {
        case 0:
          System.out.println("adding...");
          t.add(0);
          break;
        case 1:
          System.out.println("removing...");
          t.remove(0);
          break;
        case 2:
          System.out.println("finding...");
          t.find(0);
          break;
      }
      Verify.endAtomic();

      Verify.ignoreIf(Subsumption.storeAndCheckSubsumption());
    }
  }
Beispiel #6
0
  public static void main(String[] args) {
    // Verify.beginAtomic();

    // when natives are used one can record the minimal value found so
    // far to get a better one on the next execution - this
    // requires the -mulitple-errors option and then the last error
    // found must be replayed
    boolean isNative = false;

    if (isNative) {
      setTotal(30); // set to value larger than solution (17)
    }

    int total = 0;
    boolean finished = false;
    Bridge.initBridge();

    Person p1 = new Person(1, 1);
    Person p2 = new Person(2, 2);
    Person p3 = new Person(3, 5);
    Person p4 = new Person(4, 10);
    // Verify.endAtomic();

    while (!finished) {
      // Verify.beginAtomic();
      p1.move();
      p2.move();
      p3.move();
      p4.move();

      if (Bridge.isFull()) {
        total += Bridge.Cross();

        if (isNative) {
          Verify.ignoreIf(total > getTotal());
        } else {
          Verify.ignoreIf(total > 17); // with this DFS will also find error
        }

        Bridge.clearBridge();

        // printConfig(p1,p2,p3,p4,total);
        finished = !(p1.side || p2.side || p3.side || p4.side);
      }

      // Verify.endAtomic();
    }

    // Verify.beginAtomic();

    if (isNative) {
      if (total < getTotal()) {
        System.out.println("new total " + total);
        setTotal(total);
        assert (total > getTotal());
      }
    } else {
      System.out.println("total time = " + total);
      assert (total > 17);
    }

    // Verify.endAtomic();
  }