bench.sh: rearrange order again
[model-checker-benchmarks.git] / chase-lev-deque / main.c
index c744b47020c25872f7fb4947cdff32cd1cb5cc75..f2e8dca8b17f5a628a35992a3a26ab714bf4d81b 100644 (file)
@@ -3,7 +3,6 @@
 #include <stdio.h>
 #include <threads.h>
 #include <stdatomic.h>
-#include <stdio.h>
 
 #include "model-assert.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)
@@ -26,11 +24,23 @@ 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);
 
-       printf("a=%d b=%d\n",a,b);
-       MODEL_ASSERT(a + b == 3);
+       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;
 }