OSDN Git Service

original
[gb-231r1-is01/GB_2.3_IS01.git] / system / core / libacc / tests / data / film.c
diff --git a/system/core/libacc/tests/data/film.c b/system/core/libacc/tests/data/film.c
new file mode 100644 (file)
index 0000000..00c2d36
--- /dev/null
@@ -0,0 +1,53 @@
+// Test logical and bitwise AND and OR
+
+int test(int x, int y) {
+    int v = x || y;
+    return v;
+}
+
+int test2(int x, int y) {
+    if(x | y) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int test3(int x, int y) {
+    int v = x && y;
+    return v;
+}
+
+int test4(int x, int y) {
+    if(x & y) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int main(int index)
+{
+    int x,y;
+    printf("testing...\n");
+    int totalBad = 0;
+    for(y = 0; y < 2; y++) {
+        for(x = 0; x < 2; x++) {
+            int a = test(x,y);
+            int b = test2(x,y);
+            if (a != b) {
+                printf("Results differ: OR x=%d y=%d a=%d b=%d\n", x, y, a, b);
+                totalBad++;
+            }
+            a = test3(x,y);
+            b = test4(x,y);
+            if (a != b) {
+                printf("Results differ: AND x=%d y=%d a=%d b=%d\n", x, y, a, b);
+                totalBad++;
+            }
+        }
+    }
+    printf("Total bad: %d\n", totalBad);
+    return 0;
+}
+