summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_assets.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/test_assets.cc b/src/tests/test_assets.cc
new file mode 100644
index 0000000..eedc92b
--- /dev/null
+++ b/src/tests/test_assets.cc
@@ -0,0 +1,29 @@
+#include "assets.h"
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+int main() {
+ printf("Running AssetManager test...\n");
+
+ size_t size = 0;
+ const uint8_t *data = GetAsset(AssetId::ASSET_TEST_ASSET, &size);
+
+ assert(data != nullptr);
+ assert(size > 0);
+
+ const char *expected_prefix = "This is a test asset file.";
+ if (strncmp((const char *)data, expected_prefix, strlen(expected_prefix)) ==
+ 0) {
+ printf("Asset content verification: SUCCESS\n");
+ } else {
+ printf("Asset content verification: FAILED\n");
+ printf("Got: %.*s\n", (int)size, (const char *)data);
+ return 1;
+ }
+
+ printf("Asset size: %zu bytes\n", size);
+ printf("AssetManager test PASSED\n");
+
+ return 0;
+}