summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-09 20:56:00 -0400
committerbd <bdunahu@operationnull.com>2025-03-09 20:56:00 -0400
commit4676d633edaea37b5661e4f91742b42fcf5b7881 (patch)
tree9b5670221859de5f042f677a7b294c6b46d83518 /tests
parent4dc12d82699520bdc6875e5177ae8a6a2c2dea04 (diff)
cache store single test
Diffstat (limited to 'tests')
-rw-r--r--tests/cache.cc35
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/cache.cc b/tests/cache.cc
index 3c1fba6..55592ae 100644
--- a/tests/cache.cc
+++ b/tests/cache.cc
@@ -1,12 +1,43 @@
#include "cache.h"
#include "definitions.h"
+#include "dram.h"
#include <catch2/catch_test_macros.hpp>
-TEST_CASE("Constructor singleton dram", "[cache]")
+TEST_CASE("Constructor singleton cache", "[cache]")
{
- Cache *c = new Cache(1, nullptr, LINE_SIZE);
+ Cache *c = new Cache(nullptr, 0);
std::array<signed int, LINE_SIZE> expected = {0, 0, 0, 0};
std::array<signed int, LINE_SIZE> actual = c->view(0, 1)[0];
REQUIRE(expected == actual);
delete c;
}
+
+// TEST_CASE("no delay stores instantly", "[cache]")
+// {
+// int delay = 0;
+// Dram *d = new Dram(MEM_SIZE, delay);
+// Cache *c = new Cache(d, delay);
+// std::array<signed int, LINE_SIZE> expected = {0, 0, 0, 0};
+// std::array<signed int, LINE_SIZE> actual = d->view(0, 1)[0];
+// CHECK(expected == actual);
+
+// signed int w = 0x11223344;
+
+// Response r;
+
+// r = c->write(MEM, w, 0x0000000000000);
+// CHECK(r == OK);
+// d->resolve();
+// c->resolve();
+
+// expected.at(0) = w;
+// actual = c->view(0, 1)[0];
+// REQUIRE(expected == actual);
+
+// actual = d->view(0, 1)[0];
+// // we do NOT write back now!
+// REQUIRE(expected != actual);
+
+// delete d;
+// delete c;
+// }