tests/hash: enable the test

This commit is contained in:
Dmitry Podgorny
2017-06-24 14:18:35 +03:00
parent a845c7ec3d
commit 82040403bf
2 changed files with 18 additions and 0 deletions

View File

@@ -76,6 +76,18 @@ int main(int argc, char **argv)
return 1;
}
/* test replacing old values */
for (i = 0; i < nkeys; i++) {
err = hash_add(table, keys[0], (void*)values[i]);
if (err) return err;
if (hash_num_keys(table) != nkeys) return 1;
result = hash_get(table, keys[0]);
if (result == NULL) return 1;
if (strcmp(result, values[i]) != 0) return 1;
}
/* restore value for the 1st key */
hash_add(table, keys[0], (void*)values[0]);
/* test cloning */
clone = hash_clone(table);