From f0f773a1f2acc3030c89fc5aa6335f667987aa2a Mon Sep 17 00:00:00 2001 From: bd Date: Sat, 10 May 2025 17:02:27 -0400 Subject: Fix issue where decode would overwrite raw bits while in use --- tests/id.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/id.cc b/tests/id.cc index 0e7de3b..b52ad9c 100644 --- a/tests/id.cc +++ b/tests/id.cc @@ -129,6 +129,22 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # two", "[id]") delete i; } +TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # three", "[id]") +{ + signed int t; + InstrDTO *i; + + t = this->encode_R_type(0b10000, 0b10001, 0b10101, 0b1110, 0b0); + i = this->decode_bits(t); + + CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty + CHECK(i->operands.integer.slot_two == 0x00000000); + CHECK(i->operands.integer.slot_three == 0x00000000); + CHECK(i->mnemonic == MULV); + + delete i; +} + TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # one", "[id]") { signed int t; -- cgit v1.2.3