[llvm-commits] [llvm] r108849 - /llvm/trunk/unittests/Support/Casting.cpp

Gabor Greif ggreif at gmail.com
Tue Jul 20 09:32:20 PDT 2010


Author: ggreif
Date: Tue Jul 20 11:32:20 2010
New Revision: 108849

URL: http://llvm.org/viewvc/llvm-project?rev=108849&view=rev
Log:
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

Added:
    llvm/trunk/unittests/Support/Casting.cpp

Added: llvm/trunk/unittests/Support/Casting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/Casting.cpp?rev=108849&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/Casting.cpp (added)
+++ llvm/trunk/unittests/Support/Casting.cpp Tue Jul 20 11:32:20 2010
@@ -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





More information about the llvm-commits mailing list