From 74d5cbb458c5d85718f4522db8ec677b36957932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 5 Sep 2024 08:12:43 +0300 Subject: [PATCH] Add test for node type --- tests/src/tests/tests.program.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/src/tests/tests.program.cpp b/tests/src/tests/tests.program.cpp index 019f290..b206274 100644 --- a/tests/src/tests/tests.program.cpp +++ b/tests/src/tests/tests.program.cpp @@ -347,4 +347,26 @@ namespace zasm::tests ASSERT_EQ(imm.value(), 3); } + TEST(ProgramTests, TestNodeType) + { + Program program(MachineMode::AMD64); + + auto testIns = Instruction{}.setMnemonic(x86::Mnemonic::Add); + + auto* node = program.createNode(testIns); + ASSERT_NE(node, nullptr); + + ASSERT_TRUE(node->holds()); + + ASSERT_FALSE(node->holds()); + + auto* inst = node->getIf(); + ASSERT_NE(inst, nullptr); + + ASSERT_EQ(testIns, *inst); + + auto* data = node->getIf(); + ASSERT_EQ(data, nullptr); + } + } // namespace zasm::tests