commit 5e073d41f53a7ac20e2686ea5995b8cd038e909f
Author: jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Tue May 11 21:45:44 2021 -0600
Commit: jtothebell <j.to.the.bell@gmail.com>
CommitDate: Tue May 11 21:45:44 2021 -0600
Fix tests for cart dir refactor
---
test/endtoendtests.cpp | 40 ++++++++++++++++++++--------------------
test/stubhost.cpp | 4 ++++
test/vmtests.cpp | 8 ++++----
3 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/test/endtoendtests.cpp b/test/endtoendtests.cpp
index d9a13bd..afad126 100644
--- a/test/endtoendtests.cpp
+++ b/test/endtoendtests.cpp
@@ -75,7 +75,7 @@ TEST_CASE("Loading and running carts") {
Vm* vm = new Vm(host);
SUBCASE("Load simple cart"){
- vm->LoadCart("carts/cartparsetest.p8");
+ vm->LoadCart("cartparsetest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -100,7 +100,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("pset 0,0 test cart renders correctly"){
- vm->LoadCart("carts/pset00-test.p8");
+ vm->LoadCart("pset00-test.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -114,7 +114,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("pset 3 pix top left test cart renders correctly"){
- vm->LoadCart("carts/pset3pix.p8");
+ vm->LoadCart("pset3pix.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -128,7 +128,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("pset all pixels test cart renders correctly"){
- vm->LoadCart("carts/psetall.p8");
+ vm->LoadCart("psetall.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -142,7 +142,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("Clip test cart renders correctly"){
- vm->LoadCart("carts/cliptest.p8");
+ vm->LoadCart("cliptest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -156,7 +156,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("Memory function test cart"){
- vm->LoadCart("carts/memorytest.p8");
+ vm->LoadCart("memorytest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -170,7 +170,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("Cart data function test cart"){
- vm->LoadCart("carts/cartdatatest.p8");
+ vm->LoadCart("cartdatatest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -184,7 +184,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("tonum test cart"){
- vm->LoadCart("carts/tonumtest2.p8");
+ vm->LoadCart("tonumtest2.p8");
SUBCASE("can parse positive int"){
vm->UpdateAndDraw();
@@ -282,7 +282,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("Simple Arithmetic Cart"){
- vm->LoadCart("carts/arithmetictest.p8");
+ vm->LoadCart("arithmetictest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -381,7 +381,7 @@ TEST_CASE("Loading and running carts") {
SUBCASE("api loaded with cart load") {
- vm->LoadCart("carts/cartparsetest.p8");
+ vm->LoadCart("cartparsetest.p8");
SUBCASE("all api functions exist"){
vector<string> apiFunctions {
@@ -416,19 +416,19 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("calling reload from init doesn't crash") {
- vm->LoadCart("carts/reloadininit.p8");
+ vm->LoadCart("reloadininit.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
}
}
SUBCASE("rnd with table argument works") {
- vm->LoadCart("carts/tablerndtest.p8");
+ vm->LoadCart("tablerndtest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
}
}
SUBCASE("Fill pattern test cart"){
- vm->LoadCart("carts/fillptest.p8");
+ vm->LoadCart("fillptest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -442,7 +442,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("Peek4/poke4 test cart"){
- vm->LoadCart("carts/peek4test.p8");
+ vm->LoadCart("peek4test.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -458,7 +458,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("pal (with table) test cart"){
- vm->LoadCart("carts/paltabletest.p8");
+ vm->LoadCart("paltabletest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -472,7 +472,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("pairs() with nil arg test"){
- vm->LoadCart("carts/nilpairstest.p8");
+ vm->LoadCart("nilpairstest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -486,7 +486,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("split() test"){
- vm->LoadCart("carts/splittest.p8");
+ vm->LoadCart("splittest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
@@ -500,7 +500,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("General use memory persists across cart loads"){
- vm->LoadCart("carts/cartparsetest.p8");
+ vm->LoadCart("cartparsetest.p8");
auto origFirstByte = vm->vm_peek(0);
vm->vm_poke(0x0000, 12);
vm->vm_poke(0x42ff, 92);
@@ -510,7 +510,7 @@ TEST_CASE("Loading and running carts") {
vm->vm_poke(0x5600, 71);
vm->vm_poke(0x7fff, 223);
- vm->LoadCart("carts/cartparsetest.p8");
+ vm->LoadCart("cartparsetest.p8");
CHECK_EQ(vm->vm_peek(0x0000), origFirstByte);
CHECK_EQ(vm->vm_peek(0x42ff), 0);
@@ -525,7 +525,7 @@ TEST_CASE("Loading and running carts") {
vm->CloseCart();
}
SUBCASE("#include test"){
- vm->LoadCart("carts/includetest.p8");
+ vm->LoadCart("includetest.p8");
SUBCASE("No error reported"){
CHECK(vm->GetBiosError() == "");
diff --git a/test/stubhost.cpp b/test/stubhost.cpp
index 075b301..9db93a2 100644
--- a/test/stubhost.cpp
+++ b/test/stubhost.cpp
@@ -104,3 +104,7 @@ std::string Host::getCartDataFileContents(std::string cartDataKey) {
void Host::saveCartData(std::string cartDataKey, std::string contents) {
}
+
+std::string Host::getCartDirectory() {
+ return "carts";
+}
diff --git a/test/vmtests.cpp b/test/vmtests.cpp
index ddf97f0..d198751 100644
--- a/test/vmtests.cpp
+++ b/test/vmtests.cpp
@@ -321,7 +321,7 @@ TEST_CASE("Vm memory functions") {
CHECK_EQ(graphics->pget(127, 127), 13);
}
SUBCASE("Loading cart copies cart rom to memory") {
- vm->LoadCart("carts/cartparsetest.p8.png");
+ vm->LoadCart("cartparsetest.p8.png");
SUBCASE("Gfx data is populated") {
CHECK(memory->spriteSheetData[0] == 255);
@@ -363,7 +363,7 @@ TEST_CASE("Vm memory functions") {
}
}
SUBCASE("reload writes cart rom over changes") {
- vm->LoadCart("carts/cartparsetest.p8.png");
+ vm->LoadCart("cartparsetest.p8.png");
graphics->sset(0, 0, 4);
graphics->fset(0, 3);
@@ -382,7 +382,7 @@ TEST_CASE("Vm memory functions") {
CHECK_EQ(graphics->fget(3), 13);
}
SUBCASE("memcpy copies memory") {
- vm->LoadCart("carts/cartparsetest.p8.png");
+ vm->LoadCart("cartparsetest.p8.png");
vm->vm_memcpy(0x3000, 0, 4);
CHECK_EQ(memory->spriteSheetData[1], 1);
@@ -399,7 +399,7 @@ TEST_CASE("Vm memory functions") {
CHECK_EQ(vm->vm_dget(34), (fix32)1923);
}
SUBCASE("pico driller style input"){
- vm->LoadCart("carts/drillerinputtest.p8");
+ vm->LoadCart("drillerinputtest.p8");
SUBCASE("no buttons gives 0"){
vm->UpdateAndDraw();