예제 #1
0
int main() {
  int i = 0;
  elem *arrayOne;
  elem *arrayTwo;

  arraySize = __SMACK_nondet();
  __SMACK_assume(arraySize > 0);

  arrayOne = (elem*)malloc(arraySize * sizeof(elem));
  arrayTwo = (elem*)malloc(arraySize * sizeof(elem));

  resetArray(arrayOne);
  setArray(arrayTwo);
  initializeCount(arrayTwo);

  for (i = 0; i < arraySize; i++) {
    __SMACK_assert(arrayOne[i].status == RESET);
    __SMACK_assert(arrayTwo[i].status == SET);
    __SMACK_assert(arrayTwo[i].count == 0);
  }

  initializeCount(arrayOne);
  setArray(arrayOne);
  resetArray(arrayTwo);

  for (i = arraySize - 1; i >= 0; i--) {
    __SMACK_assert(arrayOne[i].count != 0 || arrayOne[i].status != SET || arrayTwo[i].status != RESET);
  }

  free(arrayOne);
  free(arrayTwo);
  return 0;
}
예제 #2
0
int main() {
  int x = __SMACK_nondet();

  if (x == 0) {
    goto ERROR;
  } else {
    goto out;
  }

  out:
    return 0;
  ERROR:
    return 0;
}
예제 #3
0
파일: func_ptr1.c 프로젝트: fvila/smack
int main() {
  int (*fp)(int);
  int x;

  x = 0;
  if (__SMACK_nondet()) {
    fp = incr;
  } else {
    fp = decr;
  }
  x = fp(x);

  __SMACK_assert(x == 1 || x == -1);

  return 0;
}
예제 #4
0
void *t1(void *arg) 
{
  int i;
  unsigned int tmp;

  for(i=0; i<SIZE; i++)
  {
    pthread_mutex_lock(&m);
    //tmp = __VERIFIER_nondet_uint()%SIZE;
    tmp = __SMACK_nondet();
    if( tmp < 0) {
      tmp *= -1;
    }
    assume(0 <= tmp < SIZE);
    assert(push(arr,tmp)!=OVERFLOW);
    pthread_mutex_unlock(&m);
  }
}