summaryrefslogtreecommitdiff
path: root/src/lib/tests
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-09-21 14:58:07 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-09-21 14:58:07 +0000
commite2d3b18ab787ebe090cd958cc63be655be86f42c (patch)
treea51f0260c4445ddf35fb190e605704669e84bb94 /src/lib/tests
parente5336f1309c42da770ef7aa603b463ad4d24e2c9 (diff)
parentf6071ecf0cd3768eaed9a847f676433c120ea89e (diff)
downloadouroboros-e2d3b18ab787ebe090cd958cc63be655be86f42c.tar.gz
ouroboros-e2d3b18ab787ebe090cd958cc63be655be86f42c.zip
Merged in sandervrijders/ouroboros/be-lfa-pff (pull request #607)
ipcpd: normal: Add alternate hop PFF
Diffstat (limited to 'src/lib/tests')
-rw-r--r--src/lib/tests/hashtable_test.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/tests/hashtable_test.c b/src/lib/tests/hashtable_test.c
index 9d5917f4..36f68ebf 100644
--- a/src/lib/tests/hashtable_test.c
+++ b/src/lib/tests/hashtable_test.c
@@ -30,8 +30,10 @@
int hashtable_test(int argc, char ** argv)
{
struct htable * table;
- int i;
- int * j;
+ int i;
+ int * j;
+ void * el;
+ size_t len;
(void) argc;
(void) argv;
@@ -59,20 +61,20 @@ int hashtable_test(int argc, char ** argv)
}
*j = i;
- if (htable_insert(table, i, (void *) j)) {
+ if (htable_insert(table, i, (void *) j, 1)) {
printf("Failed to insert.\n");
htable_destroy(table);
return -1;
}
}
- j = (int *) htable_lookup(table, INT_TEST);
- if (j == NULL) {
+ if (htable_lookup(table, INT_TEST, &el, &len)) {
printf("Failed to lookup.\n");
htable_destroy(table);
return -1;
}
+ j = (int *) el;
if (*j != INT_TEST) {
printf("Lookup returned wrong value (%d != %d).\n",
INT_TEST, *j);
@@ -80,13 +82,13 @@ int hashtable_test(int argc, char ** argv)
return -1;
}
- j = (int *) htable_lookup(table, HASHTABLE_SIZE + INT_TEST);
- if (j == NULL) {
+ if (htable_lookup(table, HASHTABLE_SIZE + INT_TEST, &el, &len)) {
printf("Failed to lookup.\n");
htable_destroy(table);
return -1;
}
+ j = (int *) el;
if (*j != HASHTABLE_SIZE + INT_TEST) {
printf("Lookup returned wrong value (%d != %d).\n",
INT_TEST, *j);
@@ -100,20 +102,19 @@ int hashtable_test(int argc, char ** argv)
return -1;
}
- j = (int *) htable_lookup(table, INT_TEST);
- if (j != NULL) {
+ if (htable_lookup(table, INT_TEST, &el, &len) == 0) {
printf("Failed to delete properly.\n");
htable_destroy(table);
return -1;
}
- j = (int *) htable_lookup(table, HASHTABLE_SIZE + INT_TEST);
- if (j == NULL) {
+ if (htable_lookup(table, HASHTABLE_SIZE + INT_TEST, &el, &len)) {
printf("Failed to lookup after deletion.\n");
htable_destroy(table);
return -1;
}
+ j = (int *) el;
if (*j != HASHTABLE_SIZE + INT_TEST) {
printf("Lookup returned wrong value (%d != %d).\n",
INT_TEST, *j);