From 4676d633edaea37b5661e4f91742b42fcf5b7881 Mon Sep 17 00:00:00 2001 From: bd Date: Sun, 9 Mar 2025 20:56:00 -0400 Subject: cache store single test --- tests/cache.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'tests/cache.cc') 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 -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 expected = {0, 0, 0, 0}; std::array 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 expected = {0, 0, 0, 0}; +// std::array 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; +// } -- cgit v1.2.3