X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=chase-lev-deque-bugfix%2Fmain.c;fp=chase-lev-deque-bugfix%2Fmain.c;h=f2e8dca8b17f5a628a35992a3a26ab714bf4d81b;hb=595a5a86d894685c1b39ee467599654f8c2a46b5;hp=0000000000000000000000000000000000000000;hpb=a3b1bb7758e8213a6a9972311664d98ca17b1ecf;p=model-checker-benchmarks.git diff --git a/chase-lev-deque-bugfix/main.c b/chase-lev-deque-bugfix/main.c new file mode 100644 index 0000000..f2e8dca --- /dev/null +++ b/chase-lev-deque-bugfix/main.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include + +#include "model-assert.h" + +#include "deque.h" + +Deque *q; +int a; +int b; +int c; + +static void task(void * param) { + a=steal(q); +} + +int user_main(int argc, char **argv) +{ + thrd_t t; + q=create(); + thrd_create(&t, task, 0); + push(q, 1); + push(q, 2); + push(q, 4); + b=take(q); + c=take(q); + thrd_join(t); + + 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); + MODEL_ASSERT(correct); + + return 0; +}