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

Reid Spencer reid at x10sys.com
Tue Jan 30 16:13:54 PST 2007



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

convert.cpp added (r1.1)
---
Log message:

New test case for testing conversions between int and APInt.


---
Diffs of the changes:  (+32 -0)

 convert.cpp |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+)


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/convert.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/APInt/convert.cpp:1.1
*** /dev/null	Tue Jan 30 18:13:48 2007
--- llvm-test/SingleSource/UnitTests/Integer/APInt/convert.cpp	Tue Jan 30 18:13:38 2007
***************
*** 0 ****
--- 1,32 ----
+ //===--- convert.c --- Test Cases for Bit Accurate Types ------------------===//
+ //
+ // This file was developed by Reid Spencer and is distributed under the 
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This is a general test for arithmetic operations with signed and
+ // unsigned operands.
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #include "llvm/ADT/APInt.h"
+ #include <stdio.h>
+ 
+ using namespace llvm;
+ 
+ int
+ main ( int argc, char** argv)
+ {
+   APInt x(0,23);
+   APInt y(0,23);
+   int j = 32;
+ 
+   x = y + 17;
+   x += j;
+   y = x - j;
+   y += 17;
+ 
+   // Should produce: 49 34
+   printf("%d %d \n", (int)x.getValue(), (int)y.getValue());
+ }






More information about the llvm-commits mailing list