Skip to content

Commit

Permalink
Add a test for HASH_ADD_KEYPTR_BYHASHVALUE_INORDER.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quuxplusone committed Aug 3, 2016
1 parent bf8b696 commit f45c373
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test87.ans
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,29 @@
15: muh8
16: muh7
###
2: muh1
3: muh5
5: muh6
6: muh9
7: muh12
8: muh4
9: muh10
9: muh3
10: muh11
15: muh8
16: muh7
###
2: muh1
3: muh5
5: muh6
6: muh9
7: muh12
8: muh4
8: muh2
9: muh10
9: muh3
10: muh11
15: muh8
16: muh7
###
###
11 changes: 11 additions & 0 deletions tests/test87.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ int main()

printtable(hTable);

// remove "8: muh2"...
HASH_DELETE(hh, hTable, &tst[1]);

printtable(hTable);

// ...and then reinsert "8: muh2"
HASH_VALUE(tst[1].name, strlen(tst[1].name), hashvalue);
HASH_ADD_KEYPTR_BYHASHVALUE_INORDER(hh, hTable, tst[1].name, strlen(tst[1].name), hashvalue, &tst[1], CMPFUNC);

printtable(hTable);

delitem(&hTable, "muh1");
delitem(&hTable, "muh7");
delitem(&hTable, "muh3");
Expand Down

0 comments on commit f45c373

Please sign in to comment.