summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-07-20 16:32:20 +0000
committerGabor Greif <ggreif@gmail.com>2010-07-20 16:32:20 +0000
commitee57dae3d8bcb2f3f41eb225bc615045d13d9dda (patch)
tree326e4c19fac1b835a2b8530fe88527af2682438b /unittests
parent082d6b653694185d4049c3823eecc2a98c3aef58 (diff)
downloadllvm-ee57dae3d8bcb2f3f41eb225bc615045d13d9dda.tar.gz
llvm-ee57dae3d8bcb2f3f41eb225bc615045d13d9dda.tar.bz2
llvm-ee57dae3d8bcb2f3f41eb225bc615045d13d9dda.tar.xz
initial checkin for unittest to exercise Support/Casting.h
this is still minimal on purpose, but I plan to migrate the ugly hack under #ifdef DEBUG_CAST_OPERATORS into this file git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/Casting.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/unittests/Support/Casting.cpp b/unittests/Support/Casting.cpp
new file mode 100644
index 0000000000..d7e89f802b
--- /dev/null
+++ b/unittests/Support/Casting.cpp
@@ -0,0 +1,32 @@
+//===---------- llvm/unittest/Support/Casting.cpp - Casting tests --------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Debug.h"
+#define DEBUG_CAST_OPERATORS
+#include "llvm/Support/Casting.h"
+
+#include "gtest/gtest.h"
+#include <cstdlib>
+
+using namespace llvm;
+
+namespace {
+
+extern bar &B1;
+extern const bar *B2;
+
+TEST(CastingTest, Basics) {
+ EXPECT_TRUE(isa<foo>(B1));
+}
+
+bar B;
+bar &B1 = B;
+const bar *B2 = &B;
+} // anonymous namespace