commit a9c5d7d9fe25bcc988bd0237b8f8e0ff2767ab8e
Author: jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Sat Sep 12 08:34:10 2020 -0600
Commit: jtothebell <j.to.the.bell@gmail.com>
CommitDate: Tue Sep 15 17:09:08 2020 -0600
Add initial cart tests
---
test/Makefile | 16 +++++++++++++++-
test/carttests.cpp | 14 ++++++++++++++
test/nooplogger.cpp | 25 +++++++++++++++++++++++++
3 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/test/Makefile b/test/Makefile
index 79cb339..cf65f6a 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -6,13 +6,16 @@ CFLAGS := -Wall -g -c -O2 \
all: runtests
-testrunner.a: testroot.o fontdatatests.o graphicstests.o audiotests.o cartpatchertests.o
+testrunner.a: testroot.o \
+ fontdatatests.o graphicstests.o audiotests.o cartpatchertests.o \
+ carttests.o
g++ -I$(CURDIR)/include -L$(CURDIR)/lib \
testroot.o \
fontdata.o fontdatatests.o \
graphics.o graphicstests.o stringToDataHelpers.o \
Audio.o synth.o audiotests.o \
cartPatcher.o cartpatchertests.o \
+ cart.o carttests.o nooplogger.o lodepng.o emojiconversion.o filehelpers.o utf8-util.o \
-llua -ldl \
-o testrunner.a
@@ -52,6 +55,17 @@ liblua.a:
cp ../libs/lua-5.3.2/src/lauxlib.h include/lauxlib.h
#make lua (cd ../libs/lua-5.3.2/src make linux, cp liblua.a, lua.h luaconf.h lualib.h lauxlib.h
+carttests.o: carttests.cpp ../source/cart.cpp ../source/cart.h \
+ ../libs/lodepng/lodepng.cpp ../libs/lodepng/lodepng.h \
+ ../source/logger.h ../source/emojiconversion.h ../source/emojiconversion.cpp \
+ ../source/filehelpers.h ../source/filehelpers.cpp
+ cp ../libs/lodepng/lodepng.h include/lodepng.h && \
+ cp ../source/logger.h include/logger.h && \
+ cp ../libs/utf8-util/utf8-util.h include/utf8-util.h && \
+ g++ $(CFLAGS) -I$(CURDIR)/include carttests.cpp ../source/cart.cpp ../libs/lodepng/lodepng.cpp \
+ nooplogger.cpp ../source/emojiconversion.cpp ../source/filehelpers.cpp \
+ ../libs/utf8-util/utf8-util.cpp
+
runtests: testrunner.a
./testrunner.a
diff --git a/test/carttests.cpp b/test/carttests.cpp
new file mode 100644
index 0000000..0ea3439
--- /dev/null
+++ b/test/carttests.cpp
@@ -0,0 +1,14 @@
+#include "doctest.h"
+#include "../source/cart.h"
+
+TEST_CASE("Loads bios cart") {
+ Cart* cart = new Cart("__FAKE08-BIOS.p8");
+
+ SUBCASE("filename is correct") {
+ CHECK(cart->Filename == "__FAKE08-BIOS.p8");
+ }
+ SUBCASE("error is empty") {
+ CHECK(cart->LoadError == "");
+ }
+
+}
\ No newline at end of file
diff --git a/test/nooplogger.cpp b/test/nooplogger.cpp
new file mode 100644
index 0000000..1f8f530
--- /dev/null
+++ b/test/nooplogger.cpp
@@ -0,0 +1,25 @@
+#include <strings.h>
+#include <stdarg.h>
+
+#include "logger.h"
+
+
+void Logger::Initialize()
+{
+}
+
+void Logger::LogOutput(const char * func, size_t line, const char * format, ...)
+{
+}
+
+void Logger::Write(const char * format, ...)
+{
+}
+
+void Logger::WriteUnformatted(const char * message)
+{
+}
+
+void Logger::Exit()
+{
+}