[llvm-commits] CVS: llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c

Vikram Adve vadve at cs.uiuc.edu
Tue Jul 8 10:42:01 PDT 2003


Changes in directory llvm/test/Programs/SingleSource/UnitTests:

2003-05-31-CastToBool.c updated: 1.1 -> 1.2

---
Log message:

Add several more cast-to-bool cases that cast from bit-wise
and boolean operations to bools.


---
Diffs of the changes:

Index: llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c
diff -u llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c:1.1 llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c:1.2
--- llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c:1.1	Sat May 31 22:31:05 2003
+++ llvm/test/Programs/SingleSource/UnitTests/2003-05-31-CastToBool.c	Tue Jul  8 10:41:48 2003
@@ -1,4 +1,14 @@
 #include <stdio.h>
+
+void testCastOps(int y) {
+  printf("y = %d, (y == 2 || y == 0) == %d\n",
+         y, ((_Bool) y == 2) || ((_Bool) y == 0));
+  printf("y = %d, (y > 2 || y < 5) == %d\n",
+         y, ((_Bool) y < 2) && ((_Bool) y > -10));
+  printf("y = %d, (y ^ 2 ^ ~y) == %d\n",
+         y, ((_Bool) y ^ 2 ^ ~5));
+}
+
 void testBool(_Bool X) {
   printf("%d\n", X);
 }
@@ -19,7 +29,7 @@
 }
 
 void testLong(long long X) {
-  printf("%d ", X);
+  printf("%ld ", X);
   testBool(X != 0);
 }
 
@@ -34,5 +44,6 @@
   testLong(123121231231231LL);
   testLong(0x1112300000000000LL);
   testLong(0x11120LL);
+  testCastOps(2);
   return 0;
 }





More information about the llvm-commits mailing list