32 lines
895 B
C
32 lines
895 B
C
#include "../test.h"
|
|
#include "arc/std/errno.h"
|
|
#include "arc/std/config.h"
|
|
#include <stdlib.h>
|
|
|
|
ARC_TEST(config_BasicTest){
|
|
ARC_Config *config;
|
|
ARC_Config_Create(&config);
|
|
|
|
ARC_CHECK(arc_errno == 0);
|
|
|
|
ARC_Config_InitStd(config);
|
|
|
|
char *tempCString = "tests/res/std/config/first.chemical";
|
|
ARC_String *tempString;
|
|
ARC_String_CreateWithStrlen(&tempString, tempCString);
|
|
ARC_Config_LoadFromFile(config, tempString);
|
|
|
|
int32_t testVal = *(int32_t *)ARC_Config_GetWithCStr(config, "test::test");
|
|
ARC_CHECK(testVal == 5);
|
|
testVal = *(int32_t *)ARC_Config_GetWithCStr(config, "test::test1");
|
|
ARC_CHECK(testVal == -7);
|
|
|
|
ARC_Config_UnloadFromFile(config, tempString);
|
|
|
|
void *nullVal = ARC_Config_GetWithCStr(config, "test::test");
|
|
ARC_CHECK(nullVal == NULL);
|
|
|
|
//cleanup
|
|
ARC_String_Destroy(tempString);
|
|
ARC_Config_Destroy(config);
|
|
}
|