From c738e693aa4847099e36e18b63bc7a341ef02fe1 Mon Sep 17 00:00:00 2001 From: Jon Bell Date: Sat, 2 Mar 2024 18:29:00 -0700 Subject: [PATCH] Remove debug call and add frame counting --- source/vm.cpp | 6 +----- test/endtoendtests.cpp | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/vm.cpp b/source/vm.cpp index 1ba417a..fc0e90b 100644 --- a/source/vm.cpp +++ b/source/vm.cpp @@ -299,11 +299,6 @@ Vm::~Vm(){ CloseCart(); if (_luaState != nullptr) { - Logger_Write("printing stack before close\n"); - printLuaStack(_luaState); - - printLuaStack(_luaState); - Logger_Write("closing lua state\n"); lua_close(_luaState); @@ -558,6 +553,7 @@ void Vm::deserializeCartDataToMemory(std::string cartDataStr) { } bool Vm::Step(){ + _picoFrameCount++; bool ret = false; lua_getglobal(_luaState, "__z8_tick"); int status = lua_pcall(_luaState, 0, 1, 0); diff --git a/test/endtoendtests.cpp b/test/endtoendtests.cpp index a4ec9d4..834e200 100644 --- a/test/endtoendtests.cpp +++ b/test/endtoendtests.cpp @@ -131,8 +131,10 @@ TEST_CASE("Loading and running carts") { } */ + SUBCASE("Load simple cart"){ vm->LoadCart("cartparsetest.p8", false); + vm->vm_run(); SUBCASE("No error reported"){ CHECK(vm->GetBiosError() == ""); @@ -145,6 +147,7 @@ TEST_CASE("Loading and running carts") { CHECK(vm->GetFrameCount() == 3); } SUBCASE("check lua state"){ + //need to pass this func to the sandbox, not the global state bool globalVarLoaded = vm->ExecuteLua( "function globalVarTest()\n" " return a == 1\n"