summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-05-30 14:41:54 -0400
committerJonathan Bradley <jcb@pikum.xyz>2025-05-30 14:41:54 -0400
commit781410537a1c7ddac340efabeedd4c9309e5cf39 (patch)
tree7253babcfc7fd8766095fdf89eca7a9fd3952912 /tests
parent6ff0a1f8f7775752db8219dc270a56c4e64b4c7e (diff)
pke: asset: BucketContainer>pk_bkt_arr_t & cleanup
Diffstat (limited to 'tests')
-rw-r--r--tests/pke-test-asset-manager.cpp47
-rw-r--r--tests/pke-test-asset-manager.h16
-rw-r--r--tests/pke-test.cpp4
3 files changed, 66 insertions, 1 deletions
diff --git a/tests/pke-test-asset-manager.cpp b/tests/pke-test-asset-manager.cpp
new file mode 100644
index 0000000..82e1345
--- /dev/null
+++ b/tests/pke-test-asset-manager.cpp
@@ -0,0 +1,47 @@
+
+#include "./pke-test-asset-manager.h"
+
+#include "asset-manager.hpp"
+#include "ecs.hpp"
+#include "font.hpp"
+#include "thread-pool.hpp"
+
+void pke_test_asset_manager_spinup() {
+ PkeThreads_Init();
+ AM_Init();
+ ECS_Init();
+ FontType_Init();
+};
+
+void pke_test_asset_manager_teardown() {
+ FontType_Teardown();
+ ECS_Teardown();
+ AM_Teardown();
+ PkeThreads_Teardown();
+};
+
+int pke_test_asset_manager_001() {
+ AssetHandle handle = AM_GetHandle(AssetKey { "fnt_mquin_img" });
+ const Asset *a = AM_Get(handle);
+ AM_Release(handle);
+ return int(a != NULL && handle != AssetHandle_MAX);
+}
+
+struct pke_test_group *pke_test_asset_manager_get_group() {
+ static const uint64_t test_count = 1;
+ static struct pke_test tests[test_count] = {
+ {
+ .title = "test 001",
+ .func = pke_test_asset_manager_001,
+ .expected_result = 1,
+ }
+ };
+ static struct pke_test_group group = {};
+ group.title = "asset_manager";
+ group.n_tests = test_count;
+ group.tests = &tests[0];
+ group.test_setup = pke_test_asset_manager_spinup;
+ group.test_teardown = pke_test_asset_manager_teardown;
+
+ return &group;
+}
diff --git a/tests/pke-test-asset-manager.h b/tests/pke-test-asset-manager.h
new file mode 100644
index 0000000..802b67f
--- /dev/null
+++ b/tests/pke-test-asset-manager.h
@@ -0,0 +1,16 @@
+#ifndef PKE_PKE_TEST_ASSET_MANAGER_H
+#define PKE_PKE_TEST_ASSET_MANAGER_H
+
+#include "pke-test-types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct pke_test_group *pke_test_asset_manager_get_group();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PKE_PKE_TEST_ASSET_MANAGER_H */
diff --git a/tests/pke-test.cpp b/tests/pke-test.cpp
index 78ad662..2e9eb9d 100644
--- a/tests/pke-test.cpp
+++ b/tests/pke-test.cpp
@@ -1,9 +1,10 @@
#include "./pke-test-types.h"
+#include "./pke-test-asset-manager.h"
#include "./pke-test-dummy.h"
-#include "./pke-test-static-ui.h"
#include "./pke-test-serialization.h"
+#include "./pke-test-static-ui.h"
#include "pk.h"
#include "unistd.h"
@@ -38,6 +39,7 @@ int main(int argc, char *argv[])
pke_test_dummy_get_group,
pke_test_static_ui_get_group,
pke_test_serialization_get_group,
+ pke_test_asset_manager_get_group,
NULL,
};