Fixing hashset and hashmap error with a pointer data type and adding a test to address that

This commit is contained in:
Leonardo committed 2019-05-04 00:06:27 -03:00
1 parent f0b763afba
commit d89972c621
4 files changed
+34 -5

No files matched your search

+2 -1
View File
@@ -18,4 +18,5 @@ script:
- ./iterators
- gcc contains.c -Wall -Wextra -o contains -std=c11
- ./contains
- gcc pointertype.c -Wall -Wextra -o pointertype -std=c11
- ./pointertype
+4 -2
View File
@@ -295,7 +295,8 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531,
return false; \
\
SNAME##_iter iter; \
K result_key, max_key; \
K result_key; \
K max_key; \
V result_value; \
size_t index; \
\
@@ -326,7 +327,8 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531,
return false; \
\
SNAME##_iter iter; \
K result_key, min_key; \
K result_key; \
K min_key; \
V result_value; \
size_t index; \
\
+4 -2
View File
@@ -289,7 +289,8 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531,
if (PFX##_empty(_set_)) \
return 0; \
\
V result, max; \
V result; \
V max; \
size_t index; \
SNAME##_iter iter; \
\
@@ -311,7 +312,8 @@ static const size_t cmc_hashtable_primes[] = {53, 97, 191, 383, 769, 1531,
if (PFX##_empty(_set_)) \
return 0; \
\
V result, min; \
V result; \
V min; \
size_t index; \
SNAME##_iter iter; \
\
+24
View File
@@ -0,0 +1,24 @@
// Tests all containers if they accept a pinter type
// Compile with -Wall -Wextra
#include "../src/macro_collections.h"
#include <stdio.h>
COLLECTION_GENERATE(LIST, PUBLIC, l, list, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(STACK, PUBLIC, s, stack, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(QUEUE, PUBLIC, q, queue, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(DEQUE, PUBLIC, d, deque, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(LINKEDLIST, PUBLIC, ll, linked, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(HEAP, PUBLIC, h, heap, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(TREESET, PUBLIC, ts, tset, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(TREEMAP, PUBLIC, tm, tmap, /* FMOD */, char *, char *)
COLLECTION_GENERATE(HASHSET, PUBLIC, hs, hset, /* FMOD */, /* K */, char *)
COLLECTION_GENERATE(HASHMAP, PUBLIC, hm, hmap, /* FMOD */, char *, char *)
int main(void)
{
printf("+--------------------------------------------------+\n");
printf("| Pointer Data Type is Working |\n");
printf("+--------------------------------------------------+\n");
return 0;
}