X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fdaemon%2Futils_heap_test.c;h=827c090f512ddc51c9d3ab285d5b4926d32f5923;hp=54a9613abecac1bd5da1f2a3f8de9e7d777bb3cd;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hpb=958f7776a2daaa1a8664aded0a2c1d717c2f5909 diff --git a/src/daemon/utils_heap_test.c b/src/daemon/utils_heap_test.c index 54a9613a..827c090f 100644 --- a/src/daemon/utils_heap_test.c +++ b/src/daemon/utils_heap_test.c @@ -29,8 +29,7 @@ #include "testing.h" #include "utils_heap.h" -static int compare (void const *v0, void const *v1) -{ +static int compare(void const *v0, void const *v1) { int const *i0 = v0; int const *i1 = v1; @@ -42,44 +41,38 @@ static int compare (void const *v0, void const *v1) return 0; } -DEF_TEST(simple) -{ - int values[] = { 9, 5, 6, 1, 3, 4, 0, 8, 2, 7 }; +DEF_TEST(simple) { + int values[] = {9, 5, 6, 1, 3, 4, 0, 8, 2, 7}; c_heap_t *h; - CHECK_NOT_NULL(h = c_heap_create (compare)); + CHECK_NOT_NULL(h = c_heap_create(compare)); for (int i = 0; i < 10; i++) - CHECK_ZERO(c_heap_insert (h, &values[i])); + CHECK_ZERO(c_heap_insert(h, &values[i])); - for (int i = 0; i < 5; i++) - { + for (int i = 0; i < 5; i++) { int *ret = NULL; CHECK_NOT_NULL(ret = c_heap_get_root(h)); OK(*ret == i); } - CHECK_ZERO(c_heap_insert (h, &values[6] /* = 0 */)); - CHECK_ZERO(c_heap_insert (h, &values[3] /* = 1 */)); - CHECK_ZERO(c_heap_insert (h, &values[8] /* = 2 */)); - CHECK_ZERO(c_heap_insert (h, &values[4] /* = 3 */)); - CHECK_ZERO(c_heap_insert (h, &values[5] /* = 4 */)); + CHECK_ZERO(c_heap_insert(h, &values[6] /* = 0 */)); + CHECK_ZERO(c_heap_insert(h, &values[3] /* = 1 */)); + CHECK_ZERO(c_heap_insert(h, &values[8] /* = 2 */)); + CHECK_ZERO(c_heap_insert(h, &values[4] /* = 3 */)); + CHECK_ZERO(c_heap_insert(h, &values[5] /* = 4 */)); - for (int i = 0; i < 10; i++) - { + for (int i = 0; i < 10; i++) { int *ret = NULL; CHECK_NOT_NULL(ret = c_heap_get_root(h)); OK(*ret == i); } c_heap_destroy(h); - return (0); + return 0; } -int main (void) -{ +int main(void) { RUN_TEST(simple); END_TEST; } - -/* vim: set sw=2 sts=2 et : */