mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Some more coverage commenting
This commit is contained in:
parent
84f7a623ab
commit
9b918c3ca0
1 changed files with 148 additions and 67 deletions
|
|
@ -316,20 +316,38 @@ static void test_tommy(void)
|
|||
*(unsigned*)tommy_arrayblkof_ref(&arrayblkof, i) = i;
|
||||
}
|
||||
|
||||
if (tommy_array_memory_usage(&array) < TOMMY_SIZE * sizeof(void*))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_arrayblk_memory_usage(&arrayblk) < TOMMY_SIZE * sizeof(void*))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_arrayblkof_memory_usage(&arrayblkof) < TOMMY_SIZE * sizeof(unsigned))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_array_memory_usage(&array) < TOMMY_SIZE * sizeof(void*)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_arrayblk_memory_usage(&arrayblk) < TOMMY_SIZE * sizeof(void*)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_arrayblkof_memory_usage(&arrayblkof) < TOMMY_SIZE * sizeof(unsigned)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
for (i = 0; i < TOMMY_SIZE; ++i) {
|
||||
if (tommy_array_get(&array, i) != &node[i])
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_arrayblk_get(&arrayblk, i) != &node[i])
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (*(unsigned*)tommy_arrayblkof_ref(&arrayblkof, i) != i)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_array_get(&array, i) != &node[i]) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_arrayblk_get(&arrayblk, i) != &node[i]) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (*(unsigned*)tommy_arrayblkof_ref(&arrayblkof, i) != i) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
tommy_arrayblkof_done(&arrayblkof);
|
||||
|
|
@ -338,49 +356,80 @@ static void test_tommy(void)
|
|||
|
||||
tommy_list_init(&list);
|
||||
|
||||
if (!tommy_list_empty(&list))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (!tommy_list_empty(&list)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (tommy_list_tail(&list))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_list_tail(&list)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (tommy_list_head(&list))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_list_head(&list)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
tommy_hashdyn_init(&hashdyn);
|
||||
|
||||
for (i = 0; i < TOMMY_SIZE; ++i)
|
||||
tommy_hashdyn_insert(&hashdyn, &node[i], &node[i], i % 64);
|
||||
|
||||
if (tommy_hashdyn_count(&hashdyn) != TOMMY_SIZE)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_hashdyn_count(&hashdyn) != TOMMY_SIZE) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (tommy_hashdyn_memory_usage(&hashdyn) < TOMMY_SIZE * sizeof(tommy_node))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_hashdyn_memory_usage(&hashdyn) < TOMMY_SIZE * sizeof(tommy_node)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
tommy_test_foreach_count = 0;
|
||||
tommy_hashdyn_foreach(&hashdyn, tommy_test_foreach);
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
tommy_test_foreach_count = 0;
|
||||
tommy_hashdyn_foreach_arg(&hashdyn, tommy_test_foreach_arg, &tommy_test_foreach_count);
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
for (i = 0; i < TOMMY_SIZE / 2; ++i)
|
||||
tommy_hashdyn_remove_existing(&hashdyn, &node[i]);
|
||||
|
||||
for (i = 0; i < TOMMY_SIZE / 2; ++i)
|
||||
if (tommy_hashdyn_remove(&hashdyn, tommy_test_search, &node[i], i % 64) != 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
for (i = 0; i < TOMMY_SIZE / 2; ++i) {
|
||||
if (tommy_hashdyn_remove(&hashdyn, tommy_test_search, &node[i], i % 64) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
for (i = TOMMY_SIZE / 2; i < TOMMY_SIZE; ++i) {
|
||||
if (tommy_hashdyn_remove(&hashdyn, tommy_test_search, &node[i], i % 64) == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
for (i = TOMMY_SIZE / 2; i < TOMMY_SIZE; ++i)
|
||||
if (tommy_hashdyn_remove(&hashdyn, tommy_test_search, &node[i], i % 64) == 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
|
||||
if (tommy_hashdyn_count(&hashdyn) != 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_hashdyn_count(&hashdyn) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
tommy_hashdyn_done(&hashdyn);
|
||||
|
||||
|
|
@ -390,50 +439,82 @@ static void test_tommy(void)
|
|||
tommy_tree_insert(&tree, &node[i], (void*)(uintptr_t)(i+1));
|
||||
|
||||
/* try to insert a duplicate, count should not change */
|
||||
if (tommy_tree_insert(&tree, &node[TOMMY_SIZE], (void*)1) != (void*)1)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
|
||||
if (tommy_tree_count(&tree) != TOMMY_SIZE)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
|
||||
if (tommy_tree_memory_usage(&tree) < TOMMY_SIZE * sizeof(tommy_node))
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
|
||||
if (tommy_tree_search(&tree, (void*)1) != (void*)1)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
|
||||
if (tommy_tree_search(&tree, (void*)-1) != 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
|
||||
if (tommy_tree_search_compare(&tree, tommy_test_compare, (void*)1) != (void*)1)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
|
||||
if (tommy_tree_search_compare(&tree, tommy_test_compare, (void*)-1) != 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_tree_insert(&tree, &node[TOMMY_SIZE], (void*)1) != (void*)1) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_tree_count(&tree) != TOMMY_SIZE) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_tree_memory_usage(&tree) < TOMMY_SIZE * sizeof(tommy_node)) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_tree_search(&tree, (void*)1) != (void*)1) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_tree_search(&tree, (void*)-1) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_tree_search_compare(&tree, tommy_test_compare, (void*)1) != (void*)1) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
if (tommy_tree_search_compare(&tree, tommy_test_compare, (void*)-1) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
tommy_test_foreach_count = 0;
|
||||
tommy_tree_foreach(&tree, tommy_test_foreach);
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
tommy_test_foreach_count = 0;
|
||||
tommy_tree_foreach_arg(&tree, tommy_test_foreach_arg, &tommy_test_foreach_count);
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_test_foreach_count != TOMMY_SIZE) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
for (i = 0; i < TOMMY_SIZE / 2; ++i)
|
||||
tommy_tree_remove_existing(&tree, &node[i]);
|
||||
|
||||
for (i = 0; i < TOMMY_SIZE / 2; ++i)
|
||||
if (tommy_tree_remove(&tree, (void*)(uintptr_t)(i+1)) != 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
for (i = 0; i < TOMMY_SIZE / 2; ++i) {
|
||||
if (tommy_tree_remove(&tree, (void*)(uintptr_t)(i+1)) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
for (i = TOMMY_SIZE / 2; i < TOMMY_SIZE; ++i)
|
||||
if (tommy_tree_remove(&tree, (void*)(uintptr_t)(i+1)) == 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
for (i = TOMMY_SIZE / 2; i < TOMMY_SIZE; ++i) {
|
||||
if (tommy_tree_remove(&tree, (void*)(uintptr_t)(i+1)) == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
if (tommy_tree_count(&tree) != 0)
|
||||
/* LCOV_EXCL_START */ goto bail; /* LCOV_EXCL_STOP */
|
||||
if (tommy_tree_count(&tree) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
return;
|
||||
bail:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue