summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-11 19:02:55 -0400
committerbd <bdunahu@operationnull.com>2025-03-11 19:02:55 -0400
commitf3d6ceaa6f0d716a4b0d30c5c8b27c74c55b96ac (patch)
tree8721f192b627001a3d47af2157ba14b97c52d645 /tests
parent1e095065907c2ab7b3a9705fab7c44e60361e035 (diff)
fix lots of bugs
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/utils.cc b/tests/utils.cc
index 900db1a..ea1a1ed 100644
--- a/tests/utils.cc
+++ b/tests/utils.cc
@@ -5,9 +5,9 @@
TEST_CASE("Parse arbitrary fields # one", "[cache]")
{
int tag, index, offset;
- int address = 0b111110001010101;
+ int address = 0b0001010101;
get_bit_fields(address, &tag, &index, &offset);
- CHECK(tag == 0b11111000);
+ CHECK(tag == 0b000);
CHECK(index == 0b10101);
CHECK(offset == 0b01);
}
@@ -15,30 +15,30 @@ TEST_CASE("Parse arbitrary fields # one", "[cache]")
TEST_CASE("Parse arbitrary fields # two", "[cache]")
{
int tag, index, offset;
- int address = 0b000110100111011;
+ int address = 0b0100111011;
get_bit_fields(address, &tag, &index, &offset);
- CHECK(tag == 0b00011010);
+ CHECK(tag == 0b010);
CHECK(index == 0b01110);
CHECK(offset == 0b11);
}
TEST_CASE("wrap address outside upper bound", "[utils]")
{
- int address = MEM_LINES + 25;
+ int address = MEM_WORDS + 25;
int wrapped = wrap_address(address);
REQUIRE(wrapped == 25);
}
TEST_CASE("wrap address inside upper bound", "[utils]")
{
- int address = MEM_LINES - 25;
+ int address = MEM_WORDS - 25;
int wrapped = wrap_address(address);
- REQUIRE(wrapped == MEM_LINES - 25);
+ REQUIRE(wrapped == MEM_WORDS - 25);
}
TEST_CASE("wrap address at upper bound", "[utils]")
{
- int address = MEM_LINES;
+ int address = MEM_WORDS;
int wrapped = wrap_address(address);
REQUIRE(wrapped == 0);
}
@@ -47,14 +47,14 @@ TEST_CASE("wrap address lower than 0 with magnitude lesser than mem size", "[uti
{
int address = -10;
int wrapped = wrap_address(address);
- REQUIRE(wrapped == MEM_LINES - 10);
+ REQUIRE(wrapped == MEM_WORDS - 10);
}
TEST_CASE("wrap address lower than 0 but with magnitude greater than mem size", "[utils]")
{
- int address = -(MEM_LINES + 10);
+ int address = -(MEM_WORDS + 10);
int wrapped = wrap_address(address);
- REQUIRE(wrapped == MEM_LINES - 10);
+ REQUIRE(wrapped == MEM_WORDS - 10);
}
TEST_CASE("wrap address at 0", "[utils]")