[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp

Reid Spencer reid at x10sys.com
Tue Feb 13 19:38:42 PST 2007



Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt:

arith.cpp updated: 1.5 -> 1.6
---
Log message:

Clean up some output.
Actually shift the bits when generating the random values.


---
Diffs of the changes:  (+6 -4)

 arith.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.5 llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.6
--- llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.5	Tue Feb 13 21:05:33 2007
+++ llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp	Tue Feb 13 21:38:26 2007
@@ -100,11 +100,12 @@
   if (val.getNumBits() > 64)
     printf("too wide\n");
   else
-    printf("%ul\n", val.getValue());
+    printf("%lu\n", val.getValue());
 }
 
 void test_binops(const APInt &v1, const APInt &v2) {
-  printf("BINARY OPERATORS TEST: vl = %s, v2 = %s\n", str(v1), str(v2));
+  printf("BINARY OPERATORS TEST: vl = %s, ", str(v1));
+  printf("v2 = %s\n", str(v2));
   APInt result(v1);
   result &= v2;
   printf("v1 &= v2: %s\n", str(result));
@@ -176,14 +177,15 @@
     APInt v2(0u, bits);
     for (unsigned i = 0; i < bits; ++i) {
       unsigned bit = rand() % 2;
-      v1.Shl(1);
+      v1 = v1.Shl(1);
       v1 |= bit;
     }
     for (unsigned i = 0; i < bits; ++i) {
       unsigned bit = rand() % 2;
-      v2.Shl(1);
+      v2 = v2.Shl(1);
       v2 |= bit;
     }
+    printf("\nTEST CASE: %d bits\n\n", bits);
     test_interface(v1);
     test_unops(v2);
     test_binops(v1,v2);






More information about the llvm-commits mailing list