foxygit / fake-08-xbox360 Log in
commit eb0917e27d0a65d1ee6e8b35236eeccb2a17fda7
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Tue Jan 18 19:22:31 2022 -0700
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Tue Jan 18 19:22:31 2022 -0700

    Add end to end test for new sub update
---
 test/carts/screenshots/subtest_f01.png | Bin 0 -> 358 bytes
 test/carts/subtest.p8                  |  17 +++++++++++++++++
 test/endtoendtests.cpp                 |  14 ++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/test/carts/screenshots/subtest_f01.png b/test/carts/screenshots/subtest_f01.png
new file mode 100644
index 0000000..0c8fb39
Binary files /dev/null and b/test/carts/screenshots/subtest_f01.png differ
diff --git a/test/carts/subtest.p8 b/test/carts/subtest.p8
new file mode 100644
index 0000000..b002c51
--- /dev/null
+++ b/test/carts/subtest.p8
@@ -0,0 +1,17 @@
+pico-8 cartridge // http://www.pico-8.com
+version 34
+__lua__
+function _draw()
+ cls()
+ s = "the quick brown fox"
+ print(sub(s,5,9))   --> "quick"
+ print(sub(s,5))     --> "quick brown fox"
+ print(sub(s,5,_))   --> "q"
+end
+__gfx__
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
diff --git a/test/endtoendtests.cpp b/test/endtoendtests.cpp
index afad126..fc1ea7c 100644
--- a/test/endtoendtests.cpp
+++ b/test/endtoendtests.cpp
@@ -538,6 +538,20 @@ TEST_CASE("Loading and running carts") {

         vm->CloseCart();
     }
+    SUBCASE("sub test"){
+        vm->LoadCart("subtest.p8");
+
+        SUBCASE("No error reported"){
+            CHECK(vm->GetBiosError() == "");
+        }
+        SUBCASE("sceen matches screenshot"){
+            vm->UpdateAndDraw();
+
+            CHECK(verifyScreenshot(vm, "carts/screenshots/subtest_f01.png"));
+        }
+
+        vm->CloseCart();
+    }

     delete vm;
     delete host;