Completely removed typedefs

This commit is contained in:
Leonardo committed 2019-10-29 02:19:34 -03:00
1 parent db61269d42
commit 33c33e8947
55 files changed
+8637 -8651

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@
int main(void)
{
cmc_timer timer;
struct cmc_timer timer;
cmc_timer_start(timer);
uintmax_t failed = 0;
+3 -3
View File
@@ -52,7 +52,7 @@ size_t bm_capacity(bidimap *_map_);
double bm_load(bidimap *_map_);
bidimap *bm_copy_of(bidimap *_map_, size_t (*key_copy_func)(size_t), size_t (*value_copy_func)(size_t));
_Bool bm_equals(bidimap *_map1_, bidimap *_map2_);
cmc_string bm_to_string(bidimap *_map_);
struct cmc_string bm_to_string(bidimap *_map_);
bidimap_iter *bm_iter_new(bidimap *target);
void bm_iter_free(bidimap_iter *iter);
void bm_iter_init(bidimap_iter *iter, bidimap *target);
@@ -201,9 +201,9 @@ size_t bm_capacity(bidimap *_map_) { return _map_->capacity; }
double bm_load(bidimap *_map_) { return _map_->load; }
bidimap *bm_copy_of(bidimap *_map_, size_t (*key_copy_func)(size_t), size_t (*value_copy_func)(size_t)) { return ((void *)0); }
_Bool bm_equals(bidimap *_map1_, bidimap *_map2_) { return 0; }
cmc_string bm_to_string(bidimap *_map_)
struct cmc_string bm_to_string(bidimap *_map_)
{
cmc_string str;
struct cmc_string str;
bidimap *m_ = _map_;
const char *name = "bidimap";
snprintf(str.s, cmc_string_len, cmc_string_fmt_bidimap, name, m_, m_->key_buffer, m_->val_buffer, m_->capacity, m_->count, m_->load, m_->key_cmp, m_->val_cmp, m_->key_hash, m_->val_hash);
+3 -3
View File
@@ -37,7 +37,7 @@ size_t d_capacity(deque *_deque_);
_Bool d_resize(deque *_deque_, size_t capacity);
deque *d_copy_of(deque *_deque_, size_t (*copy_func)(size_t));
_Bool d_equals(deque *_deque1_, deque *_deque2_, int (*comparator)(size_t, size_t));
cmc_string d_to_string(deque *_deque_);
struct cmc_string d_to_string(deque *_deque_);
deque_iter *d_iter_new(deque *target);
void d_iter_free(deque_iter *iter);
void d_iter_init(deque_iter *iter, deque *target);
@@ -232,9 +232,9 @@ _Bool d_equals(deque *_deque1_, deque *_deque2_, int (*comparator)(size_t, size_
}
return 1;
}
cmc_string d_to_string(deque *_deque_)
struct cmc_string d_to_string(deque *_deque_)
{
cmc_string str;
struct cmc_string str;
deque *d_ = _deque_;
const char *name = "deque";
snprintf(str.s, cmc_string_len, cmc_string_fmt_deque, name, d_, d_->buffer, d_->capacity, d_->count, d_->front, d_->back);
+4 -4
View File
@@ -18,7 +18,7 @@ typedef struct hashmap_entry_s
size_t key;
size_t value;
size_t dist;
enum cmc_entry_state_e state;
enum cmc_entry_state state;
} hashmap_entry, *hashmap_entry_ptr;
typedef struct hashmap_iter_s
{
@@ -49,7 +49,7 @@ double hm_load(hashmap *_map_);
_Bool hm_resize(hashmap *_map_, size_t capacity);
hashmap *hm_copy_of(hashmap *_map_, size_t (*key_copy_func)(size_t), size_t (*value_copy_func)(size_t));
_Bool hm_equals(hashmap *_map1_, hashmap *_map2_, int (*value_comparator)(size_t, size_t));
cmc_string hm_to_string(hashmap *_map_);
struct cmc_string hm_to_string(hashmap *_map_);
hashmap_iter *hm_iter_new(hashmap *target);
void hm_iter_free(hashmap_iter *iter);
void hm_iter_init(hashmap_iter *iter, hashmap *target);
@@ -363,9 +363,9 @@ _Bool hm_equals(hashmap *_map1_, hashmap *_map2_, int (*value_comparator)(size_t
}
return 1;
}
cmc_string hm_to_string(hashmap *_map_)
struct cmc_string hm_to_string(hashmap *_map_)
{
cmc_string str;
struct cmc_string str;
hashmap *m_ = _map_;
const char *name = "hashmap";
snprintf(str.s, cmc_string_len, cmc_string_fmt_hashmap, name, m_, m_->buffer, m_->capacity, m_->count, m_->load, m_->cmp, m_->hash);
+4 -4
View File
@@ -17,7 +17,7 @@ typedef struct hashset_entry_s
{
size_t value;
size_t dist;
enum cmc_entry_state_e state;
enum cmc_entry_state state;
} hashset_entry, *hashset_entry_ptr;
typedef struct hashset_iter_s
{
@@ -45,7 +45,7 @@ double hs_load(hashset *_set_);
_Bool hs_resize(hashset *_set_, size_t capacity);
hashset *hs_copy_of(hashset *_set_, size_t (*copy_func)(size_t));
_Bool hs_equals(hashset *_set1_, hashset *_set2_);
cmc_string hs_to_string(hashset *_set_);
struct cmc_string hs_to_string(hashset *_set_);
hashset *hs_union(hashset *_set1_, hashset *_set2_);
hashset *hs_intersection(hashset *_set1_, hashset *_set2_);
hashset *hs_difference(hashset *_set1_, hashset *_set2_);
@@ -304,9 +304,9 @@ _Bool hs_equals(hashset *_set1_, hashset *_set2_)
}
return 1;
}
cmc_string hs_to_string(hashset *_set_)
struct cmc_string hs_to_string(hashset *_set_)
{
cmc_string str;
struct cmc_string str;
hashset *s_ = _set_;
const char *name = "hashset";
snprintf(str.s, cmc_string_len, cmc_string_fmt_hashset, name, s_, s_->buffer, s_->capacity, s_->count, s_->load, s_->cmp, s_->hash);
+6 -6
View File
@@ -7,7 +7,7 @@ typedef struct heap_s
size_t *buffer;
size_t capacity;
size_t count;
enum cmc_heap_order_e HO;
enum cmc_heap_order HO;
int (*cmp)(size_t, size_t);
struct heap_iter_s (*it_start)(struct heap_s *);
struct heap_iter_s (*it_end)(struct heap_s *);
@@ -19,7 +19,7 @@ typedef struct heap_iter_s
_Bool start;
_Bool end;
} heap_iter, *heap_iter_ptr;
heap *h_new(size_t capacity, cmc_heap_order HO, int (*compare)(size_t, size_t));
heap *h_new(size_t capacity, enum cmc_heap_order HO, int (*compare)(size_t, size_t));
void h_clear(heap *_heap_, void (*deallocator)(size_t));
void h_free(heap *_heap_, void (*deallocator)(size_t));
_Bool h_insert(heap *_heap_, size_t element);
@@ -33,7 +33,7 @@ size_t h_capacity(heap *_heap_);
_Bool h_resize(heap *_heap_, size_t capacity);
heap *h_copy_of(heap *_heap_, size_t (*copy_func)(size_t));
_Bool h_equals(heap *_heap1_, heap *_heap2_);
cmc_string h_to_string(heap *_heap_);
struct cmc_string h_to_string(heap *_heap_);
heap_iter *h_iter_new(heap *target);
void h_iter_free(heap_iter *iter);
void h_iter_init(heap_iter *iter, heap *target);
@@ -52,7 +52,7 @@ static _Bool h_impl_float_up(heap *_heap_, size_t index);
static _Bool h_impl_float_down(heap *_heap_, size_t index);
static heap_iter h_impl_it_start(heap *_heap_);
static heap_iter h_impl_it_end(heap *_heap_);
heap *h_new(size_t capacity, cmc_heap_order HO, int (*compare)(size_t, size_t))
heap *h_new(size_t capacity, enum cmc_heap_order HO, int (*compare)(size_t, size_t))
{
if (capacity < 1)
return ((void *)0);
@@ -187,9 +187,9 @@ _Bool h_equals(heap *_heap1_, heap *_heap2_)
}
return 1;
}
cmc_string h_to_string(heap *_heap_)
struct cmc_string h_to_string(heap *_heap_)
{
cmc_string str;
struct cmc_string str;
heap *h_ = _heap_;
const char *name = "heap";
const char *t = h_->HO == 1 ? "MaxHeap" : "MinHeap";
+3 -3
View File
@@ -41,7 +41,7 @@ size_t ih_capacity(intervalheap *_heap_);
_Bool ih_resize(intervalheap *_heap_, size_t capacity);
intervalheap *ih_copy_of(intervalheap *_set_, size_t (*copy_func)(size_t));
_Bool ih_equals(intervalheap *_heap1_, intervalheap *_heap2_);
cmc_string ih_to_string(intervalheap *_heap_);
struct cmc_string ih_to_string(intervalheap *_heap_);
intervalheap_iter *ih_iter_new(intervalheap *target);
void ih_iter_free(intervalheap_iter *iter);
void ih_iter_init(intervalheap_iter *iter, intervalheap *target);
@@ -323,9 +323,9 @@ _Bool ih_equals(intervalheap *_heap1_, intervalheap *_heap2_)
}
return 0;
}
cmc_string ih_to_string(intervalheap *_heap_)
struct cmc_string ih_to_string(intervalheap *_heap_)
{
cmc_string str;
struct cmc_string str;
intervalheap *h_ = _heap_;
const char *name = "intervalheap";
snprintf(str.s, cmc_string_len, cmc_string_fmt_intervalheap, name, h_, h_->buffer, h_->capacity, h_->size, h_->count, h_->cmp);
+3 -3
View File
@@ -42,7 +42,7 @@ _Bool ll_empty(linkedlist *_list_);
size_t ll_count(linkedlist *_list_);
linkedlist *ll_copy_of(linkedlist *_list_, size_t (*copy_func)(size_t));
_Bool ll_equals(linkedlist *_list1_, linkedlist *_list2_, int (*comparator)(size_t, size_t));
cmc_string ll_to_string(linkedlist *_list_);
struct cmc_string ll_to_string(linkedlist *_list_);
linkedlist_node *ll_new_node(size_t element);
void ll_free_node(linkedlist_node *_node_);
linkedlist_node *ll_head(linkedlist *_list_);
@@ -308,9 +308,9 @@ _Bool ll_equals(linkedlist *_list1_, linkedlist *_list2_, int (*comparator)(size
}
return 1;
}
cmc_string ll_to_string(linkedlist *_list_)
struct cmc_string ll_to_string(linkedlist *_list_)
{
cmc_string str;
struct cmc_string str;
linkedlist *l_ = _list_;
const char *name = "linkedlist";
snprintf(str.s, cmc_string_len, cmc_string_fmt_linkedlist, name, l_, l_->count, l_->head, l_->tail);
+3 -3
View File
@@ -46,7 +46,7 @@ size_t l_capacity(list *_list_);
_Bool l_resize(list *_list_, size_t capacity);
list *l_copy_of(list *_list_, size_t (*copy_func)(size_t));
_Bool l_equals(list *_list1_, list *_list2_, int (*comparator)(size_t, size_t));
cmc_string l_to_string(list *_list_);
struct cmc_string l_to_string(list *_list_);
list_iter *l_iter_new(list *target);
void l_iter_free(list_iter *iter);
void l_iter_init(list_iter *iter, list *target);
@@ -349,9 +349,9 @@ _Bool l_equals(list *_list1_, list *_list2_, int (*comparator)(size_t, size_t))
}
return 0;
}
cmc_string l_to_string(list *_list_)
struct cmc_string l_to_string(list *_list_)
{
cmc_string str;
struct cmc_string str;
list *l_ = _list_;
const char *name = "list";
snprintf(str.s, cmc_string_len, cmc_string_fmt_list, name, l_, l_->buffer, l_->capacity, l_->count);
+3 -3
View File
@@ -53,7 +53,7 @@ double mm_load(multimap *_map_);
_Bool mm_resize(multimap *_map_, size_t capacity);
multimap *mm_copy_of(multimap *_map_, size_t (*key_copy_func)(size_t), size_t (*value_copy_func)(size_t));
_Bool mm_equals(multimap *_map1_, multimap *_map2_, _Bool ignore_key_count);
cmc_string mm_to_string(multimap *_map_);
struct cmc_string mm_to_string(multimap *_map_);
multimap_iter *mm_iter_new(multimap *target);
void mm_iter_free(multimap_iter *iter);
void mm_iter_init(multimap_iter *iter, multimap *target);
@@ -483,9 +483,9 @@ _Bool mm_equals(multimap *_map1_, multimap *_map2_, _Bool ignore_key_count)
}
return 1;
}
cmc_string mm_to_string(multimap *_map_)
struct cmc_string mm_to_string(multimap *_map_)
{
cmc_string str;
struct cmc_string str;
multimap *m_ = _map_;
const char *name = "multimap";
snprintf(str.s, cmc_string_len, cmc_string_fmt_multimap, name, m_, m_->buffer, m_->capacity, m_->count, m_->load, m_->cmp, m_->hash);
+4 -4
View File
@@ -19,7 +19,7 @@ typedef struct multiset_entry_s
size_t value;
size_t multiplicity;
size_t dist;
enum cmc_entry_state_e state;
enum cmc_entry_state state;
} multiset_entry, *multiset_entry_ptr;
typedef struct multiset_iter_s
{
@@ -52,7 +52,7 @@ double ms_load(multiset *_set_);
_Bool ms_resize(multiset *_set_, size_t capacity);
multiset *ms_copy_of(multiset *_set_, size_t (*copy_func)(size_t));
_Bool ms_equals(multiset *_set1_, multiset *_set2_, _Bool ignore_multiplicity);
cmc_string ms_to_string(multiset *_set_);
struct cmc_string ms_to_string(multiset *_set_);
multiset *ms_union(multiset *_set1_, multiset *_set2_);
multiset *ms_intersection(multiset *_set1_, multiset *_set2_);
multiset *ms_difference(multiset *_set1_, multiset *_set2_);
@@ -344,9 +344,9 @@ _Bool ms_equals(multiset *_set1_, multiset *_set2_, _Bool ignore_multiplicity)
}
return 1;
}
cmc_string ms_to_string(multiset *_set_)
struct cmc_string ms_to_string(multiset *_set_)
{
cmc_string str;
struct cmc_string str;
multiset *s_ = _set_;
const char *name = "multiset";
snprintf(str.s, cmc_string_len, cmc_string_fmt_multiset, name, s_, s_->buffer, s_->capacity, s_->count, s_->cardinality, s_->load, s_->cmp, s_->hash);
+3 -3
View File
@@ -34,7 +34,7 @@ size_t q_capacity(queue *_queue_);
_Bool q_resize(queue *_queue_, size_t capacity);
queue *q_copy_of(queue *_queue_, size_t (*copy_func)(size_t));
_Bool q_equals(queue *_queue1_, queue *_queue2_, int (*comparator)(size_t, size_t));
cmc_string q_to_string(queue *_queue_);
struct cmc_string q_to_string(queue *_queue_);
queue_iter *q_iter_new(queue *target);
void q_iter_free(queue_iter *iter);
void q_iter_init(queue_iter *iter, queue *target);
@@ -202,9 +202,9 @@ _Bool q_equals(queue *_queue1_, queue *_queue2_, int (*comparator)(size_t, size_
}
return 1;
}
cmc_string q_to_string(queue *_queue_)
struct cmc_string q_to_string(queue *_queue_)
{
cmc_string str;
struct cmc_string str;
queue *q_ = _queue_;
const char *name = "queue";
snprintf(str.s, cmc_string_len, cmc_string_fmt_queue, name, q_, q_->buffer, q_->capacity, q_->count, q_->front, q_->back);
+3 -3
View File
@@ -37,7 +37,7 @@ _Bool sl_resize(sortedlist *_list_, size_t capacity);
void sl_sort(sortedlist *_list_);
sortedlist *sl_copy_of(sortedlist *_list_, size_t (*copy_func)(size_t));
_Bool sl_equals(sortedlist *_list1_, sortedlist *_list2_);
cmc_string sl_to_string(sortedlist *_list_);
struct cmc_string sl_to_string(sortedlist *_list_);
sortedlist_iter *sl_iter_new(sortedlist *target);
void sl_iter_free(sortedlist_iter *iter);
void sl_iter_init(sortedlist_iter *iter, sortedlist *target);
@@ -208,9 +208,9 @@ _Bool sl_equals(sortedlist *_list1_, sortedlist *_list2_)
}
return 0;
}
cmc_string sl_to_string(sortedlist *_list_)
struct cmc_string sl_to_string(sortedlist *_list_)
{
cmc_string str;
struct cmc_string str;
sortedlist *l_ = _list_;
const char *name = "sortedlist";
snprintf(str.s, cmc_string_len, cmc_string_fmt_sortedlist, name, l_, l_->buffer, l_->capacity, l_->count, l_->is_sorted ? "true" : "false", l_->cmp);
+3 -3
View File
@@ -31,7 +31,7 @@ size_t s_capacity(stack *_stack_);
_Bool s_resize(stack *_stack_, size_t capacity);
stack *s_copy_of(stack *_stack_, size_t (*copy_func)(size_t));
_Bool s_equals(stack *_stack1_, stack *_stack2_, int (*comparator)(size_t, size_t));
cmc_string s_to_string(stack *_stack_);
struct cmc_string s_to_string(stack *_stack_);
stack_iter *s_iter_new(stack *target);
void s_iter_free(stack_iter *iter);
void s_iter_init(stack_iter *iter, stack *target);
@@ -164,9 +164,9 @@ _Bool s_equals(stack *_stack1_, stack *_stack2_, int (*comparator)(size_t, size_
}
return 1;
}
cmc_string s_to_string(stack *_stack_)
struct cmc_string s_to_string(stack *_stack_)
{
cmc_string str;
struct cmc_string str;
stack *s_ = _stack_;
const char *name = "stack";
snprintf(str.s, cmc_string_len, cmc_string_fmt_stack, name, s_, s_->buffer, s_->capacity, s_->count);
+3 -3
View File
@@ -44,7 +44,7 @@ _Bool tm_empty(treemap *_map_);
size_t tm_count(treemap *_map_);
treemap *tm_copy_of(treemap *_map_, size_t (*key_copy_func)(size_t), size_t (*value_copy_func)(size_t));
_Bool tm_equals(treemap *_map1_, treemap *_map2_, int (*value_comparator)(size_t, size_t));
cmc_string tm_to_string(treemap *_map_);
struct cmc_string tm_to_string(treemap *_map_);
treemap_iter *tm_iter_new(treemap *target);
void tm_iter_free(treemap_iter *iter);
void tm_iter_init(treemap_iter *iter, treemap *target);
@@ -387,9 +387,9 @@ _Bool tm_equals(treemap *_map1_, treemap *_map2_, int (*value_comparator)(size_t
}
return 1;
}
cmc_string tm_to_string(treemap *_map_)
struct cmc_string tm_to_string(treemap *_map_)
{
cmc_string str;
struct cmc_string str;
treemap *m_ = _map_;
const char *name = "treemap";
snprintf(str.s, cmc_string_len, cmc_string_fmt_treemap, name, m_, m_->root, m_->count, m_->cmp);
+3 -3
View File
@@ -40,7 +40,7 @@ _Bool ts_empty(treeset *_set_);
size_t ts_count(treeset *_set_);
treeset *ts_copy_of(treeset *_set_, size_t (*copy_func)(size_t));
_Bool ts_equals(treeset *_set1_, treeset *_set2_);
cmc_string ts_to_string(treeset *_set_);
struct cmc_string ts_to_string(treeset *_set_);
treeset *ts_union(treeset *_set1_, treeset *_set2_);
treeset *ts_intersection(treeset *_set1_, treeset *_set2_);
treeset *ts_difference(treeset *_set1_, treeset *_set2_);
@@ -357,9 +357,9 @@ _Bool ts_equals(treeset *_set1_, treeset *_set2_)
}
return 1;
}
cmc_string ts_to_string(treeset *_set_)
struct cmc_string ts_to_string(treeset *_set_)
{
cmc_string str;
struct cmc_string str;
treeset *s_ = _set_;
const char *name = "treeset";
snprintf(str.s, cmc_string_len, cmc_string_fmt_treeset, name, s_, s_->root, s_->count, s_->cmp);
+13 -14
View File
@@ -37,20 +37,19 @@ CMC_COLLECTION_GENERATE(MULTISET, ms, mset, , int)
int main(void)
{
list *l = l_new(1000);
stack *s = s_new(1000);
queue *q = q_new(1000);
deque *d = d_new(1000);
linked *ll = ll_new();
heap *h = h_new(1000, cmc_max_heap, intcmp);
tset *ts = ts_new(intcmp);
tmap *tm = tm_new(intcmp);
hset *hs = hs_new(1000, 0.6, intcmp, inthash);
hmap *hm = hm_new(1000, 0.6, intcmp, inthash);
iheap *ih = ih_new(1000, intcmp);
mmap *mm = mm_new(1000, 0.8, intcmp, inthash);
mset *ms = ms_new(1000, 0.6, intcmp, inthash);
struct list *l = l_new(1000);
struct stack *s = s_new(1000);
struct queue *q = q_new(1000);
struct deque *d = d_new(1000);
struct linked *ll = ll_new();
struct heap *h = h_new(1000, cmc_max_heap, intcmp);
struct tset *ts = ts_new(intcmp);
struct tmap *tm = tm_new(intcmp);
struct hset *hs = hs_new(1000, 0.6, intcmp, inthash);
struct hmap *hm = hm_new(1000, 0.6, intcmp, inthash);
struct iheap *ih = ih_new(1000, intcmp);
struct mmap *mm = mm_new(1000, 0.8, intcmp, inthash);
struct mset *ms = ms_new(1000, 0.6, intcmp, inthash);
bool a[13] = {false, false, false, false, false, false, false, false, false, false, false, false, false},
b[13] = {false, false, false, false, false, false, false, false, false, false, false, false, false},
+13 -14
View File
@@ -37,20 +37,19 @@ CMC_COLLECTION_GENERATE(MULTISET, ms, mset, , int)
int main(void)
{
list *l = l_new(1000);
stack *s = s_new(1000);
queue *q = q_new(1000);
deque *d = d_new(1000);
linked *ll = ll_new();
heap *h = h_new(1000, cmc_max_heap, intcmp);
tset *ts = ts_new(intcmp);
tmap *tm = tm_new(intcmp);
hset *hs = hs_new(1000, 0.6, intcmp, inthash);
hmap *hm = hm_new(1000, 0.6, intcmp, inthash);
iheap *ih = ih_new(1000, intcmp);
mmap *mm = mm_new(1000, 0.8, intcmp, inthash);
mset *ms = ms_new(1000, 0.6, intcmp, inthash);
struct list *l = l_new(1000);
struct stack *s = s_new(1000);
struct queue *q = q_new(1000);
struct deque *d = d_new(1000);
struct linked *ll = ll_new();
struct heap *h = h_new(1000, cmc_max_heap, intcmp);
struct tset *ts = ts_new(intcmp);
struct tmap *tm = tm_new(intcmp);
struct hset *hs = hs_new(1000, 0.6, intcmp, inthash);
struct hmap *hm = hm_new(1000, 0.6, intcmp, inthash);
struct iheap *ih = ih_new(1000, intcmp);
struct mmap *mm = mm_new(1000, 0.8, intcmp, inthash);
struct mset *ms = ms_new(1000, 0.6, intcmp, inthash);
bool p = true;
+2 -2
View File
@@ -39,13 +39,13 @@ CMC_COLLECTION_GENERATE(MULTISET, ms, mset, /* K */, int)
int sum1 = 0; \
double sum2 = 0.0; \
\
sname *coll = initfunc; \
struct sname *coll = initfunc; \
for (int i = 0; i < 10; i++) \
{ \
insertbody; \
} \
\
sname##_iter iter; \
struct sname##_iter iter; \
PFX##_iter_init(&iter, coll); \
\
for (int j = 0; j < 4; j++) \
+1 -1
View File
@@ -18,7 +18,7 @@
int main(void)
{
cmc_timer timer;
struct cmc_timer timer;
cmc_timer_start(timer);
uintmax_t failed = 0;
+9 -9
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_BIDIMAP(bm, bidimap, size_t, size_t)
CMC_CREATE_UNIT(bidimap_test, true, {
CMC_CREATE_TEST(new, {
bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
struct bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -17,7 +17,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
});
CMC_CREATE_TEST(clear[count], {
bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
struct bidimap *map = bm_new(100, 0.6, cmp, hash, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -34,7 +34,7 @@ CMC_CREATE_UNIT(bidimap_test, true, {
});
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
bidimap *map = bm_new(1, 0.7, cmp, hash, cmp, hash);
struct bidimap *map = bm_new(1, 0.7, cmp, hash, cmp, hash);
for (size_t i = 1; i <= 10000; i++)
cmc_assert(bm_insert(map, i, i));
@@ -55,12 +55,12 @@ CMC_CREATE_UNIT(bidimap_test, true, {
});
CMC_CREATE_TEST(copy_of, {
bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
struct bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
for (size_t i = 0; i < 100; i++)
cmc_assert(bm_insert(map1, i, i));
bidimap *map2 = bm_copy_of(map1, NULL, NULL);
struct bidimap *map2 = bm_copy_of(map1, NULL, NULL);
cmc_assert_not_equals(ptr, NULL, map2);
cmc_assert_equals(size_t, bm_count(map1), bm_count(map2));
@@ -76,8 +76,8 @@ CMC_CREATE_UNIT(bidimap_test, true, {
});
CMC_CREATE_TEST(equals, {
bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
bidimap *map2 = bm_new(1000, 0.9, cmp, hash, cmp, hash);
struct bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
struct bidimap *map2 = bm_new(1000, 0.9, cmp, hash, cmp, hash);
for (size_t i = 0; i < 100; i++)
{
@@ -100,12 +100,12 @@ CMC_CREATE_UNIT(bidimap_test, true, {
});
CMC_CREATE_TEST(equals[from copy], {
bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
struct bidimap *map1 = bm_new(100, 0.7, cmp, hash, cmp, hash);
for (size_t i = 0; i < 100; i++)
cmc_assert(bm_insert(map1, i, i));
bidimap *map2 = bm_copy_of(map1, NULL, NULL);
struct bidimap *map2 = bm_copy_of(map1, NULL, NULL);
cmc_assert_not_equals(ptr, NULL, map2);
+36 -36
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_DEQUE(d, deque, size_t)
CMC_CREATE_UNIT(deque_test, true, {
CMC_CREATE_TEST(new, {
deque *d = d_new(1000000);
struct deque *d = d_new(1000000);
cmc_assert_not_equals(ptr, NULL, d);
cmc_assert_not_equals(ptr, NULL, d->buffer);
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
deque *d = d_new(0);
struct deque *d = d_new(0);
cmc_assert_equals(ptr, NULL, d);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
deque *d = d_new(UINT64_MAX);
struct deque *d = d_new(UINT64_MAX);
cmc_assert_equals(ptr, NULL, d);
});
CMC_CREATE_TEST(clear[count capacity], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -50,7 +50,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
deque *d = d_new(1);
struct deque *d = d_new(1);
cmc_assert_not_equals(ptr, NULL, d);
@@ -64,7 +64,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(buffer_growth[item preservation], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -87,7 +87,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(push_front[count capacity], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -101,7 +101,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(push_front[item preservation], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -121,7 +121,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(push_back[count capacity], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -135,7 +135,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(push_back[item preservation], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -155,7 +155,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(pop_front[count capacity], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -173,7 +173,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(pop_front[item preservation], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -196,7 +196,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(pop_back[count capacity], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -214,7 +214,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(pop_back[item preservation], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -237,7 +237,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(Mixed IO, {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -301,7 +301,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(front[count = 0], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -313,7 +313,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(front[sum], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -342,7 +342,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(back[count = 0], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -354,7 +354,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(back[sum], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -383,7 +383,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(contains, {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -405,7 +405,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(contains[count = 0], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -415,7 +415,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(contains[count = 1], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -436,7 +436,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(empty, {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -450,7 +450,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(full, {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -465,7 +465,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(count, {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -480,7 +480,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(capacity, {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -490,7 +490,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(resize, {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -510,7 +510,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(resize[item preservation], {
deque *d = d_new(100);
struct deque *d = d_new(100);
cmc_assert_not_equals(ptr, NULL, d);
@@ -537,7 +537,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(copy_of, {
deque *d1 = d_new(100);
struct deque *d1 = d_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
@@ -549,7 +549,7 @@ CMC_CREATE_UNIT(deque_test, true, {
cmc_assert(d_push_front(d1, i));
}
deque *d2 = d_copy_of(d1, NULL);
struct deque *d2 = d_copy_of(d1, NULL);
cmc_assert_not_equals(ptr, NULL, d2);
cmc_assert_equals(size_t, d_count(d1), d_count(d2));
@@ -567,8 +567,8 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(equals, {
deque *d1 = d_new(100);
deque *d2 = d_new(100);
struct deque *d1 = d_new(100);
struct deque *d2 = d_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
cmc_assert_not_equals(ptr, NULL, d2);
@@ -594,7 +594,7 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(equals[from copy], {
deque *d1 = d_new(100);
struct deque *d1 = d_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
@@ -606,7 +606,7 @@ CMC_CREATE_UNIT(deque_test, true, {
cmc_assert(d_push_front(d1, i));
}
deque *d2 = d_copy_of(d1, NULL);
struct deque *d2 = d_copy_of(d1, NULL);
cmc_assert_not_equals(ptr, NULL, d2);
@@ -617,11 +617,11 @@ CMC_CREATE_UNIT(deque_test, true, {
});
CMC_CREATE_TEST(equals[count = 0], {
deque *d1 = d_new(100);
struct deque *d1 = d_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
deque *d2 = d_copy_of(d1, NULL);
struct deque *d2 = d_copy_of(d1, NULL);
cmc_assert_not_equals(ptr, NULL, d2);
+33 -33
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_HASHMAP(hm, hashmap, size_t, size_t)
CMC_CREATE_UNIT(hashmap_test, true, {
CMC_CREATE_TEST(new, {
hashmap *map = hm_new(943722, 0.6, cmp, hash);
struct hashmap *map = hm_new(943722, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
cmc_assert_not_equals(ptr, NULL, map->buffer);
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
hashmap *map = hm_new(0, 0.6, cmp, hash);
struct hashmap *map = hm_new(0, 0.6, cmp, hash);
cmc_assert_equals(ptr, NULL, map);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
hashmap *map = hm_new(UINT64_MAX, 0.99, cmp, hash);
struct hashmap *map = hm_new(UINT64_MAX, 0.99, cmp, hash);
cmc_assert_equals(ptr, NULL, map);
});
CMC_CREATE_TEST(clear[count capacity], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(insert, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -60,7 +60,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(insert[smallest capacity], {
hashmap *map = hm_new(1, 0.99, cmp, hash);
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -72,7 +72,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
CMC_CREATE_TEST(insert[element position], {
// Using the numhash the key is the hash itself
hashmap *map = hm_new(1, 0.99, cmp, numhash);
struct hashmap *map = hm_new(1, 0.99, cmp, numhash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -90,7 +90,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(insert[distance], {
hashmap *map = hm_new(500, 0.6, cmp, hash0);
struct hashmap *map = hm_new(500, 0.6, cmp, hash0);
cmc_assert_not_equals(ptr, NULL, map);
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(insert[distance wrap], {
hashmap *map = hm_new(1, 0.99, cmp, hashcapminus1);
struct hashmap *map = hm_new(1, 0.99, cmp, hashcapminus1);
cmc_assert_not_equals(ptr, NULL, map);
@@ -125,7 +125,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(insert[distances], {
hashmap *map = hm_new(1, 0.99, cmp, hashcapminus4);
struct hashmap *map = hm_new(1, 0.99, cmp, hashcapminus4);
cmc_assert_not_equals(ptr, NULL, map);
@@ -141,7 +141,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(insert[buffer growth and item preservation], {
hashmap *map = hm_new(1, 0.99, cmp, hash);
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -165,7 +165,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(update, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -180,7 +180,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(update[key not found], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -193,7 +193,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(remove, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -207,7 +207,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(remove[count = 0], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -218,7 +218,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(remove[key not found], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -232,7 +232,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(max, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -250,7 +250,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(max[count = 0], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -260,7 +260,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(min, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -278,7 +278,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(min[count = 0], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -288,7 +288,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(get, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -300,7 +300,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(get[count = 0], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -310,7 +310,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(get_ref, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -325,7 +325,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(get_ref[count = 0], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -335,7 +335,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(contains, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -347,7 +347,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(contains[count = 0], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -357,7 +357,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(contains[sum], {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -375,7 +375,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(empty, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -389,7 +389,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(full, {
hashmap *map = hm_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
struct hashmap *map = hm_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -410,7 +410,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(count, {
hashmap *map = hm_new(100, 0.6, cmp, hash);
struct hashmap *map = hm_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -424,7 +424,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(capacity, {
hashmap *map = hm_new(2500, 0.6, cmp, hash);
struct hashmap *map = hm_new(2500, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -434,7 +434,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(capacity[small], {
hashmap *map = hm_new(1, 0.99, cmp, hash);
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -444,7 +444,7 @@ CMC_CREATE_UNIT(hashmap_test, true, {
});
CMC_CREATE_TEST(load, {
hashmap *map = hm_new(1, 0.99, cmp, hash);
struct hashmap *map = hm_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
+26 -26
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_HASHSET(hs, hashset, size_t)
CMC_CREATE_UNIT(hashset_test, true, {
CMC_CREATE_TEST(new, {
hashset *set = hs_new(943722, 0.6, cmp, hash);
struct hashset *set = hs_new(943722, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
cmc_assert_not_equals(ptr, NULL, set->buffer);
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
hashset *set = hs_new(0, 0.6, cmp, hash);
struct hashset *set = hs_new(0, 0.6, cmp, hash);
cmc_assert_equals(ptr, NULL, set);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
hashset *set = hs_new(UINT64_MAX, 0.99, cmp, hash);
struct hashset *set = hs_new(UINT64_MAX, 0.99, cmp, hash);
cmc_assert_equals(ptr, NULL, set);
});
CMC_CREATE_TEST(clear[count capacity], {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(insert, {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -60,7 +60,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(insert[smallest capacity], {
hashset *set = hs_new(1, 0.99, cmp, hash);
struct hashset *set = hs_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -72,7 +72,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
CMC_CREATE_TEST(insert[element position], {
// Using the numhash the key is the hash itself
hashset *set = hs_new(1, 0.99, cmp, numhash);
struct hashset *set = hs_new(1, 0.99, cmp, numhash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -90,7 +90,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(insert[distance], {
hashset *set = hs_new(500, 0.6, cmp, hash0);
struct hashset *set = hs_new(500, 0.6, cmp, hash0);
cmc_assert_not_equals(ptr, NULL, set);
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(insert[distance wrap], {
hashset *set = hs_new(1, 0.99, cmp, hashcapminus1);
struct hashset *set = hs_new(1, 0.99, cmp, hashcapminus1);
cmc_assert_not_equals(ptr, NULL, set);
@@ -125,7 +125,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(insert[buffer growth and item preservation], {
hashset *set = hs_new(1, 0.99, cmp, hash);
struct hashset *set = hs_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -149,7 +149,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(remove, {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -163,7 +163,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(remove[count = 0], {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -174,7 +174,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(remove[key not found], {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -188,7 +188,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(max, {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -204,7 +204,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(max[count = 0], {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -214,7 +214,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(min, {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -230,7 +230,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(min[count = 0], {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -240,7 +240,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(contains, {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -252,7 +252,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(contains[count = 0], {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -262,7 +262,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(contains[sum], {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -280,7 +280,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(empty, {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -294,7 +294,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(full, {
hashset *set = hs_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
struct hashset *set = hs_new(cmc_hashtable_primes[0], 0.99999, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -315,7 +315,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(count, {
hashset *set = hs_new(100, 0.6, cmp, hash);
struct hashset *set = hs_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -329,7 +329,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(capacity, {
hashset *set = hs_new(2500, 0.6, cmp, hash);
struct hashset *set = hs_new(2500, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -339,7 +339,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(capacity[small], {
hashset *set = hs_new(1, 0.99, cmp, hash);
struct hashset *set = hs_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -349,7 +349,7 @@ CMC_CREATE_UNIT(hashset_test, true, {
});
CMC_CREATE_TEST(load, {
hashset *set = hs_new(1, 0.99, cmp, hash);
struct hashset *set = hs_new(1, 0.99, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
+12 -12
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_HEAP(h, heap, size_t)
CMC_CREATE_UNIT(heap_test, true, {
CMC_CREATE_TEST(new, {
heap *h = h_new(1000000, cmc_max_heap, cmp);
struct heap *h = h_new(1000000, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
cmc_assert_not_equals(ptr, NULL, h->buffer);
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(new[edge_case capacity = 0], {
heap *h = h_new(0, cmc_max_heap, cmp);
struct heap *h = h_new(0, cmc_max_heap, cmp);
cmc_assert_equals(ptr, NULL, h);
});
CMC_CREATE_TEST(new[edge_case capacity = UINT64_MAX], {
heap *h = h_new(UINT64_MAX, cmc_max_heap, cmp);
struct heap *h = h_new(UINT64_MAX, cmc_max_heap, cmp);
cmc_assert_equals(ptr, NULL, h);
});
CMC_CREATE_TEST(clear[count capacity], {
heap *h = h_new(100, cmc_max_heap, cmp);
struct heap *h = h_new(100, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -50,7 +50,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(buffer_growth[edge_case capacity = 1], {
heap *h = h_new(1, cmc_max_heap, cmp);
struct heap *h = h_new(1, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -63,7 +63,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(insert, {
heap *h = h_new(100, cmc_max_heap, cmp);
struct heap *h = h_new(100, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -73,7 +73,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(insert[item preservation], {
heap *h = h_new(50, cmc_max_heap, cmp);
struct heap *h = h_new(50, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -90,7 +90,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(remove, {
heap *h = h_new(50, cmc_max_heap, cmp);
struct heap *h = h_new(50, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -106,7 +106,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(remove[count = 0], {
heap *h = h_new(100, cmc_max_heap, cmp);
struct heap *h = h_new(100, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -117,7 +117,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(remove[sorted], {
heap *h = h_new(100, cmc_min_heap, cmp);
struct heap *h = h_new(100, cmc_min_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -140,7 +140,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(peek, {
heap *h = h_new(100, cmc_max_heap, cmp);
struct heap *h = h_new(100, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
@@ -153,7 +153,7 @@ CMC_CREATE_UNIT(heap_test, true, {
});
CMC_CREATE_TEST(peek[count = 0], {
heap *h = h_new(100, cmc_max_heap, cmp);
struct heap *h = h_new(100, cmc_max_heap, cmp);
cmc_assert_not_equals(ptr, NULL, h);
+8 -8
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_INTERVALHEAP(ih, intervalheap, size_t)
CMC_CREATE_UNIT(intervalheap_test, true, {
CMC_CREATE_TEST(new, {
intervalheap *ih = ih_new(1000000, cmp);
struct intervalheap *ih = ih_new(1000000, cmp);
cmc_assert_not_equals(ptr, NULL, ih);
cmc_assert_not_equals(ptr, NULL, ih->buffer);
@@ -20,7 +20,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
intervalheap *ih = ih_new(0, cmp);
struct intervalheap *ih = ih_new(0, cmp);
cmc_assert_equals(ptr, NULL, ih);
@@ -29,7 +29,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
});
CMC_CREATE_TEST(new[capacity], {
intervalheap *ih = ih_new(1, cmp);
struct intervalheap *ih = ih_new(1, cmp);
cmc_assert_not_equals(ptr, NULL, ih);
cmc_assert_equals(size_t, 1, ih_capacity(ih));
@@ -59,7 +59,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
intervalheap *ih = ih_new(UINT64_MAX, cmp);
struct intervalheap *ih = ih_new(UINT64_MAX, cmp);
cmc_assert_equals(ptr, NULL, ih);
@@ -68,7 +68,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
});
CMC_CREATE_TEST(clear[count capacity], {
intervalheap *ih = ih_new(100, cmp);
struct intervalheap *ih = ih_new(100, cmp);
cmc_assert_not_equals(ptr, NULL, ih);
@@ -86,7 +86,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
});
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
intervalheap *ih = ih_new(1, cmp);
struct intervalheap *ih = ih_new(1, cmp);
cmc_assert_not_equals(ptr, NULL, ih);
@@ -100,7 +100,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
});
CMC_CREATE_TEST(insert[count], {
intervalheap *ih = ih_new(100, cmp);
struct intervalheap *ih = ih_new(100, cmp);
cmc_assert_not_equals(ptr, NULL, ih);
@@ -113,7 +113,7 @@ CMC_CREATE_UNIT(intervalheap_test, true, {
});
CMC_CREATE_TEST(insert[max min], {
intervalheap *ih = ih_new(1, cmp);
struct intervalheap *ih = ih_new(1, cmp);
cmc_assert_not_equals(ptr, NULL, ih);
+5 -5
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_LINKEDLIST(ll, linkedlist, size_t)
CMC_CREATE_UNIT(linkedlist_test, true, {
CMC_CREATE_TEST(new, {
linkedlist *ll = ll_new();
struct linkedlist *ll = ll_new();
cmc_assert_not_equals(ptr, NULL, ll);
cmc_assert_equals(size_t, 0, ll_count(ll));
@@ -20,7 +20,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
});
CMC_CREATE_TEST(clear[count capacity], {
linkedlist *ll = ll_new();
struct linkedlist *ll = ll_new();
cmc_assert_not_equals(ptr, NULL, ll);
@@ -37,7 +37,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
});
CMC_CREATE_TEST(clear[count = 0], {
linkedlist *ll = ll_new();
struct linkedlist *ll = ll_new();
cmc_assert_not_equals(ptr, NULL, ll);
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
});
CMC_CREATE_TEST(push_front[count], {
linkedlist *ll = ll_new();
struct linkedlist *ll = ll_new();
cmc_assert_not_equals(ptr, NULL, ll);
@@ -63,7 +63,7 @@ CMC_CREATE_UNIT(linkedlist_test, true, {
});
CMC_CREATE_TEST(push_front[item preservation], {
linkedlist *ll = ll_new();
struct linkedlist *ll = ll_new();
cmc_assert_not_equals(ptr, NULL, ll);
+26 -26
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_LIST(l, list, size_t)
CMC_CREATE_UNIT(list_test, true, {
CMC_CREATE_TEST(new, {
list *l = l_new(1000000);
struct list *l = l_new(1000000);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert_not_equals(ptr, NULL, l->buffer);
@@ -20,13 +20,13 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
list *l = l_new(0);
struct list *l = l_new(0);
cmc_assert_equals(ptr, NULL, l);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
list *l = l_new(UINT64_MAX);
struct list *l = l_new(UINT64_MAX);
cmc_assert_equals(ptr, NULL, l);
});
@@ -39,7 +39,7 @@ CMC_CREATE_UNIT(list_test, true, {
v[i] = i;
}
list *l = l_new_from(v, 5);
struct list *l = l_new_from(v, 5);
cmc_assert_not_equals(ptr, NULL, l);
@@ -54,7 +54,7 @@ CMC_CREATE_UNIT(list_test, true, {
size_t *values = &a;
list *l = l_new_from(values, 1);
struct list *l = l_new_from(values, 1);
cmc_assert_not_equals(ptr, NULL, l);
@@ -62,7 +62,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(clear[count capacity], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -80,7 +80,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
list *l = l_new(1);
struct list *l = l_new(1);
cmc_assert_not_equals(ptr, NULL, l);
@@ -96,7 +96,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_front[count], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -109,7 +109,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_front[capacity], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -122,7 +122,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_front[item preservation], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -136,7 +136,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_at[count], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -152,7 +152,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_at[capacity], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -168,7 +168,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_at[item preservation], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -185,7 +185,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_back[count], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -198,7 +198,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_back[capacity], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -211,7 +211,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(push_back[item preservation], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -225,7 +225,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_front[count], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -238,7 +238,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_front[item preservation], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
@@ -254,7 +254,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_front[count = 0], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(!l_pop_front(l));
@@ -263,7 +263,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_front[count = 1], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(l_push_back(l, 10));
@@ -273,7 +273,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_front[buffer_clear], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(l_push_back(l, 1));
@@ -287,7 +287,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_at[count = 0], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(!l_pop_at(l, 1));
@@ -296,7 +296,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_at[count = 1], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(l_push_back(l, 1));
@@ -308,7 +308,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_at[buffer_clear], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(l_push_back(l, 1));
@@ -320,7 +320,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_back[count = 0], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(!l_pop_back(l));
@@ -329,7 +329,7 @@ CMC_CREATE_UNIT(list_test, true, {
});
CMC_CREATE_TEST(pop_back[count = 1], {
list *l = l_new(100);
struct list *l = l_new(100);
cmc_assert_not_equals(ptr, NULL, l);
cmc_assert(l_push_back(l, 10));
+10 -10
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_MULTIMAP(mm, multimap, size_t, size_t)
CMC_CREATE_UNIT(multimap_test, true, {
CMC_CREATE_TEST(new, {
multimap *map = mm_new(943722, 0.8, cmp, hash);
struct multimap *map = mm_new(943722, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
cmc_assert_not_equals(ptr, NULL, map->buffer);
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(multimap_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
multimap *map = mm_new(0, 0.8, cmp, hash);
struct multimap *map = mm_new(0, 0.8, cmp, hash);
cmc_assert_equals(ptr, NULL, map);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
multimap *map = mm_new(UINT64_MAX, 0.99, cmp, hash);
struct multimap *map = mm_new(UINT64_MAX, 0.99, cmp, hash);
cmc_assert_equals(ptr, NULL, map);
});
CMC_CREATE_TEST(clear[count capacity], {
multimap *map = mm_new(100, 0.8, cmp, hash);
struct multimap *map = mm_new(100, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
});
CMC_CREATE_TEST(insert[count], {
multimap *map = mm_new(100, 0.8, cmp, hash);
struct multimap *map = mm_new(100, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -62,7 +62,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
});
CMC_CREATE_TEST(remove[count], {
multimap *map = mm_new(100, 0.8, cmp, hash);
struct multimap *map = mm_new(100, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -80,7 +80,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
});
CMC_CREATE_TEST(remove[count = 0], {
multimap *map = mm_new(100, 0.8, cmp, hash);
struct multimap *map = mm_new(100, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -92,7 +92,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
});
CMC_CREATE_TEST(remove[count = 1], {
multimap *map = mm_new(100, 0.8, cmp, hash);
struct multimap *map = mm_new(100, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
});
CMC_CREATE_TEST(get[key ordering], {
multimap *map = mm_new(100, 0.8, cmp, hash);
struct multimap *map = mm_new(100, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
@@ -121,7 +121,7 @@ CMC_CREATE_UNIT(multimap_test, true, {
});
CMC_CREATE_TEST(key_count, {
multimap *map = mm_new(50, 0.8, cmp, hash);
struct multimap *map = mm_new(50, 0.8, cmp, hash);
cmc_assert_not_equals(ptr, NULL, map);
+8 -8
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_MULTISET(ms, multiset, size_t)
CMC_CREATE_UNIT(multiset_test, true, {
CMC_CREATE_TEST(new, {
multiset *set = ms_new(943722, 0.6, cmp, hash);
struct multiset *set = ms_new(943722, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
cmc_assert_not_equals(ptr, NULL, set->buffer);
@@ -20,19 +20,19 @@ CMC_CREATE_UNIT(multiset_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
multiset *set = ms_new(0, 0.6, cmp, hash);
struct multiset *set = ms_new(0, 0.6, cmp, hash);
cmc_assert_equals(ptr, NULL, set);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
multiset *set = ms_new(UINT64_MAX, 0.99, cmp, hash);
struct multiset *set = ms_new(UINT64_MAX, 0.99, cmp, hash);
cmc_assert_equals(ptr, NULL, set);
});
CMC_CREATE_TEST(clear[count capacity], {
multiset *set = ms_new(100, 0.6, cmp, hash);
struct multiset *set = ms_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -49,7 +49,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
});
CMC_CREATE_TEST(insert[count cardinality multiplicity], {
multiset *set = ms_new(100, 0.6, cmp, hash);
struct multiset *set = ms_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -70,7 +70,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
});
CMC_CREATE_TEST(remove[count cardinality multiplicity], {
multiset *set = ms_new(100, 0.6, cmp, hash);
struct multiset *set = ms_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -103,7 +103,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
});
CMC_CREATE_TEST(remove_all[count cardinality multiplicity], {
multiset *set = ms_new(100, 0.6, cmp, hash);
struct multiset *set = ms_new(100, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
@@ -135,7 +135,7 @@ CMC_CREATE_UNIT(multiset_test, true, {
});
CMC_CREATE_TEST(multiplicity, {
multiset *set = ms_new(50, 0.6, cmp, hash);
struct multiset *set = ms_new(50, 0.6, cmp, hash);
cmc_assert_not_equals(ptr, NULL, set);
+29 -29
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_QUEUE(q, queue, size_t)
CMC_CREATE_UNIT(queue_test, true, {
CMC_CREATE_TEST(new, {
queue *q = q_new(1000000);
struct queue *q = q_new(1000000);
cmc_assert_not_equals(ptr, NULL, q);
cmc_assert_not_equals(ptr, NULL, q->buffer);
@@ -21,19 +21,19 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
queue *q = q_new(0);
struct queue *q = q_new(0);
cmc_assert_equals(ptr, NULL, q);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
queue *q = q_new(UINT64_MAX);
struct queue *q = q_new(UINT64_MAX);
cmc_assert_equals(ptr, NULL, q);
});
CMC_CREATE_TEST(clear[count capacity], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -51,7 +51,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
queue *q = q_new(1);
struct queue *q = q_new(1);
cmc_assert_not_equals(ptr, NULL, q);
@@ -64,7 +64,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(buffer_growth[item preservation], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -84,7 +84,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(enqueue[count capacity], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -98,7 +98,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(enqueue[item preservation], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -118,7 +118,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(dequeue[count capacity], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -136,7 +136,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(dequeue[item preservation], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -159,7 +159,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(peek[count = 0], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -171,7 +171,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(peek[sum], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -195,7 +195,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(contains, {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -214,7 +214,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(contains[count = 0], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -224,7 +224,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(contains[count = 1], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -239,7 +239,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(empty, {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -253,7 +253,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(full, {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -268,7 +268,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(count, {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -283,7 +283,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(capacity, {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -293,7 +293,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(resize, {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -308,7 +308,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(resize[item preservation], {
queue *q = q_new(100);
struct queue *q = q_new(100);
cmc_assert_not_equals(ptr, NULL, q);
@@ -330,14 +330,14 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(copy_of, {
queue *d1 = q_new(100);
struct queue *d1 = q_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
for (size_t i = 1; i <= 150; i++)
cmc_assert(q_enqueue(d1, i));
queue *d2 = q_copy_of(d1, NULL);
struct queue *d2 = q_copy_of(d1, NULL);
cmc_assert_not_equals(ptr, NULL, d2);
cmc_assert_equals(size_t, q_count(d1), q_count(d2));
@@ -355,8 +355,8 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(equals, {
queue *d1 = q_new(100);
queue *d2 = q_new(100);
struct queue *d1 = q_new(100);
struct queue *d2 = q_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
cmc_assert_not_equals(ptr, NULL, d2);
@@ -374,7 +374,7 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(equals[from copy], {
queue *d1 = q_new(100);
struct queue *d1 = q_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
@@ -383,7 +383,7 @@ CMC_CREATE_UNIT(queue_test, true, {
cmc_assert(q_enqueue(d1, i));
}
queue *d2 = q_copy_of(d1, NULL);
struct queue *d2 = q_copy_of(d1, NULL);
cmc_assert_not_equals(ptr, NULL, d2);
@@ -394,11 +394,11 @@ CMC_CREATE_UNIT(queue_test, true, {
});
CMC_CREATE_TEST(equals[count = 0], {
queue *d1 = q_new(100);
struct queue *d1 = q_new(100);
cmc_assert_not_equals(ptr, NULL, d1);
queue *d2 = q_copy_of(d1, NULL);
struct queue *d2 = q_copy_of(d1, NULL);
cmc_assert_not_equals(ptr, NULL, d2);
+10 -10
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_SORTEDLIST(sl, sortedlist, size_t)
CMC_CREATE_UNIT(sortedlist_test, true, {
CMC_CREATE_TEST(new, {
sortedlist *sl = sl_new(1000000, cmp);
struct sortedlist *sl = sl_new(1000000, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
cmc_assert_not_equals(ptr, NULL, sl->buffer);
@@ -21,19 +21,19 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
sortedlist *sl = sl_new(0, cmp);
struct sortedlist *sl = sl_new(0, cmp);
cmc_assert_equals(ptr, NULL, sl);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
sortedlist *sl = sl_new(UINT64_MAX, cmp);
struct sortedlist *sl = sl_new(UINT64_MAX, cmp);
cmc_assert_equals(ptr, NULL, sl);
});
CMC_CREATE_TEST(clear[count capacity], {
sortedlist *sl = sl_new(100, cmp);
struct sortedlist *sl = sl_new(100, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
@@ -51,7 +51,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
});
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
sortedlist *sl = sl_new(1, cmp);
struct sortedlist *sl = sl_new(1, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
@@ -67,7 +67,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
});
CMC_CREATE_TEST(insert, {
sortedlist *sl = sl_new(100, cmp);
struct sortedlist *sl = sl_new(100, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
@@ -77,7 +77,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
});
CMC_CREATE_TEST(remove, {
sortedlist *sl = sl_new(100, cmp);
struct sortedlist *sl = sl_new(100, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
@@ -89,7 +89,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
});
CMC_CREATE_TEST(remove[count = 0], {
sortedlist *sl = sl_new(100, cmp);
struct sortedlist *sl = sl_new(100, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
@@ -99,7 +99,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
});
CMC_CREATE_TEST(remove[out of range], {
sortedlist *sl = sl_new(100, cmp);
struct sortedlist *sl = sl_new(100, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
@@ -111,7 +111,7 @@ CMC_CREATE_UNIT(sortedlist_test, true, {
});
CMC_CREATE_TEST(indexof, {
sortedlist *sl = sl_new(1, cmp);
struct sortedlist *sl = sl_new(1, cmp);
cmc_assert_not_equals(ptr, NULL, sl);
+60 -60
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_STACK(s, stack, size_t)
CMC_CREATE_UNIT(stack_test, true, {
CMC_CREATE_TEST(new, {
stack *s = s_new(1000000);
struct stack *s = s_new(1000000);
cmc_assert_not_equals(ptr, NULL, s);
cmc_assert_not_equals(ptr, NULL, s->buffer);
@@ -21,19 +21,19 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(new[capacity = 0], {
stack *s = s_new(0);
struct stack *s = s_new(0);
cmc_assert_equals(ptr, NULL, s);
});
CMC_CREATE_TEST(new[capacity = UINT64_MAX], {
stack *s = s_new(UINT64_MAX);
struct stack *s = s_new(UINT64_MAX);
cmc_assert_equals(ptr, NULL, s);
});
CMC_CREATE_TEST(clear[count capacity], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -51,7 +51,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(buffer_growth[capacity = 1], {
stack *s = s_new(1);
struct stack *s = s_new(1);
cmc_assert_not_equals(ptr, NULL, s);
@@ -65,7 +65,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(push[count], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -78,7 +78,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(push[capacity], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -91,7 +91,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(push[item preservation], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -105,7 +105,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(pop[count], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -120,7 +120,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(pop[capacity], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -135,7 +135,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(pop[item preservation], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -152,7 +152,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(pop[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -162,7 +162,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(top, {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -178,7 +178,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(top[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -192,7 +192,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(top[count = 1], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -204,7 +204,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(contains, {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -218,7 +218,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(contains[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -228,7 +228,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(empty, {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -238,7 +238,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(empty[after_io], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -250,7 +250,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(full, {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -263,7 +263,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(full[capacity = 1], {
stack *s = s_new(1);
struct stack *s = s_new(1);
cmc_assert_not_equals(ptr, NULL, s);
@@ -275,11 +275,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iter_alloc, {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter *iter = s_iter_new(s);
struct stack_iter *iter = s_iter_new(s);
cmc_assert_not_equals(ptr, NULL, iter);
@@ -288,11 +288,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iter_init[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
@@ -305,11 +305,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iter_start[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
@@ -319,11 +319,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iter_end[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
@@ -333,7 +333,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iteration, {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -342,14 +342,14 @@ CMC_CREATE_UNIT(stack_test, true, {
size_t total = 0;
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
{
total += s_iter_value(&it);
}
cmc_assert_equals(size_t, 20100, total);
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
{
total += s_iter_value(&it);
}
@@ -360,7 +360,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iteration[while loop], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -368,7 +368,7 @@ CMC_CREATE_UNIT(stack_test, true, {
cmc_assert(s_push(s, i));
size_t total = 0;
stack_iter it = s->it_start(s);
struct stack_iter it = s->it_start(s);
do
{
@@ -390,19 +390,19 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iteration[count = 1], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
cmc_assert(s_push(s, 10));
size_t total = 0;
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
{
total += s_iter_value(&it);
}
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
{
total += s_iter_value(&it);
}
@@ -413,7 +413,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iteration[count = capacity], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -424,14 +424,14 @@ CMC_CREATE_UNIT(stack_test, true, {
size_t total = 0;
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
{
total += s_iter_value(&it);
}
cmc_assert_equals(size_t, 1000, total);
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
{
total += *s_iter_rvalue(&it);
}
@@ -442,18 +442,18 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iteration[to_start = it_start and to_end = it_end], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
for (size_t i = 0; i < 50; i++)
cmc_assert(s_push(s, i));
stack_iter it1;
stack_iter it2;
struct stack_iter it1;
struct stack_iter it2;
memset(&it1, 0, sizeof(stack_iter));
memset(&it2, 0, sizeof(stack_iter));
memset(&it1, 0, sizeof(struct stack_iter));
memset(&it2, 0, sizeof(struct stack_iter));
s_iter_init(&it2, s);
@@ -477,11 +477,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iteration[boundaries count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
s_iter_to_end(&iter);
@@ -496,14 +496,14 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iteration[boundaries count > 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
for (size_t i = 0; i < 200; i++)
cmc_assert(s_push(s, i));
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
s_iter_to_end(&iter);
@@ -518,11 +518,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iter_value[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
@@ -532,11 +532,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(iter_rvalue[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
@@ -546,7 +546,7 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(index, {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
@@ -557,24 +557,24 @@ CMC_CREATE_UNIT(stack_test, true, {
size_t total = 0;
for (stack_iter it = s->it_start(s); false;)
for (struct stack_iter it = s->it_start(s); false;)
{
cmc_assert_equals(size_t, 0, s_iter_index(&it));
}
for (stack_iter it = s->it_start(s); false;)
for (struct stack_iter it = s->it_start(s); false;)
{
cmc_assert_equals(size_t, s_count(s) - 1, s_iter_index(&it));
}
for (stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
for (struct stack_iter it = s->it_start(s); !s_iter_end(&it); s_iter_next(&it))
{
total += s_iter_index(&it);
}
cmc_assert_equals(size_t, 45, total);
for (stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
for (struct stack_iter it = s->it_end(s); !s_iter_start(&it); s_iter_prev(&it))
{
total += s_iter_index(&it);
}
@@ -585,11 +585,11 @@ CMC_CREATE_UNIT(stack_test, true, {
});
CMC_CREATE_TEST(index[count = 0], {
stack *s = s_new(100);
struct stack *s = s_new(100);
cmc_assert_not_equals(ptr, NULL, s);
stack_iter iter;
struct stack_iter iter;
s_iter_init(&iter, s);
cmc_assert_equals(size_t, 0, s_iter_index(&iter));
+2 -2
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_TREEMAP(tm, treemap, size_t, size_t)
CMC_CREATE_UNIT(treemap_test, true, {
CMC_CREATE_TEST(new, {
treemap *map = tm_new(cmp);
struct treemap *map = tm_new(cmp);
cmc_assert_not_equals(ptr, NULL, map);
@@ -17,7 +17,7 @@ CMC_CREATE_UNIT(treemap_test, true, {
});
CMC_CREATE_TEST(clear[count], {
treemap *map = tm_new(cmp);
struct treemap *map = tm_new(cmp);
cmc_assert_not_equals(ptr, NULL, map);
+2 -2
View File
@@ -9,7 +9,7 @@ CMC_GENERATE_TREESET(ts, treeset, size_t)
CMC_CREATE_UNIT(treeset_test, true, {
CMC_CREATE_TEST(new, {
treeset *set = ts_new(cmp);
struct treeset *set = ts_new(cmp);
cmc_assert_not_equals(ptr, NULL, set);
@@ -17,7 +17,7 @@ CMC_CREATE_UNIT(treeset_test, true, {
});
CMC_CREATE_TEST(clear[count], {
treeset *set = ts_new(cmp);
struct treeset *set = ts_new(cmp);
cmc_assert_not_equals(ptr, NULL, set);
+13 -14
View File
@@ -20,20 +20,19 @@ size_t inthash(int t)
int main(void)
{
list *l = l_new(1000);
stack *s = s_new(1000);
queue *q = q_new(1000);
deque *d = d_new(1000);
linked *ll = ll_new();
heap *h = h_new(1000, cmc_max_heap, intcmp);
tset *ts = ts_new(intcmp);
tmap *tm = tm_new(intcmp);
hset *hs = hs_new(1000, 0.6, intcmp, inthash);
hmap *hm = hm_new(1000, 0.6, intcmp, inthash);
iheap *ih = ih_new(1000, intcmp);
mmap *mm = mm_new(1000, 0.8, intcmp, inthash);
mset *ms = ms_new(1000, 0.6, intcmp, inthash);
struct list *l = l_new(1000);
struct stack *s = s_new(1000);
struct queue *q = q_new(1000);
struct deque *d = d_new(1000);
struct linked *ll = ll_new();
struct heap *h = h_new(1000, cmc_max_heap, intcmp);
struct tset *ts = ts_new(intcmp);
struct tmap *tm = tm_new(intcmp);
struct hset *hs = hs_new(1000, 0.6, intcmp, inthash);
struct hmap *hm = hm_new(1000, 0.6, intcmp, inthash);
struct iheap *ih = ih_new(1000, intcmp);
struct mmap *mm = mm_new(1000, 0.8, intcmp, inthash);
struct mset *ms = ms_new(1000, 0.6, intcmp, inthash);
printf("+--------------------------------------------------+\n");
printf("| Separate Header and Source is Working |\n");