summaryrefslogtreecommitdiff
path: root/unittests/ADT
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-01-19 18:08:33 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-01-19 18:08:33 +0000
commit1999ff1d810b13425fcb80ac8bbccdff4c3a7cf8 (patch)
treed841951ef450e407ac8fac20ccaf70dec1c479a5 /unittests/ADT
parent4bd47877859b19c7a12cd10eff03533b329740e1 (diff)
downloadllvm-1999ff1d810b13425fcb80ac8bbccdff4c3a7cf8.tar.gz
llvm-1999ff1d810b13425fcb80ac8bbccdff4c3a7cf8.tar.bz2
llvm-1999ff1d810b13425fcb80ac8bbccdff4c3a7cf8.tar.xz
Port this test from dejagnu to unit testing.
The way this worked before was to test APInt by running "lli -force-interpreter=true" knowing the lli uses APInt under the hood to store its values. Now, we test APInt directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ADT')
-rw-r--r--unittests/ADT/APInt.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/unittests/ADT/APInt.cpp b/unittests/ADT/APInt.cpp
new file mode 100644
index 0000000000..5bca5b6b40
--- /dev/null
+++ b/unittests/ADT/APInt.cpp
@@ -0,0 +1,25 @@
+//===- llvm/unittest/ADT/APInt.cpp - APInt unit tests -----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+#include "llvm/ADT/APInt.h"
+
+using namespace llvm;
+
+namespace {
+
+// Test that APInt shift left works when bitwidth > 64 and shiftamt == 0
+TEST(APIntTest, ShiftLeftByZero) {
+ APInt One = APInt::getNullValue(65) + 1;
+ APInt Shl = One.shl(0);
+ EXPECT_EQ(Shl[0], true);
+ EXPECT_EQ(Shl[1], false);
+}
+
+}