Skip to content

Commit

Permalink
Merge branch 'zrrto-test_find_entry'
Browse files Browse the repository at this point in the history
  • Loading branch information
lmoellendorf committed Mar 2, 2024
2 parents 5ea02a8 + 5e5931c commit e4a58fc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_iniparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,3 +962,30 @@ void Test_iniparser_dumpsection_ini(CuTest *tc)
CuAssertStrEquals(tc,"321abc",iniparser_getstring(dic,"section:key1",NULL));
iniparser_freedict(dic);
}

void Test_iniparser_find_entry(CuTest *tc)
{
dictionary *dic;
int i;
/* NULL test */
CuAssertIntEquals(tc, 0, iniparser_find_entry(NULL, NULL));
CuAssertIntEquals(tc, 0, iniparser_find_entry(NULL, "dummy"));

/* Empty dictionary test*/
dic = dictionary_new(10);
CuAssertPtrNotNull(tc, dic);
CuAssertIntEquals(tc, 0, iniparser_find_entry(dic, NULL));
CuAssertIntEquals(tc, 0, iniparser_find_entry(dic, "dummy"));
dictionary_del(dic);

/*Regular dictionary */
dic = generate_dictionary(1, 8);
CuAssertPtrNotNull(tc, dic);
for (i = 1; i < 8; i++)
{
CuAssertIntEquals(tc, 1, iniparser_find_entry(dic, dic->key[i]));
}
CuAssertIntEquals(tc, 0, iniparser_find_entry(dic, "dummy"));

iniparser_freedict(dic);
}

0 comments on commit e4a58fc

Please sign in to comment.