tests/hash: enable the test
This commit is contained in:
@@ -134,6 +134,7 @@ TESTS = \
|
|||||||
tests/test_scram \
|
tests/test_scram \
|
||||||
tests/test_ctx \
|
tests/test_ctx \
|
||||||
tests/test_base64 \
|
tests/test_base64 \
|
||||||
|
tests/test_hash \
|
||||||
tests/test_jid \
|
tests/test_jid \
|
||||||
tests/test_snprintf \
|
tests/test_snprintf \
|
||||||
tests/test_string \
|
tests/test_string \
|
||||||
@@ -157,6 +158,11 @@ tests_test_base64_CFLAGS = $(STROPHE_FLAGS) -I$(top_srcdir)/src
|
|||||||
tests_test_base64_LDADD = $(STROPHE_LIBS)
|
tests_test_base64_LDADD = $(STROPHE_LIBS)
|
||||||
tests_test_base64_LDFLAGS = -static
|
tests_test_base64_LDFLAGS = -static
|
||||||
|
|
||||||
|
tests_test_hash_SOURCES = tests/test_hash.c
|
||||||
|
tests_test_hash_CFLAGS = $(STROPHE_FLAGS) -I$(top_srcdir)/src
|
||||||
|
tests_test_hash_LDADD = $(STROPHE_LIBS)
|
||||||
|
tests_test_hash_LDFLAGS = -static
|
||||||
|
|
||||||
tests_test_jid_SOURCES = tests/test_jid.c
|
tests_test_jid_SOURCES = tests/test_jid.c
|
||||||
tests_test_jid_CFLAGS = $(STROPHE_FLAGS) -I$(top_srcdir)/src
|
tests_test_jid_CFLAGS = $(STROPHE_FLAGS) -I$(top_srcdir)/src
|
||||||
tests_test_jid_LDADD = $(STROPHE_LIBS)
|
tests_test_jid_LDADD = $(STROPHE_LIBS)
|
||||||
|
|||||||
@@ -76,6 +76,18 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
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 */
|
/* test cloning */
|
||||||
clone = hash_clone(table);
|
clone = hash_clone(table);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user