diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-16 16:51:38 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-03-16 16:51:38 +0000 |
| commit | c69102774f9739c81ae1285ed9ae62405071c63c (patch) | |
| tree | 458dd25677a43aef6390ecadb4423817f00e08b0 /unittests/VMCore/InstructionsTest.cpp | |
| parent | ea5b2dd11c0526581803e7eb58224a2eabf191e6 (diff) | |
Notes
Diffstat (limited to 'unittests/VMCore/InstructionsTest.cpp')
| -rw-r--r-- | unittests/VMCore/InstructionsTest.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/unittests/VMCore/InstructionsTest.cpp b/unittests/VMCore/InstructionsTest.cpp new file mode 100644 index 0000000000000..2d98cad27fb8b --- /dev/null +++ b/unittests/VMCore/InstructionsTest.cpp @@ -0,0 +1,41 @@ +//===- llvm/unittest/VMCore/InstructionsTest.cpp - Instructions unit tests ===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Instructions.h" +#include "llvm/DerivedTypes.h" +#include "llvm/LLVMContext.h" +#include "gtest/gtest.h" + +namespace llvm { +namespace { + +TEST(InstructionsTest, ReturnInst) { + LLVMContext &C(getGlobalContext()); + + // test for PR6589 + const ReturnInst* r0 = ReturnInst::Create(C); + EXPECT_EQ(r0->op_begin(), r0->op_end()); + + const IntegerType* Int1 = IntegerType::get(C, 1); + Constant* One = ConstantInt::get(Int1, 1, true); + const ReturnInst* r1 = ReturnInst::Create(C, One); + User::const_op_iterator b(r1->op_begin()); + EXPECT_NE(b, r1->op_end()); + EXPECT_EQ(*b, One); + EXPECT_EQ(r1->getOperand(0), One); + ++b; + EXPECT_EQ(b, r1->op_end()); + + // clean up + delete r0; + delete r1; +} + +} // end anonymous namespace +} // end namespace llvm |
