Test: Actually add CInema core config loading

This commit is contained in:
Vicki Pfau 2020-06-25 02:12:27 -07:00
parent e1bd52a3d0
commit 469f2d9940
1 changed files with 30 additions and 1 deletions

View File

@ -303,7 +303,36 @@ bool CInemaConfigGetUInt(struct Table* configTree, const char* testName, const c
void CInemaConfigLoad(struct Table* configTree, const char* testName, struct mCore* core) {
_loadConfigTree(configTree, testName);
// TODO: Write
char testKey[MAX_TEST] = {0};
char* keyEnd = testKey;
const char* pos;
while (true) {
pos = strchr(testName, '.');
size_t maxlen = sizeof(testKey) - (keyEnd - testKey) - 1;
size_t len;
if (pos) {
len = pos - testName;
} else {
len = strlen(testName);
}
if (len > maxlen) {
len = maxlen;
}
strncpy(keyEnd, testName, len);
keyEnd += len;
struct mCoreConfig* config = HashTableLookup(configTree, testKey);
if (config) {
core->loadConfig(core, config);
}
if (!pos) {
break;
}
testName = pos + 1;
keyEnd[0] = '.';
++keyEnd;
}
}
bool CInemaTestInit(struct CInemaTest* test, const char* directory, const char* filename) {