added life (entity component system) type, and changed chemical param to try to match more to archeus (or at least what I've read from wikipedia)

This commit is contained in:
herbglitch 2025-03-10 03:11:55 -06:00
parent e698fb54a2
commit 990c22d27d
6 changed files with 43 additions and 21 deletions

View file

@ -1,3 +1,5 @@
group test {
int32 test = 5;
int32 test1 = -7;
}

View file

@ -8,8 +8,22 @@
static const char *testType = "int32";
void TEST_ChemicalType_CopyInt32Fn(void **type, ARC_ParserTagToken *parsedData, ARC_Chemical *chemical){
//go into the <numberSign> tag
ARC_ParserTagToken *childTagToken = (ARC_ParserTagToken *)ARC_Vector_Get(parsedData->tagTokens, 0);
if(childTagToken->id != ARC_CHEMICAL_NUMBER_SIGN){
arc_errno = ARC_ERRNO_DATA;
ARC_DEBUG_LOG_ERROR("TEST_ChemicalType_CopyInt32Fn(type, parsedData, chemical), parsed data was not a <numberSign>");
*type = NULL;
return;
}
//check if the first tag is a minus sign and create a string starting with that if it is
childTagToken = (ARC_ParserTagToken *)ARC_Vector_Get(childTagToken->tagTokens, 0);
ARC_String *int32String;
ARC_String_Create(&int32String, NULL, 0);
if(childTagToken->id == ARC_CHEMICAL_MINUS){
ARC_String_AppendCStringWithStrlen(&int32String, "-");
}
ARC_ParserData_HelperRecurseStringAdd(&int32String, parsedData);
@ -80,6 +94,8 @@ ARC_TEST(Chemical_BasicTest){
int32_t testVal = *(int32_t *)ARC_Chemical_GetWithCStr(chemical, "test::test");
ARC_CHECK(testVal == 5);
testVal = *(int32_t *)ARC_Chemical_GetWithCStr(chemical, "test::test1");
ARC_CHECK(testVal == -7);
ARC_Chemical_UnloadFromFile(chemical, tempString);

View file

@ -83,7 +83,6 @@ ARC_TEST(Hashtable_Add_Get_Remove){
ARC_CHECK(5 == *(int32_t *)ARC_Hashtable_Get(hashtable, (void *)"key7"));
ARC_CHECK(6 == *(int32_t *)ARC_Hashtable_Get(hashtable, (void *)"key8"));
TEST_Hashtable_Print(hashtable);
ARC_Hashtable_Remove(hashtable, (void *)"key2");
ARC_CHECK(2 == *(int32_t *)ARC_Hashtable_Get(hashtable, (void *)"key0"));