Add more testing (#23)

Increase code coverage so that other than the out-of-memory conditions, the code is entirely covered.

Some areas of the code have been tweaked for performance optimizations.

Bug fix! A bug has been identified and fixed in the unordered_multiset data structure in the unordered_multiset_remove_all function.

This bug would occur when more than one entry exists in the bucket in which the element is occupying, and that element had a count of more than one.
This commit is contained in:
Bailey Thompson
2019-04-30 23:22:36 -04:00
committed by GitHub
parent 6b297bfc51
commit 20e8839143
20 changed files with 1544 additions and 14 deletions

View File

@@ -55,11 +55,16 @@ bool stub_priority_queue_pop(void *const data, priority_queue me)
void test_priority_queue(void)
{
assert(!priority_queue_init(0, compare_int));
assert(!priority_queue_init(sizeof(int), NULL));
priority_queue me = priority_queue_init(sizeof(int), compare_int);
assert(me);
assert(priority_queue_size(me) == 0);
assert(priority_queue_is_empty(me));
int item = 5;
int item = 0xdeadbeef;
assert(!priority_queue_pop(&item, me));
assert(item == 0xdeadbeef);
item = 5;
stub_priority_queue_push(me, &item);
item = 2;
stub_priority_queue_push(me, &item);