summaryrefslogtreecommitdiff
path: root/tests/id.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/id.cc')
-rw-r--r--tests/id.cc52
1 files changed, 26 insertions, 26 deletions
diff --git a/tests/id.cc b/tests/id.cc
index 321c013..a81e967 100644
--- a/tests/id.cc
+++ b/tests/id.cc
@@ -26,12 +26,12 @@ class IDFixture
InstrDTO *decode_bits(signed int raw)
{
InstrDTO *i = new InstrDTO();
- i->set_instr_bits(raw);
+ i->slot_A = raw;
this->dum->set_curr_instr(i);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i == nullptr);
- i = this->ct->advance(WAIT);
+ i = this->ct->advance(READY);
REQUIRE(i != nullptr);
return i;
@@ -92,7 +92,7 @@ TEST_CASE_METHOD(IDFixture, "Parse invalid type", "[id]")
t = this->encode_R_type(0b0, 0b1, 0b10, 0b11, 0b11);
i = this->decode_bits(t);
- CHECK(i->get_mnemonic() == NOP);
+ CHECK(i->mnemonic == NOP);
delete i;
}
@@ -105,10 +105,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # one", "[id]")
t = this->encode_R_type(0b101, 0b110, 0b111, 0b11, 0b0);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0x00000000);
- CHECK(i->get_mnemonic() == MUL);
+ 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 == MUL);
delete i;
}
@@ -121,10 +121,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary r-type # two", "[id]")
t = this->encode_R_type(0b10000, 0b01000, 0b00100, 0b10, 0b0);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0x00000000);
- CHECK(i->get_mnemonic() == SUB);
+ 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 == SUB);
delete i;
}
@@ -137,10 +137,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # one", "[id]")
t = this->encode_I_type(0xF, 0b101, 0b110, 0b0111, 0b1);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0xF);
- CHECK(i->get_mnemonic() == ANDI);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x00000000);
+ CHECK(i->operands.integer.slot_three == 0xF);
+ CHECK(i->mnemonic == ANDI);
delete i;
}
@@ -153,10 +153,10 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # two", "[id]")
t = this->encode_I_type(0xCC, 0b101, 0b110, 0b1011, 0b1);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x00000000);
- CHECK(i->get_s3() == 0xCC);
- CHECK(i->get_mnemonic() == STOREV);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x00000000);
+ CHECK(i->operands.integer.slot_three == 0xCC);
+ CHECK(i->mnemonic == STOREV);
delete i;
}
@@ -169,9 +169,9 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # one", "[id]")
t = this->encode_J_type(0x3456, 0b10101, 0b0111, 0b10);
i = this->decode_bits(t);
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == 0x3456);
- CHECK(i->get_mnemonic() == BOF);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == 0x3456);
+ CHECK(i->mnemonic == BOF);
delete i;
}
@@ -185,9 +185,9 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary j-type # two", "[id]")
i = this->decode_bits(t);
t = 0xFFFBBCCF;
- CHECK(i->get_s1() == 0x00000000); // registers are empty
- CHECK(i->get_s2() == t);
- CHECK(i->get_mnemonic() == JAL);
+ CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
+ CHECK(i->operands.integer.slot_two == t);
+ CHECK(i->mnemonic == JAL);
delete i;
}