int main()
{
    static list_t list;

    int i = 0;
    int y = 0;
    int z = 0;
    int length = 0;

    while (i < 2) {

        while (y < 3 && __VERIFIER_nondet_int()) {
            append_one(&list, rand_end_point());
            y++;
            length++;
        }

        while (z < 3 && __VERIFIER_nondet_int()) {
            remove_one(&list, rand_end_point());
            z++;
            if(length > 0) {
              length--; 
            }
         }
            
         y = 0;
         z = 0;
         i++;
    }

    end_point_t end_point;
    direction_t direction;

    if (__VERIFIER_nondet_int()) {
        /* destroy the list from begin to end */
        end_point = LIST_BEG;
        direction = ITEM_NEXT;
    }
    else {
        /* destroy the list from end to begin */
        end_point = LIST_END;
        direction = ITEM_PREV;
    }

    /* now please destroy the list */
    item_p cursor = list[end_point];

    while (length > 0) {
        item_p next = (*cursor)[direction];
        free(cursor);
        cursor = next;
	length--;
    }

    return 0;
}
예제 #2
0
파일: test-0214.c 프로젝트: Orwel/forester
int main()
{
    static list_t list;

    while (__VERIFIER_nondet_int()) {
        while (__VERIFIER_nondet_int())
            append_one(&list, rand_end_point());

        while (__VERIFIER_nondet_int())
            remove_one(&list, rand_end_point());
    }

    end_point_t end_point;
    direction_t direction;

    if (__VERIFIER_nondet_int()) {
        /* destroy the list from begin to end */
        end_point = LIST_BEG;
        direction = ITEM_NEXT;
    }
    else {
        /* destroy the list from end to begin */
        end_point = LIST_END;
        direction = ITEM_PREV;
    }

    /* now please destroy the list */
    item_p cursor = list[end_point];
    while (cursor) {
        item_p next = (*cursor)[direction];
        free(cursor);
        cursor = next;
    }

    return 0;
}