Skip to content

Commit 617ae35

Browse files
arsenmwdx727
authored andcommitted
Use expect instead of assert macros
1 parent 91d1f4c commit 617ae35

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

llvm/unittests/CodeGen/MachineOperandTest.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,23 @@ TEST(MachineOperandTest, HashValue) {
425425
}
426426

427427
TEST(MachineOperandTest, RegisterLiveOutHashValue) {
428+
LLVMContext Ctx;
429+
Module Mod("Module", Ctx);
430+
auto MF = createMachineFunction(Ctx, Mod);
431+
MachineBasicBlock *MBB = MF->CreateMachineBasicBlock();
432+
MCInstrDesc MCID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
433+
auto *MI1 = MF->CreateMachineInstr(MCID, DebugLoc());
434+
auto *MI2 = MF->CreateMachineInstr(MCID, DebugLoc());
435+
MBB->insert(MBB->begin(), MI1);
436+
MBB->insert(MBB->begin(), MI2);
428437
uint32_t Mask1 = 0;
429438
uint32_t Mask2 = 0;
430-
MachineOperand MO1 = MachineOperand::CreateRegLiveOut(&Mask1);
431-
MachineOperand MO2 = MachineOperand::CreateRegLiveOut(&Mask2);
432-
ASSERT_EQ(hash_value(MO1), hash_value(MO2));
433-
ASSERT_TRUE(MO1.isIdenticalTo(MO2));
439+
MI1->addOperand(*MF, MachineOperand::CreateRegLiveOut(&Mask1));
440+
MI2->addOperand(*MF, MachineOperand::CreateRegLiveOut(&Mask2));
441+
auto MO1 = MI1->getOperand(0);
442+
auto MO2 = MI2->getOperand(0);
443+
EXPECT_EQ(hash_value(MO1), hash_value(MO2));
444+
EXPECT_TRUE(MO1.isIdenticalTo(MO2));
434445
}
435446

436447
} // end namespace

0 commit comments

Comments
 (0)