diff --git a/tests/c/instruction_checks/get_branch_vram_generic.c b/tests/c/instruction_checks/get_branch_vram_generic.c new file mode 100644 index 0000000..1a185d8 --- /dev/null +++ b/tests/c/instruction_checks/get_branch_vram_generic.c @@ -0,0 +1,17 @@ +/* SPDX-FileCopyrightText: © 2023 Decompollaborate */ +/* SPDX-License-Identifier: MIT */ + +#include "rabbitizer.h" + +#include + +int main() { + RabbitizerInstruction inst; + RabbitizerInstruction_init(&inst, 0x14600001, 0x80000000); // bnez $v1, . + 4 + (0x1 << 2) + RabbitizerInstruction_processUniqueId(&inst); + if (RabbitizerInstruction_getBranchVramGeneric(&inst) < 0) { + printf("Word '0x%08X' has a negative branch target\n", inst.word); + return 1; + } + return 0; +} diff --git a/tests/run_instruction_checks.sh b/tests/run_instruction_checks.sh index 75bde26..61ddd00 100755 --- a/tests/run_instruction_checks.sh +++ b/tests/run_instruction_checks.sh @@ -6,6 +6,7 @@ set -e ./build/tests/c/instruction_checks/jalr.elf +./build/tests/c/instruction_checks/get_branch_vram_generic.elf ./build/tests/c/instruction_checks/plain_disassembly.elf ./build/tests/c/instruction_checks/r3000gte_disasm.elf ./build/tests/c/instruction_checks/r5900_trunc_cvt.elf