diff --git a/tests/src/tests/tests.program.cpp b/tests/src/tests/tests.program.cpp index 3b0972f..019f290 100644 --- a/tests/src/tests/tests.program.cpp +++ b/tests/src/tests/tests.program.cpp @@ -316,4 +316,35 @@ namespace zasm::tests } } + TEST(ProgramTests, TestLabelNodeLookup) + { + Program program(MachineMode::AMD64); + + x86::Assembler assembler(program); + + auto label = assembler.createLabel(); + ASSERT_EQ(assembler.mov(x86::eax, Imm(0)), ErrorCode::None); + ASSERT_EQ(assembler.mov(x86::eax, Imm(1)), ErrorCode::None); + ASSERT_EQ(assembler.mov(x86::eax, Imm(2)), ErrorCode::None); + ASSERT_EQ(assembler.bind(label), ErrorCode::None); + ASSERT_EQ(assembler.mov(x86::eax, Imm(3)), ErrorCode::None); + + auto* labelNode = program.getNodeForLabel(label); + ASSERT_NE(labelNode, nullptr); + + ASSERT_EQ(labelNode->holds