|
@@ -2,7 +2,9 @@
|
|
|
#include "core/Components.h"
|
|
|
|
|
|
static void testAddForEach() {
|
|
|
- CoreComponents c = CORE_COMPONENTS(sizeof(int));
|
|
|
+ CoreComponents c;
|
|
|
+ coreInitComponents(&c, sizeof(int));
|
|
|
+
|
|
|
int* i1 = coreComponentsGetOrAdd(&c, 1);
|
|
|
if(CORE_TEST_NOT_NULL(i1)) {
|
|
|
*i1 = 10;
|
|
@@ -21,28 +23,30 @@ static void testAddForEach() {
|
|
|
}
|
|
|
CORE_TEST_TRUE(i1 == i2);
|
|
|
|
|
|
- CoreComponentIterator iter = CORE_COMPONENTS_ITERATOR(&c);
|
|
|
- if(CORE_TEST_TRUE(coreComponentsHasNext(iter))) {
|
|
|
+ CoreComponentIterator iter;
|
|
|
+ coreInitComponentsIterator(&iter, &c);
|
|
|
+ if(CORE_TEST_TRUE(coreComponentsHasNext(&iter))) {
|
|
|
CoreComponentNode* n = coreComponentsNext(&iter);
|
|
|
CORE_TEST_SIZE(1, n->entity);
|
|
|
CORE_TEST_INT(15, *(int*)n->component);
|
|
|
}
|
|
|
- if(CORE_TEST_TRUE(coreComponentsHasNext(iter))) {
|
|
|
+ if(CORE_TEST_TRUE(coreComponentsHasNext(&iter))) {
|
|
|
CoreComponentNode* n = coreComponentsNext(&iter);
|
|
|
CORE_TEST_SIZE(5, n->entity);
|
|
|
CORE_TEST_INT(20, *(int*)n->component);
|
|
|
}
|
|
|
- if(CORE_TEST_TRUE(coreComponentsHasNext(iter))) {
|
|
|
+ if(CORE_TEST_TRUE(coreComponentsHasNext(&iter))) {
|
|
|
CoreComponentNode* n = coreComponentsNext(&iter);
|
|
|
CORE_TEST_SIZE(10, n->entity);
|
|
|
CORE_TEST_INT(30, *(int*)n->component);
|
|
|
}
|
|
|
- CORE_TEST_FALSE(coreComponentsHasNext(iter));
|
|
|
+ CORE_TEST_FALSE(coreComponentsHasNext(&iter));
|
|
|
coreDestroyComponents(&c);
|
|
|
}
|
|
|
|
|
|
static void testAddComponentForEach() {
|
|
|
- CoreComponents c = CORE_COMPONENTS(sizeof(int));
|
|
|
+ CoreComponents c;
|
|
|
+ coreInitComponents(&c, sizeof(int));
|
|
|
int* i1 = coreComponentsGetOrAdd(&c, 1);
|
|
|
if(CORE_TEST_NOT_NULL(i1)) {
|
|
|
*i1 = 10;
|
|
@@ -72,7 +76,8 @@ static void testAddComponentForEach() {
|
|
|
}
|
|
|
|
|
|
static void testRemove() {
|
|
|
- CoreComponents c = CORE_COMPONENTS(sizeof(int));
|
|
|
+ CoreComponents c;
|
|
|
+ coreInitComponents(&c, sizeof(int));
|
|
|
*(int*)coreComponentsGetOrAdd(&c, 1) = 10;
|
|
|
*(int*)coreComponentsGetOrAdd(&c, 5) = 20;
|
|
|
*(int*)coreComponentsGetOrAdd(&c, 10) = 30;
|