X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=chase-lev-deque%2Fmain.c;h=382c62afd2025ad0d016764b8363817846df1a57;hb=fa2a8815cc3cd92359d6294d4ad8c910f2265472;hp=ee69867f2ebb37d1aa1cd4d9c0bb9f19c0ef2926;hpb=d1991f77986f3c19631073acbaf4d74a2dbd906b;p=model-checker-benchmarks.git diff --git a/chase-lev-deque/main.c b/chase-lev-deque/main.c index ee69867..382c62a 100644 --- a/chase-lev-deque/main.c +++ b/chase-lev-deque/main.c @@ -4,16 +4,17 @@ #include #include +#include "model-assert.h" + #include "deque.h" Deque *q; int a; int b; +int c; static void task(void * param) { - do { - a=steal(q); - } while(a==EMPTY); + a=steal(q); } int user_main(int argc, char **argv) @@ -23,9 +24,22 @@ int user_main(int argc, char **argv) thrd_create(&t, task, 0); push(q, 1); push(q, 2); + push(q, 4); b=take(q); + c=take(q); thrd_join(t); - if (a+b!=3) - printf("a=%d b=%d\n",a,b); + + bool correct=true; + if (a!=1 && a!=2 && a!=4 && a!= EMPTY) + correct=false; + if (b!=1 && b!=2 && b!=4 && b!= EMPTY) + correct=false; + if (c!=1 && c!=2 && c!=4 && a!= EMPTY) + correct=false; + if (a!=EMPTY && b!=EMPTY && c!=EMPTY && (a+b+c)!=7) + correct=false; + if (!correct) + printf("a=%d b=%d c=%d\n",a,b,c); + return 0; }