From: David Neto Date: Fri, 26 Aug 2016 14:33:41 +0000 (-0400) Subject: Test ir::Instruction::GetOperand and GetInOperand X-Git-Tag: upstream/2018.6~1097 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58e1a1e3bebba6ab42d21264c1155fcbddc2596a;p=platform%2Fupstream%2FSPIRV-Tools.git Test ir::Instruction::GetOperand and GetInOperand --- diff --git a/test/opt/test_instruction.cpp b/test/opt/test_instruction.cpp index fb64ade..e821068 100644 --- a/test/opt/test_instruction.cpp +++ b/test/opt/test_instruction.cpp @@ -91,6 +91,19 @@ TEST(InstructionTest, CreateWithOpcodeAndOperands) { EXPECT_EQ(2u, inst.NumInOperandWords()); } +TEST(InstructionTest, GetOperand) { + Instruction inst(kSampleParsedInstruction); + EXPECT_THAT(inst.GetOperand(0).words, Eq(std::vector{44})); + EXPECT_THAT(inst.GetOperand(1).words, Eq(std::vector{32})); + EXPECT_THAT(inst.GetOperand(2).words, Eq(std::vector{1})); +} + +TEST(InstructionTest, GetInOperand) { + Instruction inst(kSampleParsedInstruction); + EXPECT_THAT(inst.GetInOperand(0).words, Eq(std::vector{32})); + EXPECT_THAT(inst.GetInOperand(1).words, Eq(std::vector{1})); +} + TEST(InstructionTest, OperandConstIterators) { Instruction inst(kSampleParsedInstruction); // Spot check iteration across operands.