@@ -962,3 +962,30 @@ void Test_iniparser_dumpsection_ini(CuTest *tc)
962
962
CuAssertStrEquals (tc ,"321abc" ,iniparser_getstring (dic ,"section:key1" ,NULL ));
963
963
iniparser_freedict (dic );
964
964
}
965
+
966
+ void Test_iniparser_find_entry (CuTest * tc )
967
+ {
968
+ dictionary * dic ;
969
+ int i ;
970
+ /* NULL test */
971
+ CuAssertIntEquals (tc , 0 , iniparser_find_entry (NULL , NULL ));
972
+ CuAssertIntEquals (tc , 0 , iniparser_find_entry (NULL , "dummy" ));
973
+
974
+ /* Empty dictionary test*/
975
+ dic = dictionary_new (10 );
976
+ CuAssertPtrNotNull (tc , dic );
977
+ CuAssertIntEquals (tc , 0 , iniparser_find_entry (dic , NULL ));
978
+ CuAssertIntEquals (tc , 0 , iniparser_find_entry (dic , "dummy" ));
979
+ dictionary_del (dic );
980
+
981
+ /*Regular dictionary */
982
+ dic = generate_dictionary (1 , 8 );
983
+ CuAssertPtrNotNull (tc , dic );
984
+ for (i = 1 ; i < 8 ; i ++ )
985
+ {
986
+ CuAssertIntEquals (tc , 1 , iniparser_find_entry (dic , dic -> key [i ]));
987
+ }
988
+ CuAssertIntEquals (tc , 0 , iniparser_find_entry (dic , "dummy" ));
989
+
990
+ iniparser_freedict (dic );
991
+ }
0 commit comments