add single return tests
authorGabor Greif <ggreif@gmail.com>
Tue, 16 Mar 2010 11:24:53 +0000 (11:24 +0000)
committerGabor Greif <ggreif@gmail.com>
Tue, 16 Mar 2010 11:24:53 +0000 (11:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98625 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/VMCore/InstructionsTest.cpp

index 15f894039f1f2d7744f9c3f31cdc539134e394be..81563484f7b36159fdb4ff50f88d8860ce5c5e5a 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Instructions.h"
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Instructions.h"
+#include "llvm/DerivedTypes.h"
 #include "llvm/LLVMContext.h"
 #include "gtest/gtest.h"
 
 #include "llvm/LLVMContext.h"
 #include "gtest/gtest.h"
 
@@ -20,6 +21,16 @@ TEST(InstructionsTest, ReturnInst) {
   // test for PR6589
   const ReturnInst* r0 = ReturnInst::Create(C);
   EXPECT_EQ(r0->op_begin(), r0->op_end());
   // 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());
 }
 
 }  // end anonymous namespace
 }
 
 }  // end anonymous namespace