commit 288268d44c674a968d1bc083bb86375124de4a3f
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Sat Sep 27 19:08:51 2025 -0600
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Sat Sep 27 19:08:51 2025 -0600
update stub host to get tests passing
---
test/stubhost.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/test/stubhost.cpp b/test/stubhost.cpp
index 56f3b07..5bbefd3 100644
--- a/test/stubhost.cpp
+++ b/test/stubhost.cpp
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <map>
#include <fstream>
#include <iostream>
@@ -13,16 +14,18 @@ using namespace std;
#include "stubhost.h"
-
+//ATTN: none of these statics are thread safe
static uint8_t stubCurrKDown;
static uint8_t stubCurrKHeld;
static bool stubCurrKBdown = false;
static std::string stubCurrKBkey = "";
-
+static std::map<std::string, std::string> stubCartDataStorage;
Host::Host() { }
-StubHost::StubHost() { }
+StubHost::StubHost() {
+ stubCartDataStorage.clear();
+}
void Host::oneTimeSetup(Audio* audio){
@@ -106,10 +109,11 @@ std::string Host::getCartDataFile(std::string cartDataKey) {
}
std::string Host::getCartDataFileContents(std::string cartDataKey) {
- return "";
+ return stubCartDataStorage[cartDataKey];
}
void Host::saveCartData(std::string cartDataKey, std::string contents) {
+ stubCartDataStorage[cartDataKey] = contents;
}
void Host::writeBufferToFile(std::string fileName, char* buffer, size_t length) {