From 6579f7272905d1e25b43ef051da6c2180e60ca2b Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 1 Apr 2025 00:49:52 -0400 Subject: Ensure all stages only do work if they are not 'OK' --- tests/if.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests/if.cc') diff --git a/tests/if.cc b/tests/if.cc index 4ebc47d..d6c1bca 100644 --- a/tests/if.cc +++ b/tests/if.cc @@ -36,7 +36,7 @@ class IFFixture int i; for (i = 0; i < this->m_delay + 1; ++i) { - r = this->ct->advance(OK); + r = this->ct->advance(WAIT); // check response CHECK(r == nullptr); } @@ -52,13 +52,13 @@ class IFFixture int i; for (i = 0; i < this->c_delay; ++i) { - r = this->ct->advance(OK); + r = this->ct->advance(WAIT); // check response - CHECK(r == nullptr); + REQUIRE(r == nullptr); } - r = this->ct->advance(OK); + r = this->ct->advance(WAIT); // check response - CHECK(r != nullptr); + REQUIRE(r != nullptr); return r; } @@ -103,8 +103,7 @@ TEST_CASE_METHOD(IFFixture, "fetch returns two instuctions", "[if_pipe]") delete i; } -TEST_CASE_METHOD(IFFixture, "fetch waits with old instruction", -"[if_pipe]") +TEST_CASE_METHOD(IFFixture, "fetch waits with old instruction", "[if_pipe]") { InstrDTO *i; int j, expected_cycles, fetch_cycles; @@ -115,20 +114,21 @@ TEST_CASE_METHOD(IFFixture, "fetch waits with old instruction", for (j = 0; j < this->m_delay + 1; ++j) { i = this->ct->advance(STALLED); // check response - CHECK(i == nullptr); + REQUIRE(i == nullptr); } for (j = 0; j < this->c_delay; ++j) { i = this->ct->advance(STALLED); // check response - CHECK(i == nullptr); + REQUIRE(i == nullptr); } for (j = 0; j < expected_cycles - fetch_cycles; ++j) { i = this->ct->advance(STALLED); // check response - CHECK(i != nullptr); + REQUIRE(i != nullptr); } - i = this->ct->advance(OK); + i = this->ct->advance(WAIT); + REQUIRE(i != nullptr); CHECK(i->get_time_of(FETCH) == expected_cycles); REQUIRE(i->get_instr_bits() == this->p[0]); -- cgit v1.2.3