[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp
Reid Spencer
reid at x10sys.com
Mon Jan 29 17:10:59 PST 2007
Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt:
bitlogic.cpp added (r1.1)
---
Log message:
Add a new test case.
---
Diffs of the changes: (+56 -0)
bitlogic.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+)
Index: llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp:1.1
*** /dev/null Mon Jan 29 19:10:53 2007
--- llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp Mon Jan 29 19:10:43 2007
***************
*** 0 ****
--- 1,56 ----
+ //===--- bitlogic.c --- Test Cases for Bit Accurate Types -----------------===//
+ //
+ // This file was developed by Guoling Han and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This is a general test for logical operations.
+ //
+ //===----------------------------------------------------------------------===//
+
+ #include "llvm/ADT/APInt.h"
+ #include <stdio.h>
+
+ using namespace llvm;
+
+ int my_test()
+ {
+ APInt x(1,0x1);
+ APInt y(1);
+ APInt z(9,0x1ff);
+ APInt uz(9,0x1ff);
+ APInt temp(9);
+ y = x;
+ y -= 1;
+ if (!y)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ if (y > x)
+ printf("fail\n");
+ else
+ printf("ok\n");
+
+ if (z != uz)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ temp = z;
+ if (temp <= uz)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ return 0;
+
+ }
+
+ int main()
+ {
+ my_test();
+ return 0;
+ }
+
More information about the llvm-commits
mailing list