summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-05-10 17:02:27 -0400
committerbd <bdunahu@operationnull.com>2025-05-10 17:02:27 -0400
commitf0f773a1f2acc3030c89fc5aa6335f667987aa2a (patch)
treee3f27a3e6d78a9f15ce6fb1b6f3b40202aa5ab3e /tests
parent5beea0c476101ec7b122f3b2181d92ce096492fb (diff)
Fix issue where decode would overwrite raw bits while in use
Diffstat (limited to 'tests')
-rw-r--r--tests/id.cc16
1 files changed, 16 insertions, 0 deletions
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;